Swagger MCP 服务器
Overview
Swagger MCP Server is a server based on the Model Context Protocol (MCP) that parses Swagger/OpenAPI documents and generates TypeScript types and API client code.
To use the Swagger MCP Server, install the dependencies using npm or pnpm, start the server, and then use the provided MCP tools to parse Swagger documents or generate TypeScript types and API clients.
- Parses Swagger/OpenAPI documents supporting v2 and v3 specifications. - Generates TypeScript type definitions. - Generates API client code for various frameworks (Axios, Fetch, React Query, etc.). - Optimized handling of large documents with caching and lazy loading strategies.
- Parsing complex Swagger/OpenAPI documents to extract API information.
- Generating TypeScript types for better type safety in applications.
- Creating API clients for different frameworks to simplify API interactions.
Add to your AI client
Use these steps to connect Swagger MCP 服务器 in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"swagger-mcp-server-tuskermanshu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-swagger-mcp-server-tuskermanshu"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"swagger-mcp-server-tuskermanshu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-swagger-mcp-server-tuskermanshu"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"swagger-mcp-server-tuskermanshu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-swagger-mcp-server-tuskermanshu"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"swagger-mcp-server-tuskermanshu": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-swagger-mcp-server-tuskermanshu"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"swagger-mcp-server-tuskermanshu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-swagger-mcp-server-tuskermanshu"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"swagger-mcp-server-tuskermanshu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-swagger-mcp-server-tuskermanshu"
]
}
}
}FAQ
Can Swagger MCP Server handle large API documents?
Yes! It includes optimizations for handling large documents efficiently.
Is there a way to customize the server settings?
Yes! You can customize settings in the `swagger-mcp-config.json` file.
How do I clear the API document cache?
You can delete the `.api-cache` directory or set the `useCache: false` parameter.