YAPI MCP Server

YAPI MCP Server

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.

Category
访问服务器

README

YAPI MCP Server

一个用于 YAPI 接口管理平台的 MCP (Model Context Protocol) 服务器,支持查询项目、接口列表、接口分类、接口详情,以及新增和修改接口等功能。

功能特性

  • 🔍 项目查询 - 获取项目信息和项目列表
  • 📂 分类管理 - 查询接口分类、新增分类
  • 📋 接口管理 - 查询接口列表、接口详情、新增接口、修改接口
  • 🔐 Cookie 认证 - 通过邮箱密码登录自动获取认证

安装

# 克隆项目
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": "your-email@example.com",
  "password": "your-password"
}

方式二:环境变量

环境变量 说明 必填
YAPI_BASE_URL YAPI 服务器地址
YAPI_EMAIL 登录邮箱
YAPI_PASSWORD 登录密码

使用方式

在 Claude Desktop 中使用

编辑 Claude Desktop 配置文件:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %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": "your-email@example.com",
        "YAPI_PASSWORD": "your-password"
      }
    }
  }
}

重启 Claude Desktop 即可使用。

在其他 MCP 客户端中使用

如 Cursor、Windsurf、Cline 等,参考各客户端的 MCP 配置方式:

  • 命令: node /path/to/yapi-interface-mcp/dist/index.js
  • 环境变量: 配置 YAPI_BASE_URL 和认证信息

使用 MCP Inspector 测试

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

工具参数说明

yapi-get-project

projectId: number - 项目ID

yapi-get-categories

projectId: number - 项目ID

yapi-get-interfaces-by-category

catid: number - 分类ID

yapi-get-interfaces

projectId: number - 项目ID

yapi-get-interface

id: string - 接口ID(数字格式)

yapi-create-interface

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

yapi-update-interface

id: number - 接口ID
...其他参数同 yapi-create-interface(均为可选)

yapi-create-category

name: string - 分类名称
project_id: number - 项目ID
desc?: string - 分类描述

开发

# 安装依赖
npm install

# 开发模式(监听文件变化)
npm run dev

# 构建
npm run build

# 运行
npm start

注意事项

  1. 安全性 - 配置文件 yapi-interface-mcp.config.json 包含敏感信息,请勿提交到版本控制系统。已添加到 .gitignore
  2. 网络访问 - 确保 MCP 服务器能够访问 YAPI 服务器。

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选