api-mcp-server
Fetches and parses Swagger/OpenAPI documentation from URLs, cleans and optimizes it to reduce token consumption, and provides standardized API descriptions to intelligent IDEs for suggestions, auto-completion, and code generation.
README
api-mcp-server
English | 简体中文
<div align="center"> <h1>API MCP Server</h1> <p>A Swagger/OpenAPI Documentation Retrieval Tool Based on MCP (Model Context Protocol)</p> <br /> </div>
<br/>
This is a Swagger/OpenAPI documentation retrieval tool based on MCP (Model Context Protocol). It can fetch and parse Swagger/OpenAPI documentation from specified URLs, intelligently clean and optimize the documentation to reduce token consumption, and provide it to intelligent IDEs (such as Cursor) in a standardized format. The tool supports multiple transport methods, making it easy for IDEs to retrieve and understand API documentation, enabling intelligent features such as interface suggestions, auto-completion, and code generation.
✨ Features
-
Intelligent Document Processing
- Fetch Swagger/OpenAPI documentation from remote URLs
- Support for Swagger 2.0 and OpenAPI 3.x formats
- Intelligent cleaning and optimization of document structure to reduce token consumption
- Extract key API information including endpoints, parameters, response formats, etc.
-
IDE-Friendly Design
- Standardized API description format
- Automatic generation of example requests and responses
- Intelligent parameter hints and type inference
- Support for code auto-completion and generation
-
Multiple Transport Methods
- stdio: Standard input/output mode for command-line tools
- http: HTTP server mode with RESTful interface support
- sse: Server-Sent Events mode for real-time communication
Getting Started
MacOS / Linux
{
"mcpServers": {
"api-mcp-server": {
"command": "npx",
"args": [
"-y",
"api-mcp-server",
"--transport",
"stdio",
"--doc-url",
"xxx"
]
}
}
}
Windows
{
"mcpServers": {
"api-mcp-server": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"api-mcp-server",
"--transport",
"stdio",
"--doc-url",
"xxx"
]
}
}
}
Command Line Arguments
--transport <stdio|http|sse>: Choose transport method (default: stdio)--port <number>: HTTP/SSE server port (default: 3000)--doc-url <url>: Swagger/OpenAPI documentation URL (required)
Usage Examples
1. Basic Usage
# Using stdio mode (default)
npx -y api-mcp-server --doc-url https://api.example.com/swagger.json
# Using HTTP mode
npx -y api-mcp-server --transport http --doc-url https://api.example.com/swagger.json
# Using SSE mode with custom port
npx -y api-mcp-server --transport sse --port 3001 --doc-url https://api.example.com/swagger.json
💻 Development
# Clone the repository
git clone https://github.com/bluechenchenchen/api-mcp-server.git
# Install dependencies
pnpm install
# Run in development mode
pnpm dev
# Build
pnpm build
Debugging
Use @modelcontextprotocol/inspector
npx @modelcontextprotocol/inspector

Run Example
pnpm example
📋 Requirements
- Node.js >= 16.0.0
- npm >= 6.0.0 or pnpm >= 6.0.0
📄 License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.