yapi-mcp-bridge
This server is a YApi MCP bridge that lets AI clients read and modify YApi projects and interfaces through 9 YApi-prefixed tools.
Read project info:
yapi_get_projectreturns project details given its ID.Read interface details:
yapi_get_interfacereturns method, path, description, params, and response; optionallyfull: truefor raw YApi data.List categories:
yapi_list_categoriesgets all interface categories in a project.List interfaces:
yapi_list_interfacespaginates interfaces in a project, with optional status/tag filters.List category interfaces:
yapi_list_category_interfacespaginates interfaces within a specific category.Search interfaces:
yapi_search_interfacesearches by title, path, or HTTP method (case-insensitive).Create category:
yapi_create_categorycreates a new interface category.Create interface:
yapi_create_interfacecreates a full interface with path, method, headers, params, request/response bodies, status, tags, and more.Update interface:
yapi_update_interfacepartially updates an existing interface by ID (no deletion tools are provided).
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-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 PRO
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.
Available Tools
9 toolsyapi_create_categoryA
在项目中创建接口分类
Inputs: name (required), projectId (required), description. Returns: result
yapi_create_interfaceB
创建 YApi 接口,支持请求参数、请求体、响应体、状态和标签
Inputs: path (required), title (required), method (required), projectId (required), +17 more. Returns: result
yapi_get_interfaceARead-only
根据接口 ID 获取方法、路径、描述、入参和出参;可选返回原始全量数据
Inputs: id (required), full. Returns: result
yapi_get_projectARead-only
获取 YApi 项目详情,包括基本路径、环境和成员等信息
Inputs: id (required). Returns: result
yapi_list_categoriesARead-only
获取项目下的接口分类列表
Inputs: projectId (required). Returns: result
yapi_list_category_interfacesARead-only
分页获取指定分类下的接口列表,可按状态或标签筛选
Inputs: categoryId (required), tag, page, limit, +1 more. Returns: result
yapi_list_interfacesBRead-only
分页获取项目下的接口列表,可按状态或标签筛选
Inputs: projectId (required), tag, page, limit, +1 more. Returns: result
yapi_search_interfaceARead-only
根据标题、路径或 HTTP 方法搜索项目中的 YApi 接口,不区分大小写
Inputs: keyword (required), projectId (required). Returns: result
yapi_update_interfaceAIdempotent
按接口 ID 更新 YApi 接口;只传需要修改的字段
Inputs: id (required), path, tags, title, +17 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct resource and action: project details, interface retrieval by ID, category listing, interface listing (all or by category), search, and CRUD for categories/interfaces. The overlap between list_interfaces and list_category_interfaces is resolved by clear filtering semantics, so no ambiguity exists.
All tools follow a strict 'yapi_<verb>_<noun>' pattern using snake_case (e.g., yapi_get_project, yapi_create_interface). The verb-noun ordering is uniform, and each name clearly reflects the operation and resource, making the set highly predictable.
With 9 tools, the server is well-scoped for a YApi bridge covering project info, category management, and interface lifecycle. Each tool serves a distinct purpose without redundancy, and the count falls comfortably within the ideal 3-15 range.
The surface covers create, read, and update for interfaces, plus create and list for categories, but lacks delete operations for both interfaces and categories. This is a notable gap for full lifecycle management, though the core workflows (viewing, searching, and editing) are supported.
Maintenance
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
MCP server for AI dialogue using various LLM models via AceDataCloud
Manage Superlist tasks and lists in plain language from any MCP-compatible AI agent.
Related MCP Servers
- 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.30 npm9GPL 3.0
- AlicenseNot gradedqualityDmaintenanceEnables 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.14 npm21MIT
- 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.26 npmGPL 3.0
- AlicenseBqualityFmaintenanceEnables AI tools to search, create, update, and manage YApi API interfaces, projects, and categories through natural language.1221 npm2MIT