yapi-mcp-bridge
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., "@yapi-mcp-bridge搜索项目 1922 中路径包含 /order 的接口"
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 Bridge
A YApi Server based on the Model Context Protocol (MCP), allowing MCP-enabled AI clients to query, search, create, and update YApi interfaces.
Features
The following tools are currently available:
Tool | Purpose | Type |
| Get project details | Read-only |
| Get a simplified interface definition, optionally returning the raw full data | Read-only |
| Get project interface categories | Read-only |
| Paginate project interfaces, filterable by status or tag | Read-only |
| Paginate interfaces under a category | Read-only |
| Search interfaces by title, path, or HTTP method | Read-only |
| Create an interface category | Write |
| Create an interface | Write |
| Update an interface | Write |
The Server does not provide delete tools, to prevent AI clients from accidentally performing irreversible operations.
Related MCP server: YApi MCP Server
Install with npm
No need to clone the repository; you can run it directly:
npx -y yapi-mcp-bridgeYou can also install it globally:
npm install -g yapi-mcp-bridge
yapi-mcp-bridgeAfter global installation, you can use the following command to view tool call statistics:
yapi-mcp-statsInstall from source
Requirements
Node.js 18 or higher
A YApi instance that is accessible
A YApi Cookie with access permissions for the corresponding project
Running from source also requires pnpm 10 or higher. On macOS, you can use Homebrew to install Node.js and pnpm:
brew install node pnpmInstall dependencies
After entering the project directory, run:
pnpm installConfigure YApi
Copy the environment variable example:
cp .env.example .envEdit .env:
YAPI_HOST=https://yapi.example.com
YAPI_COOKIE=_yapi_token=xxx;_yapi_uid=xx;Parameter descriptions:
YAPI_HOST: The YApi service address. Only fill in the protocol and domain name; do not include/api.YAPI_COOKIE: The full Cookie string used when accessing YApi.YAPI_LOG_FILE: Optional log file path. The default is~/.yapi-mcp/logs/yapi-mcp.log.
After logging in to YApi, you can open the Network panel in the browser developer tools, select any YApi request, and copy the Cookie from the Request Headers. The Cookie is equivalent to login credentials; do not commit it to Git or share it with others. This project ignores .env by default.
Start the Server
Run in the project root directory:
pnpm startThis is a stdio MCP Server. After starting it directly, there is no ordinary HTTP page and no interactive prompt is printed; it waits for the MCP client to communicate via standard input and output.
After a successful start, the Server outputs similar information through stderr, which does not pollute the stdout used for MCP communication:
[yapi-mcp] server started (stdio), tools=9, log=~/.yapi-mcp/logs/yapi-mcp.logRun the tests:
pnpm testConnect to an MCP client
When using the npm package, add the following configuration to a client that supports stdio MCP Servers:
{
"mcpServers": {
"yapi": {
"command": "npx",
"args": [
"-y",
"yapi-mcp-bridge"
],
"env": {
"YAPI_HOST": "https://yapi.example.com",
"YAPI_COOKIE": "_yapi_token=xxx;_yapi_uid=xx;"
}
}
}
}If starting from source, you can continue using the Node.js absolute path configuration:
{
"command": "node",
"args": ["/absolute/path/to/yapi-mcp-server/src/index.js"],
"env": {
"YAPI_HOST": "https://yapi.example.com",
"YAPI_COOKIE": "_yapi_token=xxx;_yapi_uid=xx;"
}
}After modifying the configuration, restart or reload the MCP client. The client should discover 9 tools prefixed with yapi_.
Usage
After connecting, you can directly use natural language to have the AI client operate YApi.
Query projects and interfaces
获取 YApi 项目 1922 的详情。列出 YApi 项目 1922 的所有接口分类。在 YApi 项目 1922 中搜索路径包含 /order 的接口,并获取匹配接口的常用定义。yapi_get_interface by default only returns the following commonly used information:
Interface ID, title, HTTP method, and path
Interface description
Path, Query, Header, and Body input parameters
Response type and response content
When you need to troubleshoot YApi metadata or get the raw response, you can explicitly request full: true:
获取 YApi 接口 5001 的原始全量数据。Create an interface category
在 YApi 项目 1922 中创建一个名为“订单管理”的接口分类。Create an interface
在 YApi 项目 1922、分类 3001 中创建接口:
标题为“创建订单”,方法为 POST,路径为 /orders,
请求体类型为 JSON,请求示例为 {"productId": 1001, "quantity": 2},
响应示例为 {"id": 9001, "status": "created"}。Required parameters when creating an interface:
Parameter | Description |
| YApi project ID |
| Interface category ID |
| Interface title |
| Interface path starting with |
| HTTP method, e.g. |
requestBody and responseBody need to be passed as strings. If the content is JSON or JSON Schema, it also needs to be serialized into a string first.
Update an interface
把 YApi 接口 5001 的标题修改为“查询订单详情”,状态修改为 done,并添加 order 标签。To update an interface, you only need to provide the interface ID and the fields to modify. Fields that are not provided are not sent to YApi.
Logs and call statistics
The Server writes logs to the following location by default:
~/.yapi-mcp/logs/yapi-mcp.logLogs use the JSON Lines format, with one event per line. For example:
{"timestamp":"2026-08-21T08:00:00.000Z","event":"tool_call","tool":"yapi_get_interface","status":"success","durationMs":128}Tool logs only record the tool name, call status, and elapsed time. They do not record call parameters, interface content, Cookies, or other credentials.
When the number of appended log records exceeds 1000, the Server automatically deletes the oldest 300 records to prevent the log file from growing indefinitely.
View tool call frequency, success count, failure count, and average elapsed time:
# 全局安装
yapi-mcp-stats
# 从源码运行
pnpm statsYou can change the log location via YAPI_LOG_FILE. When using a relative path, it is resolved relative to the Server's startup directory; it is recommended to configure an absolute path in MCP clients.
FAQ
Returns "Please log in" or no permission
Check the following:
Whether
YAPI_COOKIEis complete and has not expired.Whether the user corresponding to the current Cookie has project access or edit permissions.
Whether the MCP Server was restarted after changing the Cookie.
The client cannot find the Server
Confirm that
src/index.jsin the MCP configuration uses an absolute path.Confirm that
commandpoints to an executable Node.js.Run
pnpm testin the project directory to confirm that the dependencies and runtime environment are normal.
Changes to .env have no effect
.env is loaded from the Server's current working directory by default. When starting from the terminal, run pnpm start in the project root directory; when starting from an MCP client, it is recommended to explicitly pass YAPI_HOST and YAPI_COOKIE via the env in the configuration.
Project structure
src/
├── handlers/ # MCP 工具 handler 与 YApi 方法映射
├── tools/ # 工具定义、Zod 输入输出 Schema
├── index.js # stdio Server 入口
├── server.js # McpServer 注册
└── yapi.js # YApi HTTP API 封装
test/ # 单元测试与 MCP 注册测试Security notes
Do not commit
.envor YApi Cookies.Write tools will actually modify YApi data. Confirm the project ID, category ID, and interface ID before executing.
It is recommended to use a YApi account with the smallest possible permission scope.
Default logs are stored in the
.yapi-mcp/logs/directory under the user's home directory and are not written to the npm installation directory.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.6MIT
- 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.259GPL 3.0
- AlicenseNot gradedqualityFmaintenanceEnables direct interaction with YApi API management platforms from AI editors like Cursor and Claude Desktop, providing complete interface lifecycle management including browsing, creating, updating, and deleting API documentation.1522MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for YApi that enables LLMs to manage API interfaces, projects, and categories through natural language, supporting multiple projects and path fuzzy matching.7GPL 3.0
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Official Microsoft MCP Server to query Microsoft Entra data using natural language
GibsonAI MCP server: manage your databases with natural language
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/frontzhm/yapi-mcp-bridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server