Yapi Auto MCP Server allows you to interact with YApi API documentation directly through AI programming tools like Cursor that support the Model Context Protocol (MCP). It creates a seamless bridge between your AI coding environment and YApi interface management platform.
The easiest way to use Yapi Auto MCP Server is with npx, which doesn't require any installation:
{
"mcpServers": {
"yapi-auto-mcp": {
"command": "npx",
"args": [
"-y",
"yapi-auto-mcp",
"--stdio",
"--yapi-base-url=https://your-yapi-domain.com",
"--yapi-token=projectId:your_token_here"
]
}
}
}
You can also configure the server using environment variables:
{
"mcpServers": {
"yapi-auto-mcp": {
"command": "npx",
"args": [
"-y",
"yapi-auto-mcp",
"--stdio"
],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_TOKEN": "projectId:token1,projectId2:token2",
"YAPI_CACHE_TTL": "10",
"YAPI_LOG_LEVEL": "info"
}
}
}
}
For developers who need to customize the server:
git clone <repository-url>
cd yapi-mcp
pnpm install
.env
file in the project root with your configuration:YAPI_BASE_URL=https://your-yapi-domain.com
YAPI_TOKEN=projectId:your_token_here,projectId2:your_token2_here
PORT=3388
YAPI_CACHE_TTL=10
YAPI_LOG_LEVEL=info
pnpm run dev
Then configure in Cursor:
{
"mcpServers": {
"yapi-mcp": {
"url": "http://localhost:3388/sse"
}
}
}
Token format:
projectId:token
projectId1:token1,projectId2:token2
Once configured, you can use these commands in your AI tool:
Search interfaces:
"Find all user login related interfaces"
View interface details:
"Show detailed information for the user registration interface"
Create new interface:
"Create a new interface for getting user lists, with path /api/users using GET method"
Update interface:
"Update the user login interface to add a verification code parameter"
Parameter | Description | Example | Default |
---|---|---|---|
--yapi-base-url |
YApi server base URL | --yapi-base-url=https://yapi.example.com |
- |
--yapi-token |
YApi project tokens | --yapi-token=1026:token1,1027:token2 |
- |
--yapi-cache-ttl |
Cache duration (minutes) | --yapi-cache-ttl=10 |
10 |
--yapi-log-level |
Log level | --yapi-log-level=info |
info |
--port |
HTTP service port (SSE mode) | --port=3388 |
3388 |
--stdio |
Enable stdio mode (required for MCP) | --stdio |
- |
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "yapi-mcp" '{"url":"http://localhost:3388/sse"}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"yapi-mcp": {
"url": "http://localhost:3388/sse"
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"yapi-mcp": {
"url": "http://localhost:3388/sse"
}
}
}
3. Restart Claude Desktop for the changes to take effect