Skip to main content
Glama
swagger-doc-explorer-mcp

swagger-doc-explorer-mcp

by anuoua

Swagger Doc Explorer MCP

MCP server for progressive exploration of Swagger/OpenAPI documentation. Supports stdio (local) and HTTP (remote) transports.

Each loaded spec is identified by a unique name ({title} v{version}) assigned at load time. All downstream tools reference the spec by name, so you can load and inspect multiple specs simultaneously.

Tools

Tool

Description

swagger_load_spec

Load spec from a remote URL. url (required), auth_header (optional). Returns the assigned spec_name

swagger_load_local_spec

Load spec from a local JSON file. file_path (required). Returns the assigned spec_name

swagger_list_loaded

List all specs currently loaded (name, title, version, source)

swagger_remove_spec

Remove a loaded spec from memory. spec_name (required)

swagger_get_info

Get API title, version, description, server URL. spec_name (required)

swagger_list_tags

List all tags/groups with endpoint counts. spec_name (required)

swagger_list_paths

List endpoints, optionally filtered by tag. Supports limit (default 50) and offset pagination. spec_name (required)

swagger_get_endpoint

Drill into a specific endpoint: path, method. spec_name (required)

swagger_get_endpoint_full

Drill into endpoint with all $ref recursively resolved. Single-call completeness

swagger_list_schemas

List all data models/schemas. Supports limit and offset. spec_name (required)

swagger_get_schema

Get full details of a specific schema: schema_name. spec_name (required)

swagger_search

Full-text search across endpoints and schemas: query. spec_name (required)

Related MCP server: magento-api-mcp

Installation

npm install -g swagger-doc-explorer-mcp

Or use directly with npx (no install needed):

npx -y swagger-doc-explorer-mcp

Usage

stdio (default)

npx -y swagger-doc-explorer-mcp

HTTP

SWAGGER_HTTP_PORT=3000 npx -y swagger-doc-explorer-mcp

The HTTP server accepts POST requests at / following the MCP Streamable HTTP protocol. Clients must include Accept: application/json, text/event-stream and use the mcp-session-id header for session affinity:

# Initialize session
curl -X POST http://localhost:3000/ \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"my-client","version":"1.0"}}}'

# Copy the mcp-session-id from response headers, then:
curl -X POST http://localhost:3000/ \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "mcp-session-id: <session-id>" \
  -d '{"jsonrpc":"2.0","method":"notifications/initialized"}'

curl -X POST http://localhost:3000/ \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "mcp-session-id: <session-id>" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"swagger_load_spec","arguments":{"url":"https://petstore.swagger.io/v2/swagger.json"}}}'

Development

npm run dev          # stdio mode with hot reload
npm run dev:http     # HTTP mode on port 3000 with hot reload

MCP client configuration

Use npx so the client auto-installs the package:

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "swagger-doc-explorer": {
      "command": "npx",
      "args": ["-y", "swagger-doc-explorer-mcp"]
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "swagger-doc-explorer": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "swagger-doc-explorer-mcp"]
    }
  }
}

If installed globally, use swagger-doc-explorer-mcp directly as the command.

opencode (~/.config/opencode/opencode.json):

{
  "mcp": {
    "swagger-doc-explorer": {
      "type": "local",
      "command": ["npx", "-y", "swagger-doc-explorer-mcp"],
      "enabled": true
    }
  }
}

Environment Variables

Variable

Description

SWAGGER_HTTP_PORT

Set to enable HTTP mode (e.g. 3000). Omit for stdio mode

Progressive Exploration Workflow

1. swagger_load_spec / swagger_load_local_spec  → load the API spec (returns spec_name)
2. swagger_get_info(spec_name="...")             → overview of the API
3. swagger_list_tags(spec_name="...")            → see available groups
4. swagger_list_paths(spec_name="...", tag="users") → browse endpoints in a group
5. swagger_get_endpoint(spec_name="...", path, method) → drill into endpoint details
6. swagger_list_schemas(spec_name="...")         → see available data models
7. swagger_get_schema(spec_name="...", schema_name) → inspect a model
8. swagger_search(spec_name="...", query)        → find anything across the spec

Multiple specs can be loaded and queried simultaneously — each identified by its unique spec_name.

Compatibility

  • OpenAPI v3.x (openapi field)

  • Swagger v2 (swagger field)

  • JSON format only (YAML is not supported)

  • Remote URLs and local file paths

Build & Test

npm run build
npm test

Available Tools

12 tools
swagger_get_endpointGet Endpoint DetailsA
Read-onlyIdempotent

Get detailed information about a specific API endpoint, including parameters, request body, responses, and security requirements.

Use this tool after swagger_list_paths to drill down into a specific endpoint's complete details.

Args:

  • spec_name (string): Name of the previously loaded spec

  • path (string): URL path of the endpoint (e.g., "/pets/{petId}")

  • method (string): HTTP method (get, post, put, patch, delete, options, head)

Returns: Full endpoint details with parameters, request body, responses, and security.

Examples:

  • Use when: "Show me the details of GET /pets/{petId}" -> params with spec_name="", path="/pets/{petId}", method="get"

  • Use when: "What parameters does the create user endpoint take?" -> params with spec_name="", path="/users", method="post"

Error Handling:

  • Returns error if the spec name has not been loaded

  • Returns error if the path or method is not found, with suggestions

Inputs: path (required), method (required), spec_name (required).

swagger_get_endpoint_fullGet Endpoint Details (All $ref Resolved)A
Read-onlyIdempotent

Get detailed information about a specific API endpoint with all schema references ($ref) recursively resolved.

Unlike swagger_get_endpoint, this tool resolves every $ref into its full schema definition. Parameters, request body schemas, and response schemas are expanded inline with no external references. Circular references are detected and marked.

Use this when you need the complete endpoint definition in a single call, without needing to follow $ref links manually.

Args:

  • spec_name (string): Name of the previously loaded spec

  • path (string): URL path of the endpoint (e.g., "/pets/{petId}")

  • method (string): HTTP method (get, post, put, patch, delete, options, head)

Returns: Full endpoint details with all $ref resolved recursively.

Examples:

  • Use when: "Show me everything about GET /pets/{petId} with all schemas expanded" -> params with spec_name="", path="/pets/{petId}", method="get"

  • Use when: "Give me the full request body schema for creating a user" -> params with spec_name="", path="/users", method="post"

Error Handling:

  • Returns error if the spec name has not been loaded

  • Returns error if the path or method is not found, with suggestions

Inputs: path (required), method (required), spec_name (required).

swagger_get_infoGet API InfoA
Read-onlyIdempotent

Get general information about a loaded OpenAPI/Swagger specification, including title, version, description, server URL, contact info, and license.

Use this tool to get a high-level summary of an API spec.

Args:

  • spec_name (string): Name of the previously loaded spec (use swagger_list_loaded to see available names)

Returns: { "title": string, // API title "version": string, // API version "description": string, // API description "server_url": string, // Base server URL "endpoints": number, // Total endpoint count "schemas": number, // Total schema count "tags": number, // Total tag count "openapi_version": string // OpenAPI spec version }

Examples:

  • Use when: "Tell me about this API" -> params with spec_name=""

  • Use when: "What's the base URL for this API?" -> params with spec_name=""

Error Handling:

  • Returns error if the spec name has not been loaded

Inputs: spec_name (required).

swagger_get_schemaGet Schema DetailsA
Read-onlyIdempotent

Get detailed information about a specific component schema (data model), including all properties, types, constraints, and examples.

Use this tool to drill down into a specific data model after using swagger_list_schemas.

Args:

  • spec_name (string): Name of the previously loaded spec

  • schema_name (string): Name of the schema/model (e.g., "Pet", "User", "Order", "Error")

Returns: Formatted output with the full schema definition including type, properties, required fields, enums, constraints, and examples.

Examples:

  • Use when: "Show me the Pet model" -> params with spec_name="", schema_name="Pet"

  • Use when: "What fields does the User schema have?" -> params with spec_name="", schema_name="User"

Error Handling:

  • Returns error if the spec name has not been loaded

  • Returns error if the schema name is not found, suggesting available schemas

Inputs: spec_name (required), schema_name (required).

swagger_list_loadedList Loaded SpecsA
Read-onlyIdempotent

List all currently loaded OpenAPI/Swagger specifications in memory.

Use this tool to see which specs have been loaded and are available for exploration.

Args: None

Returns: { "loaded": [ // Array of loaded specs { "name": string, "title": string, "version": string, "source": string, "loaded_at": string } ] }

Examples:

  • Use when: "What specs have I loaded?" -> no params needed

  • Use when: "Show my loaded APIs" -> no params needed

Inputs: no named parameters.

swagger_list_pathsList API EndpointsA
Read-onlyIdempotent

List all API endpoints (paths and HTTP methods) from a loaded OpenAPI spec, optionally filtered by tag.

Use this tool to get a high-level overview of all available API operations. Results can be filtered by tag for progressive exploration.

Args:

  • spec_name (string): Name of the previously loaded spec

  • tag (string, optional): Filter endpoints by this tag/group name

  • limit (number): Maximum results to return, between 1-200 (default: 50)

  • offset (number): Number of results to skip for pagination (default: 0)

Returns: { "total": number, // Total number of matching endpoints "count": number, // Number of results in this response "offset": number, // Current pagination offset "endpoints": [...], "has_more": boolean, "next_offset": number }

Examples:

  • Use when: "Show me all endpoints" -> params with spec_name=""

  • Use when: "List all user-related endpoints" -> params with spec_name="", tag="users"

Error Handling:

  • Returns error if the spec name has not been loaded yet

Inputs: spec_name (required), tag, limit, offset.

swagger_list_schemasList Component SchemasA
Read-onlyIdempotent

List all component schemas (data models) defined in the loaded OpenAPI spec.

Use this tool to get an overview of all data models used by the API, including their types and number of properties.

Args:

  • spec_name (string): Name of the previously loaded spec

  • limit (number): Maximum results to return (default: 50)

  • offset (number): Number of results to skip (default: 0)

Returns: { "total": number, // Total number of schemas "count": number, // Number of results in this response "offset": number, // Current pagination offset "schemas": [{ "name", "type", "description", "properties" }], "has_more": boolean, "next_offset": number }

Examples:

  • Use when: "What data models are defined?" -> params with spec_name=""

  • Use when: "Show me all schemas" -> params with spec_name=""

Error Handling:

  • Returns error if the spec name has not been loaded yet

Inputs: spec_name (required), limit, offset.

swagger_list_tagsList API TagsA
Read-onlyIdempotent

List all API tags/groups and their associated endpoint counts from a loaded OpenAPI spec.

Tags are used to group related endpoints. This tool helps with progressive exploration by showing available filter categories.

Args:

  • spec_name (string): Name of the previously loaded spec

Returns: { "tags": [{ "name": string, "count": number }] }

Examples:

  • Use when: "What tags/groups are available?" -> params with spec_name=""

  • Use when: "How are the endpoints organized?" -> params with spec_name=""

Error Handling:

  • Returns error if the spec name has not been loaded

Inputs: spec_name (required).

swagger_load_local_specLoad Local Swagger/OpenAPI Spec FileA
Read-only

Load and parse an OpenAPI (Swagger) specification document from a local JSON file.

This tool reads a JSON OpenAPI/Swagger spec from a local file path and stores it in memory for subsequent exploration. The file path can be absolute or relative to the current working directory.

Each loaded spec is assigned a unique name (title + version). If a spec with the same name already exists, a numeric suffix is appended.

Args:

  • file_path (string): Path to a local OpenAPI/Swagger JSON file (e.g., "./swagger.doc.json" or "/path/to/api-spec.json")

Returns: { "spec_name": string, // The assigned spec name for subsequent tools "title": string, // API title from the spec "version": string, // API version from the spec "description": string, // API description (if available) "endpoints": number, // Total number of API endpoints found "schemas": number, // Total number of schemas/components found "tags": number, // Total number of unique tags found "server_url": string // Base server URL from the spec }

Examples:

  • Use when: "Load the local swagger.doc.json" -> params with file_path="./swagger.doc.json"

  • Use when: "Load our API spec from disk" -> params with file_path="/home/user/projects/api/openapi.json"

Error Handling:

  • Returns error if the file path does not exist

  • Returns error if the file is not valid JSON

  • Returns error if the JSON is not a valid OpenAPI/Swagger spec

Inputs: file_path (required).

swagger_load_specLoad Swagger/OpenAPI SpecA
Read-only

Load and parse an OpenAPI (Swagger) specification document from a URL.

This tool fetches a JSON OpenAPI/Swagger spec from the given URL and stores it in memory for subsequent exploration. You must load a spec before using any other tools.

Each loaded spec is assigned a unique name (title + version). If a spec with the same name already exists, a numeric suffix is appended.

Args:

  • url (string): URL to the OpenAPI/Swagger JSON spec (e.g., "https://petstore.swagger.io/v2/swagger.json")

  • auth_header (string, optional): Authorization header value for protected specs (e.g., "Bearer token123" or "Basic base64encoded"). Only needed for authenticated endpoints.

Returns: { "spec_name": string, // The assigned spec name for subsequent tools "title": string, // API title from the spec "version": string, // API version from the spec "description": string, // API description (if available) "endpoints": number, // Total number of API endpoints found "schemas": number, // Total number of schemas/components found "tags": number, // Total number of unique tags found "server_url": string // Base server URL from the spec }

Examples:

Error Handling:

  • Returns error if URL is unreachable or times out

  • Returns error if the document is not valid OpenAPI/Swagger JSON

  • Returns error if YAML format is provided (only JSON is supported)

Inputs: url (required), auth_header.

swagger_remove_specRemove Loaded SpecA
Destructive

Remove a loaded OpenAPI/Swagger specification from memory.

Use this tool to free up memory or reload a spec that has changed.

Args:

  • spec_name (string): Name of the spec to remove

Returns: Confirmation message.

Examples:

  • Use when: "Remove the Petstore API spec" -> params with spec_name="Petstore v1.0.0"

  • Use when: "Unload the internal API spec" -> params with spec_name="Internal API v2.0"

Error Handling:

  • Returns error if the spec name is not found

Inputs: spec_name (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: loading (URL vs local file), managing loaded specs, listing tags/paths/schemas, getting details, and searching. The two endpoint-detail tools differ explicitly in whether schema references are resolved, and their descriptions make this clear.

    Naming Consistency5/5

    All tools follow a consistent snake_case pattern with the 'swagger_' prefix and a verb-object structure (load_spec, list_tags, get_endpoint, etc.). Exceptions like load_local_spec and get_endpoint_full are systematic and readable.

    Tool Count5/5

    12 tools is well-scoped for a Swagger/OpenAPI explorer. The count covers the full exploration lifecycle—loading, listing, retrieving, searching, and managing specs—without unnecessary bloat or missing essentials.

    Completeness5/5

    The tool surface is complete for the stated exploration purpose. It supports loading (URL + local), inspecting info/tags/paths/schemas, drilling into endpoints (with optional full $ref resolution), searching, and removing specs. No obvious dead ends or missing operations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Discovers, inspects, and executes requests against OpenAPI or Swagger APIs directly from documentation URLs or specification files. It enables users to trace parameter usage across an API and perform authenticated HTTP requests through a structured toolset.
      8
      15 npm
      5
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Exposes Swagger/OpenAPI API documentation to AI models, enabling exploration, search, and interaction with endpoints, schemas, and execution of API calls.
      14
      20 npm
      2
      MIT