Skip to main content
Glama
openapi-tools-mcp

openapi-tools-mcp

by kardaj

OpenAPI Tools MCP and CLI

A Model Context Protocol server powered by fastMCP plus a JSON command-line interface for inspecting local or remote OpenAPI specs. Both interfaces expose the same summary, listing, filtering, retrieval, $ref resolution, and source-line behavior.

The server also publishes MCP metadata (instructions and website_url) to guide clients toward local-file OpenAPI inspection workflows.

Add as an MCP server

Add this server to your MCP client configuration (PyPI):

{
  "mcpServers": {
    "openapi-tools": {
      "command": "uvx",
      "args": [
        "--from",
        "openapi-tools-mcp",
        "openapi-tools-mcp"
      ]
    }
  }
}

This launches the openapi-tools-mcp entrypoint from PyPI via uvx.

TOML version (PyPI):

[mcp_servers.openapi-tools]
command = "uvx"
args = ["--from", "openapi-tools-mcp", "openapi-tools-mcp"]

You can also install directly from GitHub with uvx:

uvx --from git+ssh://git@github.com/kardaj/openapi-tools-mcp.git openapi-tools-mcp

Related MCP server: Swagger MCP

Use the command-line interface

Run the CLI ephemerally from PyPI with uvx --from:

uvx --from openapi-tools-mcp openapi-tools-cli info ./openapi.yaml | jq

For persistent use, install the package as a uv tool and call the dedicated CLI entry point:

uv tool install openapi-tools-mcp
openapi-tools-cli info ./openapi.yaml

Run openapi-tools-cli --help (or -h) for a single help page covering info, list, and get, including supported sections, output shapes, reference and filter behavior, and examples. Each command has its own section; shared source, header, and help arguments appear once. Command-specific help, such as openapi-tools-cli list --help, shows that command's details and examples.

Start with info to confirm the OpenAPI version, API metadata, and server base URLs. Use list to discover names, then get to inspect one item. These commands read specifications without calling API operations. info returns an object with openapi, info, and servers; list paths returns an array of {path, verbs} objects, while other sections return arrays of names. get returns {value, line_start, line_end}; line fields are zero-based source positions, or null when unavailable.

Both list and get support paths, schemas, parameters, responses, requestBodies, headers, securitySchemes, links, callbacks, and examples. list additionally supports tags, which lists tags used by operations; get does not retrieve tags. For get, supply an exact path such as /pet/{petId} or a component name such as Pet.

The CLI accepts local YAML or JSON paths, including paths with ~ and relative segments, and lowercase http:// or https:// URLs:

openapi-tools-cli info ./openapi.yaml
openapi-tools-cli list paths https://example.com/openapi.yaml
openapi-tools-cli get schemas Pet ~/specs/openapi.json

Repeat -H/--header for URL request headers. Header names and values are trimmed, values may contain additional colons, and the last identically spelled header name wins. Headers are rejected for local paths:

openapi-tools-cli info https://example.com/openapi.yaml \
  -H "Authorization: Bearer token" \
  -H "Accept: application/yaml"

list --glob matches path or item names using shell-style wildcards such as *, ?, and [abc]; quote patterns to prevent shell expansion. --tag filters paths by operation tags and schemas by tags/x-tags, and is ignored for other sections. Each occurrence accepts one tag, and repeated tags match any. For paths and schemas, an item must match both filters when --glob and --tag are supplied:

openapi-tools-cli list paths ./openapi.yaml --glob '/pets/*'
openapi-tools-cli list paths ./openapi.yaml --tag pet --tag admin

get resolves local #/... $ref values by default; external references cannot be resolved. Preserve all references, including external ones, with --no-resolve-refs:

openapi-tools-cli get schemas Pet ./openapi.yaml --no-resolve-refs

Successful operations write one newline-terminated JSON value to stdout, so their output can be piped to tools such as jq. Expected source, lookup, download, and parse failures write a concise message to stderr and exit with status 1; command syntax and header usage errors follow argparse conventions and exit with status 2.

Successful CLI URL downloads are cached for 15 minutes in the platform's conventional per-user cache location. Set OPENAPI_TOOLS_CACHE_DIR to use an exact alternative directory, for example OPENAPI_TOOLS_CACHE_DIR=/private/tmp/.cache/openapi-tools-mcp; an empty value leaves the platform default unchanged. Entries are shared across CLI processes and isolated by URL plus the complete normalized header mapping; concurrent requests for the same entry coordinate around one download while unrelated entries remain independent. An expired entry is used as stale fallback when refresh fails because of a network error or HTTP 5XX response, while HTTP 4XX and invalid refreshed content still fail. Cache directories and files are restricted to the invoking user, and cache identities contain only cryptographic digests rather than raw header names or values. The downloaded specification body may still contain sensitive API documentation and may persist in this private cache. Cache permission, corruption, or coordination failures, including an unavailable configured directory, degrade to an uncached request without changing a successful command's output. OPENAPI_TOOLS_CACHE_DIR affects only the CLI disk cache; the MCP server continues to use its process-local in-memory cache.

Available tools

  • spec_info(spec_path): Quickly summarize a spec source (OpenAPI version, title/description, servers). Use this first to confirm you're reading the right spec and its base URLs.

  • spec_list(section, spec_path, filter_by_glob?, filter_by_tag?): Enumerate keys within a spec section (e.g., all paths, schemas, or responses). Use to discover what exists before drilling into details.

  • spec_get(section, name, spec_path, resolve_refs=True): Retrieve a specific item from a section (e.g., one path or schema), with optional $ref resolution and source line numbers for precise navigation.

All tools accept either a readable OpenAPI YAML/JSON file path on the local filesystem or a URL source object. Local paths keep the existing behavior, including ~ expansion and absolute path resolution. An example spec lives at tests/openapi.example.yml.

URL source objects are passed through the existing spec_path argument:

{
  "url": "https://example.com/openapi.yaml",
  "headers": {
    "Authorization": "Bearer token",
    "Accept": "application/yaml"
  }
}

The headers object is optional and defaults to no extra request headers. Only http:// and https:// URLs are supported. Remote YAML and JSON documents are both supported.

Downloaded URL content is cached in memory for 15 minutes per MCP server process. Cache entries are keyed by URL plus the complete headers mapping, independent of header insertion order, so different authentication or content-negotiation inputs do not share responses. When an expired cached entry cannot be refreshed because of a network error or HTTP 5XX response, the stale cached content is used for that request. HTTP 4XX responses and unsupported URL schemes surface an error and do not use stale content. The MCP server does not read or write the CLI disk cache.

License

MIT

Available Tools

3 tools
spec_getSpec GetA

Retrieve a specific item from a local path string or URL source object, with optional $ref resolution and source line numbers. For remote specs, pass spec_path as {"url": "https://example.com/openapi.yaml", "headers": {"Header-Name": "value"}}; headers are optional, only http/https URLs are supported, and successful downloads are cached in memory for 15 minutes with stale fallback on network errors or HTTP 5XX refresh failures.

Inputs: name (required), section (required), spec_path (required), resolve_refs.

spec_infoSpec InfoA

Quickly summarize an OpenAPI spec from a local path string or URL source object. For remote specs, pass {"url": "https://example.com/openapi.yaml", "headers": {"Header-Name": "value"}}; headers are optional, only http/https URLs are supported, and successful downloads are cached in memory for 15 minutes with stale fallback on network errors or HTTP 5XX refresh failures.

Inputs: spec_path (required). Returns: object

spec_listSpec ListA

Enumerate keys within a spec section from a local path string or URL source object. For remote specs, pass spec_path as {"url": "https://example.com/openapi.yaml", "headers": {"Header-Name": "value"}}; headers are optional, only http/https URLs are supported, and successful downloads are cached in memory for 15 minutes with stale fallback on network errors or HTTP 5XX refresh failures.

Inputs: section (required), spec_path (required), filter_by_tag, filter_by_glob.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    spec_info summarizes the whole spec, spec_list enumerates keys within a section, and spec_get retrieves a specific item. These are distinct operations with clear scope boundaries, though info and get could be slightly confused without the descriptions.

    Naming Consistency5/5

    All three tools use a consistent spec_<action> pattern: spec_info, spec_list, spec_get. The naming is predictable and easy to parse.

    Tool Count5/5

    Three tools are well-suited for a lightweight OpenAPI spec inspection server. Each tool earns its place for summary, enumeration, and retrieval without redundancy.

    Completeness4/5

    The set covers core read-only exploration: summarize, list keys, and get items with optional $ref resolution. Minor gaps such as search, validation, or diff operations exist but are not essential for the apparent inspection purpose.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Loads and queries OpenAPI/Swagger documents, providing tools to list APIs, get details, search endpoints, and manage schemas for efficient API exploration.
      4
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables local analysis of OpenAPI 3 and Swagger 2 JSON/YAML spec files on disk, with no remote fetching of specs or credentials. It groups endpoints by tag, flags operations that appear to lack security, lists deprecated operations, and produces short markdown cheat sheets for agents.
      4
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables an assistant to read a local OpenAPI 3.x specification, search operations, retrieve endpoint or schema details, and expose documentation through tools, resources, and prompts.
      4
      MIT