Skip to content
MCP Server Directory logo
developer-tools

Openapi Slice Mcp

Reviewed overview

MCP 服务器概览

What is Openapi Slice MCP?

Openapi Slice MCP is an MCP (Model Context Protocol) server that extracts minimal, endpoint-specific slices from large OpenAPI specifications. It is designed to reduce context size when working with LLMs or other tools that cannot load full, large API specs.

How to use Openapi Slice MCP?

  • Run the server in stdio mode (default) for local development and MCP client integration:
    • uvx openapi-slice-mcp
  • Run as an HTTP service for remote access or deployment:
    • uvx openapi-slice-mcp-http (defaults to port 8000)
    • or uvx openapi-slice-mcp --transport http --host 0.0.0.0 --port 8000
    • HTTP MCP endpoint: http://<host>:<port>/mcp
  • Tools (MCP methods) available to clients:
    • load_openapi_spec(file_path: str) — load local YAML/JSON spec files
    • load_openapi_spec_from_url(url: str, timeout: int = 30) — fetch spec from HTTP/HTTPS
    • list_endpoints() — list endpoints in the loaded spec
    • extract_endpoint_slice(path: str, method: str, output_format: str = "yaml") — get minimal spec for an endpoint (YAML or JSON)
    • get_server_status() — check server status

Key features

  • Endpoint-specific extraction: produce minimal OpenAPI specs containing only the requested endpoint and its dependencies
  • Automatic dependency resolution: recursively includes referenced components (schemas, parameters, etc.)
  • Multiple output formats: YAML or JSON
  • Local and remote spec loading: supports loading from local files and fetching specs via HTTP/HTTPS
  • Discovery tools: list available endpoints in a loaded specification
  • MCP protocol support for easy integration with LLM tooling and clients

Use cases

  1. Feeding only relevant API portions to LLMs to stay within context limits
  2. Generating minimal API docs or mocks for a single endpoint
  3. Simplifying contract tests or integration tests by extracting endpoint slices
  4. Inspecting or sharing an endpoint’s spec without exposing the entire API surface
  5. Microservice debugging and security reviews where only a subset of the spec is needed

FAQ

  • Q: Which input formats are supported?

    A: Local OpenAPI files in YAML or JSON and remote specs via HTTP/HTTPS can be loaded.

  • Q: What output formats are supported?

    A: YAML and JSON.

  • Q: How does it handle references and dependencies?

    A: It automatically resolves and includes referenced components (schemas, parameters, etc.) required by the selected endpoint.

  • Q: Is this intended for use with LLMs?

    A: Yes — it was created to reduce spec size so LLMs with limited context can work with only the relevant API slice.

  • Q: How do I run it remotely or integrate it into CI/CD?

    A: Use the HTTP mode (openapi-slice-mcp-http or --transport http) to expose an MCP endpoint (/mcp) suitable for remote integration or deployment.

  • Q: What if my OpenAPI spec uses uncommon features or extensions?

    A: The server handles standard OpenAPI constructs (schemas, parameters, refs). For nonstandard extensions or edge cases, verify compatibility by testing with your spec and consult the project repo for issues or updates.