swagger-mcp-server-z
v1.0.1
Published
An MCP server built on project Swagger docs, used in Cursor to **query API definitions and parameters** so agents and developers can quickly inspect endpoint descriptions, parameters, and response structure overviews.
Downloads
375
Readme
swagger-mcp-server-z
An MCP server built on project Swagger docs, used in Cursor to query API definitions and parameters so agents and developers can quickly inspect endpoint descriptions, parameters, and response structure overviews.
1. Install Dependencies
Run in the project root:
cd .cursor/swagger-mcp-server-z && npm install2. Configure MCP in Cursor (CLI Arguments)
Add the following to .cursor/mcp.json (the server key can be adjusted to your team convention, for example swagger or swagger-mcp-server-z), and pass Swagger URLs and auth info via CLI arguments:
{
"mcpServers": {
"swagger-mcp-server-z": {
"command": "npx",
"args": [
"-y",
"swagger-mcp-server-z",
"--swaggerUrls=https://api.example.com/api/doc/swagger.json,https://api2.example.com/api/doc/swagger.json",
"--swaggerUser=demo_user",
"--swaggerPassword=demo_password"
],
"env": {}
}
}
}The paths and credentials above are placeholders. Replace them with real values from your own Swagger environment, and avoid committing sensitive data (username/password/cookie) to the repository.
2.1 Supported CLI Arguments
--swaggerUrls(required): Comma-separated list of Swagger JSON URLs- Example:
--swaggerUrls=https://a/swagger.json,https://b/swagger.json
- Example:
--swaggerUser(required): Swagger login username--swaggerPassword(required): Swagger login password--swaggerCookie(optional): Fullcookiestring if you want to reuse an existing login session
Alias compatibility (choose any one in each group):
swaggerUrlscan also beswaggerUrl/urlsswaggerPasswordcan also beswaggerPass/passwordswaggerCookiecan also becookieswaggerUsercan also beuser
After updating, in Cursor:
- Settings → Features → MCP → ensure
swagger-mcp-server-zis enabled - Reload Window if needed
4. Tools Provided
4.1 swagger_list_operations
- Description: Lists endpoint definitions from Swagger docs, with optional filters by path/method/tag/summary. Useful for quickly seeing what APIs are available and their brief descriptions.
- Input parameters:
path_contains(optional): Filter by path substring, e.g.running_task.method(optional):GET/POST/PUT/DELETE/PATCH/OPTIONS/HEAD.tag(optional): Filter by Swagger tag.summary_contains(optional): Filter by keyword in summary/description.force_refresh(optional, boolean): Whether to force refetch Swagger JSON.
- Output: A list of operations, each including:
pathmethodoperationIdsummarydescriptiontags
4.2 swagger_get_operation
- Description: Queries a single operation in detail by
path + methodoroperationId, including parameter list and response structure overview. - Input parameters (choose one mode):
- By
operationId:operationId: operationId defined in Swagger;
- By
path + method:path: e.g./running_task;method:GET/POST/PUT/DELETE/PATCH/OPTIONS/HEAD;
- Common:
force_refresh(optional, boolean): Whether to force refetch Swagger JSON.
- By
- Output:
pathmethodoperationIdsummarydescriptiontagsparameters: array containing:namein(query/path/header/body, etc.)requireddescriptiontypeschemaRef(if it is a$ref)
responses: organized by HTTP status code, containing:descriptionschemaReftype
5. Typical Usage
- Browse all
running_task-related APIs:- Call
swagger_list_operationswith:{ "path_contains": "running_task" }
- Call
- Inspect API parameters by operationId:
- Call
swagger_get_operationwith:{ "operationId": "RunningTask_List" }
- Call
- Inspect by path + method:
- Call
swagger_get_operationwith:{ "path": "/running_task", "method": "GET" }
- Call
