YAPI MCP Server

YAPI MCP Server

Enables LLM clients to browse and inspect YAPI API documentation, including project info, categories, interfaces, and full API details with request/response schemas.

Category
访问服务器

README

YAPI MCP Server

中文文档

A Model Context Protocol (MCP) server for reading YAPI API documentation. Enables LLM clients (Claude Code, Cursor, etc.) to browse and inspect YAPI project interfaces.

Features

  • Browse project info, categories, and interfaces
  • Get full API detail including request/response schemas
  • Paginated listing with LLM-friendly Markdown output
  • Token-based authentication via environment variables

Requirements

  • Node.js >= 18.0.0

Installation

From npm

npx @zhuxian/yapi-mcp-server

From source

git clone <repo-url>
cd yapi-mcp
npm install
npm run build

Configuration

The server requires three environment variables:

Variable Description Example
YAPI_BASE_URL Your YAPI instance URL https://yapi.example.com
YAPI_TOKEN Cookie token for authentication eyJhbGciOiJIUzI1NiIs...
YAPI_UID Your YAPI user ID 1828

How to get Token and UID: Open browser DevTools -> Application -> Cookies, find _yapi_token and _yapi_uid values.

Usage

Claude Code

Option 1: Using CLI command

# Add to current project
claude mcp add yapi -e YAPI_BASE_URL=https://yapi.example.com -e YAPI_TOKEN=your_token -e YAPI_UID=1828 -- npx -y @zhuxian/yapi-mcp-server

# Add globally (available in all projects)
claude mcp add yapi -s user -e YAPI_BASE_URL=https://yapi.example.com -e YAPI_TOKEN=your_token -e YAPI_UID=1828 -- npx -y @zhuxian/yapi-mcp-server

Option 2: Manual configuration

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "yapi": {
      "command": "npx",
      "args": ["-y", "@zhuxian/yapi-mcp-server"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "your_token",
        "YAPI_UID": "1828"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "yapi": {
      "command": "npx",
      "args": ["-y", "@zhuxian/yapi-mcp-server"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "your_token",
        "YAPI_UID": "1828"
      }
    }
  }
}

Local Development

YAPI_BASE_URL=https://yapi.example.com YAPI_TOKEN=xxx YAPI_UID=1828 npm run dev

Tools

yapi_get_project

Get project basic information including name, description, base path, and environment configurations.

Parameters:

Name Type Required Description
project_id number Yes The YAPI project ID

yapi_get_cat_menu

Get the list of interface categories (folders) for a project.

Parameters:

Name Type Required Description
project_id number Yes The YAPI project ID

yapi_list_interfaces

List interfaces in a project with pagination.

Parameters:

Name Type Required Description
project_id number Yes The YAPI project ID
page number No Page number (default: 1)
limit number No Items per page, max 100 (default: 20)

yapi_list_by_category

List interfaces belonging to a specific category with pagination.

Parameters:

Name Type Required Description
cat_id number Yes Category ID (from yapi_get_cat_menu)
page number No Page number (default: 1)
limit number No Items per page, max 100 (default: 20)

yapi_get_interface

Get complete details of a single API interface including request parameters, headers, body schema, and response schema.

Parameters:

Name Type Required Description
interface_id number Yes The interface ID

yapi_get_full_menu

Get all interfaces grouped by category. Returns the complete hierarchy for the project.

Note: May return large payloads for projects with many interfaces.

Parameters:

Name Type Required Description
project_id number Yes The YAPI project ID

yapi_get_by_url

Parse a YAPI page URL and fetch the corresponding data automatically.

Parameters:

Name Type Required Description
url string Yes Full YAPI page URL

Supported URL formats:

  • /project/{id}/interface/api - Project overview
  • /project/{id}/interface/api/{interfaceId} - Interface detail
  • /project/{id}/interface/api/cat_{catId} - Category listing

Typical Workflow

A recommended sequence when exploring a YAPI project:

1. yapi_get_project        → Understand the project
2. yapi_get_cat_menu       → See category structure
3. yapi_list_by_category   → Browse interfaces in a category
4. yapi_get_interface      → Get full detail for a specific API

Or simply use yapi_get_by_url with a YAPI page URL.

Scripts

Script Description
npm run build Compile with SWC + generate type declarations
npm run watch Watch mode compilation
npm run start Run the compiled server
npm run dev Run directly with tsx (no build needed)
npm run typecheck Type check without emitting

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选