
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
yapi-mcp-light
Advanced tools
YApi MCP Light - Model Context Protocol server for YApi integration, enables AI tools like Cursor to interact with YApi API documentation
一个用于 YApi 的 Model Context Protocol (MCP) 服务器,让你能够在 Cursor 等 AI 编程工具中直接操作 YApi 接口文档。
本项目代码基于以下开源项目:
感谢原作者!
Yapi MCP Light 是一个基于 Model Context Protocol 的服务器,专为 YApi 接口管理平台设计。它允许你在 Cursor、Claude Desktop 等支持 MCP 的 AI 工具中直接:
通过 MCP 协议,AI 助手可以理解你的 YApi 接口结构,在编程过程中提供更准确的建议和代码生成。
它是基于 [cross-request-master] 设计的轻量简单版本,只保留核心Yapi MCP能力,简化了工具配置和使用流程,即配即用,无需额外初始化操作。
/api/project/get)/api/project/search)yapi_update_token(true)尝试强制刷新)仅yapi-toolset=full可用:
/api/interface/get)/api/interface/list)/api/interface/list_cat)/api/interface/list_menu)/api/interface/getCatMenu)仅yapi-toolset=full可用:
req_params / req_query / req_headers / req_body_* / res_body,desc 只写一句话简介;更新接口时未提供的字段会尽量保留原值/api/interface/add_cat)/api/interface/add)/api/interface/up)/api/interface/save)/api/open/import_data)你可以选择两种模式:
{
"mcpServers": {
"yapi-mcp-light": {
"command": "npx",
"args": [
"-y",
"yapi-mcp-light",
"--stdio",
"--yapi-base-url=https://your-yapi-domain.com",
"--yapi-token=projectId:your_token_here,projectId2:your_yapi_token2_here"
]
}
}
}
{
"mcpServers": {
"yapi-mcp-light": {
"command": "npx",
"args": [
"-y",
"yapi-mcp-light",
"--stdio",
"--yapi-base-url=https://yapi.example.com",
"--yapi-email=your_email",
"--yapi-password=your_password"
]
}
}
}
全局模式下,会把登录态 Cookie 缓存到本地 ~/.yapi-mcp-light/auth-*.json(已尽量使用 0600 权限落盘),请不要提交到仓库或分享给他人。
无需本地安装,通过 npx 直接运行:
{
"mcpServers": {
"yapi-mcp-light": {
"command": "npx",
"args": [
"-y",
"yapi-mcp-light",
"--stdio",
"--yapi-base-url=https://yapi.example.com",
"--yapi-token=projectId:token1,projectId2:token2",
]
}
}
}
在 MCP 配置中定义环境变量:
{
"mcpServers": {
"yapi-mcp-light": {
"command": "npx",
"args": [
"-y",
"yapi-mcp-light",
"--stdio"
],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_TOKEN": "projectId:token1,projectId2:token2"
}
}
}
}
全局模式对应环境变量:
{
"mcpServers": {
"yapi-mcp-light": {
"command": "npx",
"args": ["-y", "yapi-mcp-light", "--stdio"],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_EMAIL": "your_email@example.com",
"YAPI_PASSWORD": "your_password"
}
}
}
}
适合需要修改代码或调试的场景:
git clone <repository-url>
cd yapi-mcp-light
pnpm install
.env 文件):# YApi 基础配置
YAPI_BASE_URL=https://your-yapi-domain.com
YAPI_TOKEN=projectId:your_token_here,projectId2:your_token2_here
# 服务器配置
PORT=3388
# 可选配置
YAPI_LOG_LEVEL=info
YAPI_HTTP_TIMEOUT_MS=15000
SSE 模式(HTTP 服务):
pnpm run dev
然后在 Cursor 中配置:
{
"mcpServers": {
"yapi-mcp-light": {
"url": "http://localhost:3388/sse"
}
}
}
Stdio 模式:
pnpm run build
然后在 Cursor 中配置:
{
"mcpServers": {
"yapi-mcp-test": {
"command": "node",
"args": [
"your_repository_dir/dist/index.js",
"--stdio",
"--yapi-base-url=https://yapi.example.com",
"--yapi-email=your_email",
"--yapi-password=your_password"
]
}
}
}
如果你使用的是 全局模式(--yapi-auth-mode=global / YAPI_AUTH_MODE=global),直接配置邮箱和密码,可获取所有项目接口,不需要手动配置项目 token。

Token 格式说明:
projectId:tokenprojectId1:token1,projectId2:token2配置完成后,你可以在 Cursor 中这样使用:

常用操作示例:
搜索接口:
"帮我找一下用户登录相关的接口"
查看接口详情:
"显示用户注册接口的详细信息"
创建新接口:
"帮我创建一个获取用户列表的接口,路径是 /api/users,使用 GET 方法"
更新接口:
"更新用户登录接口,添加验证码参数"
| 参数 | 描述 | 示例 | 默认值 |
|---|---|---|---|
--yapi-base-url | YApi 服务器基础 URL | --yapi-base-url=https://yapi.example.com | - |
--yapi-token | YApi 项目 Token(支持多项目) | --yapi-token=projectId1:token1,projectId1:token2 | - |
--yapi-auth-mode | 鉴权模式:token 或 global | --yapi-auth-mode=global | token |
--yapi-email | 全局模式登录邮箱 | --yapi-email=a@b.com | - |
--yapi-password | 全局模式登录密码 | --yapi-password=****** | - |
--yapi-toolset | 工具集:basic 或 full(包含底层接口封装工具) | --yapi-toolset=basic | basic |
--yapi-log-level | 日志级别 | --yapi-log-level=info | info |
--port | HTTP 服务端口(SSE 模式) | --port=3388 | 3388 |
--stdio | 启用 stdio 模式(MCP 必需) | --stdio | - |
FAQs
YApi MCP Light - Model Context Protocol server for YApi integration, enables AI tools like Cursor to interact with YApi API documentation
We found that yapi-mcp-light demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.