Skip to main content
POST
/
wp-json
/
getmcp
/
v1
/
servers
/
{server_id}
/
tools
/
import-swagger
curl --request POST \
     --url https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-swagger \
     --header 'Authorization: Bearer gmcp_your_api_key' \
     --header 'content-type: application/json' \
     --data '{
       "source": "url",
       "url": "https://example.com/swagger-2.0.json"
     }'
{
  "candidates": [
    {
      "temp_id": "op_0",
      "name": "Get User",
      "slug": "get_user",
      "description": "Fetch a user by ID.",
      "endpoint_url": "https://api.example.com/v1/users/{id}",
      "http_method": "GET",
      "input_schema": {
        "type": "object",
        "properties": {
          "id": { "type": "string" }
        },
        "required": ["id"]
      },
      "headers": null,
      "tags": ["users"]
    }
  ],
  "info": {
    "title": "Example API",
    "version": "1.0.0"
  }
}
This endpoint mirrors /import-openapi but targets the older Swagger 2.0 schema. The same two-phase parse-then-commit flow applies.
Phase 1 (no commit flag) parses the spec and returns candidates with temp_ids. Phase 2 (commit: true) takes selected_temp_ids and writes the chosen tools. Use the /import-openapi endpoint instead for OpenAPI 3.x — passing a 3.x document here will fail with unsupported_version.

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.
commit
boolean
default:"false"
When false (default), parse and return candidates only. When true, persist the candidates listed in selected_temp_ids.
selected_temp_ids
array
Array of temp_id strings identifying which candidates to create. Required when commit is true.
on_conflict
string
default:"skip"
Slug-collision policy. One of: skip, duplicate.
imported_status
string
default:"draft"
Status for newly created tools. One of: draft, active.
curl --request POST \
     --url https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-swagger \
     --header 'Authorization: Bearer gmcp_your_api_key' \
     --header 'content-type: application/json' \
     --data '{
       "source": "url",
       "url": "https://example.com/swagger-2.0.json"
     }'
{
  "candidates": [
    {
      "temp_id": "op_0",
      "name": "Get User",
      "slug": "get_user",
      "description": "Fetch a user by ID.",
      "endpoint_url": "https://api.example.com/v1/users/{id}",
      "http_method": "GET",
      "input_schema": {
        "type": "object",
        "properties": {
          "id": { "type": "string" }
        },
        "required": ["id"]
      },
      "headers": null,
      "tags": ["users"]
    }
  ],
  "info": {
    "title": "Example API",
    "version": "1.0.0"
  }
}

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 Swagger import.
404Server not found.