GitHub - kadykov/mcp-openapi-schema-explorer: MCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration. (original) (raw)

MCP OpenAPI Schema Explorer Logo

MCP OpenAPI Schema Explorer

npm version NPM Downloads Docker Pulls License: MIT codecov Verified on MseeP

An MCP (Model Context Protocol) server that provides token-efficient access to OpenAPI (v3.0) and Swagger (v2.0) specifications via MCP Resources.

Project Goal

The primary goal of this project is to allow MCP clients (like Cline or Claude Desktop) to explore the structure and details of large OpenAPI specifications without needing to load the entire file into an LLM's context window. It achieves this by exposing parts of the specification through MCP Resources, which are well-suited for read-only data exploration.

This server supports loading specifications from both local file paths and remote HTTP/HTTPS URLs. Swagger v2.0 specifications are automatically converted to OpenAPI v3.0 upon loading.

Why MCP Resources?

The Model Context Protocol defines both Resources and Tools.

While other MCP servers exist that provide access to OpenAPI specs via Tools, this project specifically focuses on providing access via Resources. This makes it particularly useful for direct exploration within MCP client applications.

For more details on MCP clients and their capabilities, see the MCP Client Documentation.

Installation

For the recommended usage methods (npx and Docker, described below), no separate installation step is required. Your MCP client will download the package or pull the Docker image automatically based on the configuration you provide.

However, if you prefer or need to install the server explicitly, you have two options:

  1. Global Installation: You can install the package globally using npm:
    npm install -g mcp-openapi-schema-explorer
    See Method 3 below for how to configure your MCP client to use a globally installed server.
  2. Local Development/Installation: You can clone the repository and build it locally:
    git clone https://github.com/kadykov/mcp-openapi-schema-explorer.git
    cd mcp-openapi-schema-explorer
    npm install
    npm run build
    See Method 4 below for how to configure your MCP client to run the server from your local build using node.

Adding the Server to your MCP Client

This server is designed to be run by MCP clients (like Claude Desktop, Windsurf, Cline, etc.). To use it, you add a configuration entry to your client's settings file (often a JSON file). This entry tells the client how to execute the server process (e.g., using npx, docker, or node). The server itself doesn't require separate configuration beyond the command-line arguments specified in the client settings entry.

Below are the common methods for adding the server entry to your client's configuration.

Using npx is recommended as it avoids global/local installation and ensures the client uses the latest published version.

Example Client Configuration Entry (npx Method):

Add the following JSON object to the mcpServers section of your MCP client's configuration file. This entry instructs the client on how to run the server using npx:

{ "mcpServers": { "My API Spec (npx)": { "command": "npx", "args": [ "-y", "mcp-openapi-schema-explorer@latest", "", "--output-format", "yaml" ], "env": {} } } }

Configuration Notes:

Method 2: Docker

You can instruct your MCP client to run the server using the official Docker image: kadykov/mcp-openapi-schema-explorer.

Example Client Configuration Entries (Docker Method):

Add one of the following JSON objects to the mcpServers section of your MCP client's configuration file. These entries instruct the client on how to run the server using docker run:

Method 3: Global Installation (Less Common)

If you have installed the package globally using npm install -g, you can configure your client to run it directly.

Run this command once in your terminal

npm install -g mcp-openapi-schema-explorer

Example Client Configuration Entry (Global Install Method):

Add the following entry to your MCP client's configuration file. This assumes the mcp-openapi-schema-explorer command is accessible in the client's execution environment PATH.

{ "mcpServers": { "My API Spec (Global)": { "command": "mcp-openapi-schema-explorer", "args": ["", "--output-format", "yaml"], "env": {} } } }

Method 4: Local Development/Installation

This method is useful if you have cloned the repository locally for development or to run a modified version.

Setup Steps (Run once in your terminal):

  1. Clone the repository: git clone https://github.com/kadykov/mcp-openapi-schema-explorer.git
  2. Navigate into the directory: cd mcp-openapi-schema-explorer
  3. Install dependencies: npm install
  4. Build the project: npm run build (or just build)

Example Client Configuration Entry (Local Development Method):

Add the following entry to your MCP client's configuration file. This instructs the client to run the locally built server using node.

{ "mcpServers": { "My API Spec (Local Dev)": { "command": "node", "args": [ "/full/path/to/cloned/mcp-openapi-schema-explorer/dist/src/index.js", "", "--output-format", "yaml" ],

  "env": {}
}

} }

Important: Replace /full/path/to/cloned/mcp-openapi-schema-explorer/dist/src/index.js with the correct absolute path to the built index.js file in your cloned repository.

Features

Available MCP Resources

This server exposes the following MCP resource templates for exploring the OpenAPI specification.

Understanding Multi-Value Parameters (*)

Some resource templates include parameters ending with an asterisk (*), like {method*} or {name*}. This indicates that the parameter accepts multiple comma-separated values. For example, to request details for both the GET and POST methods of a path, you would use a URI like openapi://paths/users/get,post. This allows fetching details for multiple items in a single request.

Resource Templates:

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for guidelines on setting up the development environment, running tests, and submitting changes.

Releases

This project uses semantic-release for automated version management and package publishing based on Conventional Commits.

Future Plans

(Future plans to be determined)