mcp-swagger-reader
Allows reading and parsing Swagger/OpenAPI specifications to explore API endpoints, get endpoint details, manage data models, search APIs, and generate TypeScript types for requests and responses.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-swagger-readerlist all endpoints for the user-service project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Swagger Reader
MCP工具,用于读取和解析Swagger/OpenAPI规范,帮助你快速查看项目接口信息。
功能
支持配置多个项目的Swagger地址(支持URL和本地文件)
获取所有API接口列表
获取指定接口的详细信息
获取数据模型/Schemas
搜索API接口
根据接口路径和方法生成TypeScript类型(请求参数、Body、响应)
Related MCP server: Swagger MCP (Multi-API Edition)
安装
cd mcp-swagger-reader
npm install
npm run buildMCP配置
Cursor/Claude Desktop配置
在 ~/.cursor/mcp.json 或 ~/Library/Application Support/Claude/mcp.json 中添加:
{
"mcpServers": {
"swagger-reader": {
"command": "node",
"args": [
"/Users/momei/code/my_project/mcp-swagger-reader/dist/index.mjs"
],
"env": {}
}
}
}环境变量预置项目
可以通过 SWAGGER_PROJECTS 环境变量预置项目:
{
"mcpServers": {
"swagger-reader": {
"command": "node",
"args": ["/path/to/dist/index.mjs"],
"env": {
"SWAGGER_PROJECTS": "[{\"name\":\"my-api\",\"swaggerUrl\":\"http://example.com/swagger.json\"}]"
}
}
}
}支持多个项目:
"SWAGGER_PROJECTS": "[{\"name\":\"api1\",\"swaggerUrl\":\"http://...\"},{\"name\":\"api2\",\"swaggerUrl\":\"http://...\"}]"数据存储
项目配置保存在 ~/.mcp-swagger-reader/projects.json,重启后自动加载。
工具列表
add_swagger_project
添加一个项目的Swagger配置。
参数:
name: 项目名称swaggerUrl: Swagger/OpenAPI JSON文件的URL地址或本地文件路径
示例:
await add_swagger_project({
name: "my-project",
swaggerUrl: "https://api.example.com/v2/api-docs",
});list_swagger_projects
列出所有已配置的Swagger项目。
get_api_endpoints
获取指定项目的所有API接口列表。
参数:
projectName: 项目名称
get_api_detail
获取指定接口的详细信息。
参数:
projectName: 项目名称path: API路径,如/users/{id}method: HTTP方法,如GET,POST
get_schemas
获取指定项目的所有数据模型/Schemas。
参数:
projectName: 项目名称
search_apis
根据关键词搜索API接口。
参数:
projectName: 项目名称keyword: 搜索关键词
reload_swagger
重新加载项目的Swagger规范。
参数:
projectName: 项目名称
generate_ts_by_endpoint
根据 API 接口路径和方法生成 TypeScript 类型(请求参数、Body、响应)。
参数:
projectName: 项目名称path: API路径,如/access/packageUnit/queryListmethod: HTTP方法,如GET,POST,PUT,DELETE
返回:
T{Endpoint}Params- 请求参数接口T{Endpoint}Response- 响应类型接口
使用示例
首先添加项目配置:
await add_swagger_project({
name: "user-service",
swaggerUrl: "https://petstore.swagger.io/v2/swagger.json",
});查看所有接口:
await get_api_endpoints({ projectName: "user-service" });获取某个接口详情:
await get_api_detail({
projectName: "user-service",
path: "/pet/{petId}",
method: "GET",
});搜索接口:
await search_apis({
projectName: "user-service",
keyword: "user",
});This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/momei-LJM/mcp-swagger-reader'
If you have feedback or need assistance with the MCP directory API, please join our Discord server