Skip to main content
POST
/
wp-json
/
getmcp
/
v1
/
servers
/
{server_id}
/
tools
/
import-openapi
curl --request POST \
     --url https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-openapi \
     --header 'Authorization: Bearer gmcp_your_api_key' \
     --header 'content-type: application/json' \
     --data '{
       "source": "url",
       "url": "https://petstore3.swagger.io/api/v3/openapi.json"
     }'
{
  "candidates": [
    {
      "temp_id": "op_0",
      "name": "List Pets",
      "slug": "list_pets",
      "description": "Returns all pets from the system that the user has access to.",
      "endpoint_url": "https://petstore3.swagger.io/api/v3/pet/findByStatus",
      "http_method": "GET",
      "input_schema": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["available", "pending", "sold"] }
        },
        "required": ["status"]
      },
      "headers": null,
      "tags": ["pet"]
    }
  ],
  "info": {
    "title": "Swagger Petstore",
    "version": "1.0.11"
  }
}
This endpoint accepts an OpenAPI 3.x JSON or YAML spec and runs a two-phase import: the first call returns a list of candidate tools (one per operation), the second call commits the selection.
Phase 1 (no commit flag) parses the spec and returns candidates with temp_ids — no tools are created. Phase 2 (commit: true) takes the same body plus selected_temp_ids and writes the chosen tools to the database. This mirrors the import wizard in the admin UI.
Imported tools default to status draft so a careless import never silently exposes half-baked tools to MCP clients. Pass imported_status: "active" on the commit call when you’ve reviewed the candidates and want them live immediately.

Path Parameters

server_id
string
required
The UUID of the server to import into (e.g. 836995ae-1cff-41ec-823e-a4f07ccca3a0). Numeric IDs are also accepted for backwards compatibility.

Body Parameters

source
string
default:"text"
Where the spec content comes from. One of: text (use content), url (use url).
content
string
The raw spec body (JSON or YAML). Required when source is text. Hard cap of 10 MB.
url
string
Public URL to fetch the spec from. Required when source is url. Followed up to 3 redirects, 10 s timeout, 10 MB cap.
commit
boolean
default:"false"
When false (default), parse the spec and return candidates without writing anything. When true, persist the candidates listed in selected_temp_ids.
selected_temp_ids
array
Array of temp_id strings (returned by the parse phase) identifying which candidates to create. Required when commit is true. Anything not in the list is silently ignored.
on_conflict
string
default:"skip"
How to handle slug collisions during commit. One of: skip (default — record goes into skipped[]), duplicate (let ToolManager auto-suffix the slug).
imported_status
string
default:"draft"
Status for newly created tools during commit. One of: draft, active. Defaults to draft for safety.
curl --request POST \
     --url https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-openapi \
     --header 'Authorization: Bearer gmcp_your_api_key' \
     --header 'content-type: application/json' \
     --data '{
       "source": "url",
       "url": "https://petstore3.swagger.io/api/v3/openapi.json"
     }'
{
  "candidates": [
    {
      "temp_id": "op_0",
      "name": "List Pets",
      "slug": "list_pets",
      "description": "Returns all pets from the system that the user has access to.",
      "endpoint_url": "https://petstore3.swagger.io/api/v3/pet/findByStatus",
      "http_method": "GET",
      "input_schema": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["available", "pending", "sold"] }
        },
        "required": ["status"]
      },
      "headers": null,
      "tags": ["pet"]
    }
  ],
  "info": {
    "title": "Swagger Petstore",
    "version": "1.0.11"
  }
}

Status Codes

CodeMeaning
200Spec parsed (phase 1) or commit completed (phase 2).
400Bad spec, empty content, wrong version, or unfetchable URL.
40214-day trial expired and no active license.
403Current license tier does not allow OpenAPI import.
404Server not found.