YAPI MCP Server
Click on "Deploy 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., "@YAPI MCP ServerGet the full menu of project 42"
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.
YAPI MCP Server
A Model Context Protocol (MCP) server for reading YAPI API documentation. Enables LLM clients (Claude Code, Cursor, etc.) to browse and inspect YAPI project interfaces.
Features
Browse project info, categories, and interfaces
Get full API detail including request/response schemas
Paginated listing with LLM-friendly Markdown output
Token-based authentication via environment variables
Related MCP server: YApi MCP Server
Requirements
Node.js >= 18.0.0
Installation
From npm
npx @zhuxian/yapi-mcp-serverFrom source
git clone <repo-url>
cd yapi-mcp
npm install
npm run buildConfiguration
The server requires three environment variables:
Variable | Description | Example |
| Your YAPI instance URL |
|
| Cookie token for authentication |
|
| Your YAPI user ID |
|
How to get Token and UID: Open browser DevTools -> Application -> Cookies, find
_yapi_tokenand_yapi_uidvalues.
Usage
Claude Code
Option 1: Using CLI command
# Add to current project
claude mcp add yapi -e YAPI_BASE_URL=https://yapi.example.com -e YAPI_TOKEN=your_token -e YAPI_UID=1828 -- npx -y @zhuxian/yapi-mcp-server
# Add globally (available in all projects)
claude mcp add yapi -s user -e YAPI_BASE_URL=https://yapi.example.com -e YAPI_TOKEN=your_token -e YAPI_UID=1828 -- npx -y @zhuxian/yapi-mcp-serverOption 2: Manual configuration
Add to ~/.claude/settings.json:
{
"mcpServers": {
"yapi": {
"command": "npx",
"args": ["-y", "@zhuxian/yapi-mcp-server"],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_TOKEN": "your_token",
"YAPI_UID": "1828"
}
}
}
}Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"yapi": {
"command": "npx",
"args": ["-y", "@zhuxian/yapi-mcp-server"],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_TOKEN": "your_token",
"YAPI_UID": "1828"
}
}
}
}Local Development
YAPI_BASE_URL=https://yapi.example.com YAPI_TOKEN=xxx YAPI_UID=1828 npm run devTools
yapi_get_project
Get project basic information including name, description, base path, and environment configurations.
Parameters:
Name | Type | Required | Description |
| number | Yes | The YAPI project ID |
yapi_get_cat_menu
Get the list of interface categories (folders) for a project.
Parameters:
Name | Type | Required | Description |
| number | Yes | The YAPI project ID |
yapi_list_interfaces
List interfaces in a project with pagination.
Parameters:
Name | Type | Required | Description |
| number | Yes | The YAPI project ID |
| number | No | Page number (default: 1) |
| number | No | Items per page, max 100 (default: 20) |
yapi_list_by_category
List interfaces belonging to a specific category with pagination.
Parameters:
Name | Type | Required | Description |
| number | Yes | Category ID (from |
| number | No | Page number (default: 1) |
| number | No | Items per page, max 100 (default: 20) |
yapi_get_interface
Get complete details of a single API interface including request parameters, headers, body schema, and response schema.
Parameters:
Name | Type | Required | Description |
| number | Yes | The interface ID |
yapi_get_full_menu
Get all interfaces grouped by category. Returns the complete hierarchy for the project.
Note: May return large payloads for projects with many interfaces.
Parameters:
Name | Type | Required | Description |
| number | Yes | The YAPI project ID |
yapi_get_by_url
Parse a YAPI page URL and fetch the corresponding data automatically.
Parameters:
Name | Type | Required | Description |
| string | Yes | Full YAPI page URL |
Supported URL formats:
/project/{id}/interface/api- Project overview/project/{id}/interface/api/{interfaceId}- Interface detail/project/{id}/interface/api/cat_{catId}- Category listing
Typical Workflow
A recommended sequence when exploring a YAPI project:
1. yapi_get_project → Understand the project
2. yapi_get_cat_menu → See category structure
3. yapi_list_by_category → Browse interfaces in a category
4. yapi_get_interface → Get full detail for a specific APIOr simply use yapi_get_by_url with a YAPI page URL.
Scripts
Script | Description |
| Compile with SWC + generate type declarations |
| Watch mode compilation |
| Run the compiled server |
| Run directly with |
| Type check without emitting |
License
MIT
Available Tools
7 toolsyapi_get_by_urlGet YAPI Data by URLA
Parse a YAPI page URL and fetch the corresponding data automatically. Supports project URLs (/project/{id}/interface/api), interface URLs (/project/{id}/interface/api/{interfaceId}), and category URLs (/project/{id}/interface/api/cat_{catId}).
Inputs: url (required).
yapi_get_interfaceGet YAPI Interface DetailA
Get complete details of a single API interface including request parameters (headers, query, body), response body schema, description, and status.
Inputs: interface_id (required).
yapi_get_projectGet YAPI Project InfoB
Get project basic information including name, description, base URL, and environment configurations.
Inputs: project_id (required).
yapi_list_by_categoryList Interfaces by CategoryB
List interfaces belonging to a specific category with pagination.
Inputs: cat_id (required), page, limit.
yapi_list_interfacesList YAPI InterfacesB
List interfaces in a project with pagination. Returns basic info (ID, title, path, method, status) for each interface.
Inputs: project_id (required), page, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: URL parsing, category listing, full hierarchy, single interface details, project info, listing by category, and general listing. No overlap.
All tools follow the pattern 'yapi_<verb>_<noun>', but 'yapi_get_by_url' deviates slightly from the direct resource naming of others (e.g., 'yapi_get_interface'). Overall consistent.
7 tools is well-scoped for a read-only API documentation server, covering project info, categories, full hierarchy, interface details, and multiple listing methods.
The surface covers core read operations; missing search by method/status or interface modification is acceptable for a read-only server. Minor gaps in filtering.
Maintenance
Related MCP Connectors
Read-only HotAPI documentation: search integration guides and inspect OpenAPI operations.
Search Canton Network ecosystem projects, retrieve project details, and list categories.
Access and search Branch's official API documentation directly within any AI agent or client.
Read-only ChinaAPI model catalogue, price snapshot, cost estimates and request recipes.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables reading and searching API documentation from YApi instances, allowing AI models to access interface definitions, project API lists, and search through API endpoints using YApi URLs or project IDs.5 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with YApi API management platform through natural language, allowing automated interface management including creating/updating APIs, managing categories, importing data, and retrieving project information.26 npm9GPL 3.0
- AlicenseCqualityDmaintenanceEnables AI assistants to manage YAPI API documentation by providing tools to create, update, and retrieve interface details. It also supports running automated tests and managing API data across multiple configured projects.118 npmMIT
- AlicenseCqualityDmaintenanceProvides tools for AI assistants to list, search, and get details of YApi interfaces.63 npmISC