yapi-mcp
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 Get request/response schemas from https://yapi.example.com/project/123/interface/api/456"
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
从粘贴的 YApi 项目地址拉取接口文档(JSON 请求 / JSON 响应),供编码 Agent 自动理解并对接客户端项目的 MCP Server。
功能
解析 YApi 页面 URL →
base_url/project_id/interface_id列出 / 搜索接口,导出目录
拉取归一化后的请求与响应 JSON(JSON Schema / 示例)
鉴权:登录 JWT(Cookie
_yapi_token+_yapi_uid)或项目 open token动态凭证:环境变量、
.env、.yapi-mcp.json、运行时yapi_configure、或工具参数
Related MCP server: YApi MCP Server
快速接入
Cursor / Claude Desktop MCP
{
"mcpServers": {
"yapi": {
"command": "uvx",
"args": ["--from", "contextdong-yapi-mcp", "yapi-mcp"],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_TOKEN": "YOUR_LOGIN_JWT_OR_PROJECT_OPEN_TOKEN"
}
}
}
}从 Git 安装(不经 PyPI):
{
"mcpServers": {
"yapi": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/ContextDong/Yapi-Mcp",
"yapi-mcp"
],
"env": {
"YAPI_BASE_URL": "https://yapi.example.com",
"YAPI_TOKEN": "YOUR_TOKEN"
}
}
}
}或使用 pip:
pip install contextdong-yapi-mcp
# 或: pip install git+https://github.com/ContextDong/Yapi-Mcp配置凭证(仓库内不存放密钥)
优先级从高到低:
工具参数(
token、base_url)运行时
yapi_configure(仅当前 MCP 进程内存)环境变量 /
.env(YAPI_BASE_URL、YAPI_TOKEN、YAPI_UID、YAPI_COOKIE)配置文件
.yapi-mcp.json,或YAPI_MCP_CONFIG指向的路径
示例:
cp .env.example .env
cp .yapi-mcp.example.json .yapi-mcp.json变量 | 说明 |
| YApi 主机,如 |
| 登录 JWT 或 项目 open token |
| 可选;登录 JWT 一般会自动解析 |
| 可选;原始 Cookie 头覆盖 |
| 可选;JSON 配置文件路径 |
切勿提交 .env、.yapi-mcp.json 或真实 token。
工具列表
工具 | 用途 |
| 动态配置 / 查看非敏感配置 |
| 从页面 URL 解析主机与 id |
| 项目元信息 |
| 可搜索的接口索引 |
| 单个接口完整 JSON 定义(便于写客户端) |
| 导出目录(可选详情) |
Agent 用法
在对话中粘贴项目地址:
根据 https://yapi.example.com/project/123/interface/api/ 对接登录相关接口Agent 应先配置凭证(如需要),再列表 / 拉详情,最后按目标工程现有风格实现客户端。
可选 Skill:.cursor/skills/yapi-api-client/SKILL.md
本地开发
python -m pip install -e ".[dev]"
python -m pytest
python -m yapi_mcp.serverMCP Registry
官方名:
io.github.ContextDong/yapi-mcpPyPI 包:
contextdong-yapi-mcp(uvx/ 命令yapi-mcp)说明:短名
yapi-mcp在 PyPI 上已被其他项目占用
License
MIT
Available Tools
7 toolsyapi_configureA
Set runtime connection settings for this MCP session (overrides env/file).
Prefer env vars or .yapi-mcp.json for durable config. Use this when the user
pastes host/token in chat. Never echo the raw token back.
Inputs: uid, token, cookie, timeout, +2 more. Returns: result
yapi_export_catalogB
Export a project API catalog for agent understanding / client scaffolding.
By default returns an index (method/path/title). Set include_details=true to also pull normalized request/response bodies (capped by limit).
Inputs: url, limit, token, base_url, +2 more. Returns: result
yapi_get_configA
Show non-secret connection settings currently in effect.
Inputs: no named parameters. Returns: result
yapi_get_interfaceA
Get one interface's full JSON request/response definition for client codegen.
Prefer interface_id from yapi_list_interfaces, or a detail URL: https://yapi.example.com/project/123/interface/api/456
Inputs: url, token, base_url, interface_id. Returns: result
yapi_get_projectC
Get YApi project metadata (name, basepath, desc).
Inputs: url, token, base_url, project_id. Returns: result
yapi_list_interfacesB
List interfaces under a YApi project (from list_menu), with optional filters.
Pass a browser URL like https://yapi.example.com/project/123/interface/api/ or set project_id + base_url. Credentials via env / config / token arg.
Inputs: url, path, token, method, +3 more. Returns: result
yapi_parse_urlA
Parse a YApi page URL into base_url, project_id, and optional interface_id.
Example: https://yapi.example.com/project/123/interface/api/
Inputs: url (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Most tools target distinct actions: configure vs get_config are cleanly separated by direction, and parse_url is a focused utility. The only soft overlap is yapi_export_catalog with include_details=true, which can approximate the combined output of yapi_list_interfaces and yapi_get_interface, though the index-first default keeps them reasonably distinct.
Every tool uses the yapi_ prefix followed by a verb_noun form (get_config, parse_url, get_project, list_interfaces, get_interface, export_catalog), all in snake_case. No mixing of conventions.
Seven tools is well-scoped for a read-focused YApi client: two config tools, one URL helper, three resource reads, and one export. Each earns its place with no filler.
The read surface covers project metadata, interface listing, single-interface detail, and bulk catalog export, which fits the codegen/agent-understanding purpose. Gaps remain: there is no list_projects or interface search, so an agent starting from just a host must rely on parse_url or a known project_id, and no write/update operations exist.
Maintenance
Related MCP Connectors
Web search and page reading for AI agents, including JSON APIs, RSS feeds and YouTube.
Any URL to clean markdown/JSON; PDF, XLSX, CSV, DOCX to text and tables. Free tier for agents.
Project memory, documentation and controlled secret access for AI coding agents.
Serves your design system and coding standards to coding agents, so they stop guessing.
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.6 npmMIT
- 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.27 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.21MIT
- AlicenseCqualityDmaintenanceEnables AI assistants to manage YAPI API documentation by providing tools to create, update, and retrieve interface details. It also supports running automated tests and managing API data across multiple configured projects.11MIT