loading…
Search for a command to run...
loading…
An MCP server for the YAPI interface management platform that enables users to manage projects, categories, and API interfaces. It supports querying project det
An MCP server for the YAPI interface management platform that enables users to manage projects, categories, and API interfaces. It supports querying project details, listing interfaces, and creating or modifying API documentation through natural language.
一个用于 YAPI 接口管理平台的 MCP (Model Context Protocol) 服务器,支持查询项目、接口列表、接口分类、接口详情,以及新增和修改接口等功能。
# 克隆项目
git clone https://github.com/W-Abel-jia/yapi-interface-mcp.git
cd yapi-interface-mcp
# 安装依赖
npm install
# 构建
npm run build
在项目根目录创建 yapi-interface-mcp.config.json 文件:
{
"baseUrl": "http://your-yapi-server:3000",
"email": "[email protected]",
"password": "your-password"
}
| 环境变量 | 说明 | 必填 |
|---|---|---|
YAPI_BASE_URL |
YAPI 服务器地址 | ✅ |
YAPI_EMAIL |
登录邮箱 | ✅ |
YAPI_PASSWORD |
登录密码 | ✅ |
编辑 Claude Desktop 配置文件:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json添加以下配置:
{
"mcpServers": {
"yapi": {
"command": "node",
"args": ["/path/to/yapi-interface-mcp/dist/index.js"],
"env": {
"YAPI_BASE_URL": "http://your-yapi-server:3000",
"YAPI_EMAIL": "[email protected]",
"YAPI_PASSWORD": "your-password"
}
}
}
}
重启 Claude Desktop 即可使用。
如 Cursor、Windsurf、Cline 等,参考各客户端的 MCP 配置方式:
node /path/to/yapi-interface-mcp/dist/index.jsYAPI_BASE_URL 和认证信息cd yapi-interface-mcp
npx @modelcontextprotocol/inspector node dist/index.js
| 工具名称 | 功能描述 | 必需参数 |
|---|---|---|
yapi-get-project |
获取项目信息 | projectId |
yapi-get-project-list |
获取项目列表 | - |
yapi-get-categories |
获取项目的接口分类列表 | projectId |
yapi-get-interfaces-by-category |
获取指定分类下的接口列表 | catid |
yapi-get-interfaces |
获取项目的所有接口列表 | projectId |
yapi-get-interface |
获取接口详情 | id |
yapi-create-interface |
新增接口 | title, path, method, catid |
yapi-update-interface |
修改接口 | id |
yapi-create-category |
新增分类 | name, project_id |
projectId: number - 项目ID
projectId: number - 项目ID
catid: number - 分类ID
projectId: number - 项目ID
id: string - 接口ID(数字格式)
title: string - 接口标题
path: string - 接口路径,如 /api/user
method: "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "OPTIONS" | "PATCH"
catid: number - 分类ID
desc?: string - 接口描述
status?: "done" | "designing" | "dev" | "undone"
req_body_type?: "form" | "json" | "file" | "raw" | "text"
req_body_other?: string - 请求体 JSON Schema
req_body_form?: Array<{name, type, required, desc}>
req_headers?: Array<{name, value?, required, desc?}>
req_params?: Array<{name, desc?}>
req_query?: Array<{name, required, desc?}>
res_body_type?: "json" | "raw" | "text"
res_body?: string - 响应体 JSON Schema
id: number - 接口ID
...其他参数同 yapi-create-interface(均为可选)
name: string - 分类名称
project_id: number - 项目ID
desc?: string - 分类描述
# 安装依赖
npm install
# 开发模式(监听文件变化)
npm run dev
# 构建
npm run build
# 运行
npm start
yapi-interface-mcp.config.json 包含敏感信息,请勿提交到版本控制系统。已添加到 .gitignore。MIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"yapi-mcp-server": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.