MCP server for reading YApi interface metadata

MCP server for reading YApi interface metadata

yapi-mcp•byxiaozhi666666

A project-agnostic MCP server that pulls structured API metadata from YApi by page URL, interface ID, or project ID.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Fetches a single interface's details by YApi page URL or interface ID, returning method, path, headers, query, path params, body schema, and response schema.
  • •Reads a YApi project's interface directory.
  • •Searches project interfaces by keyword with pagination.
  • •Supports YApi project token authentication and cookie/session authentication.

BEST FOR

  • •Supplying structured YApi endpoint metadata to a coding agent so it can generate services, TypeScript types, models, or API clients.
  • •Looking up a specific YApi interface's request and response structure by its page URL or ID.
  • •Finding relevant endpoints within a project by keyword search.

ABOUT YAPI-MCP

MCP server for reading YApi interface metadata is cataloged as an MCP server attributed to xiaozhi666666. A project-agnostic MCP server that pulls structured API metadata from YApi by page URL, interface ID, or project ID. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for reading YApi interface metadata are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the server return the raw YApi data instead of normalized metadata?

Yes, when includeRaw is set to true the raw YApi data is returned.

Does the server generate services or TypeScript types?

No; it only pulls structured data from YApi, leaving generation of services, types, models, or API clients to your coding agent or project-specific generator.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 87016578c5f3 · 采集于 2026-11-13 09:30:07 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

YApi MCP

中文 · English

用于读取 YApi 接口元数据的 MCP server。你可以通过 YApi 页面 URL、接口 ID 或项目 ID 获取接口路径、请求参数、请求体、响应结构等信息。

它刻意保持项目无关:这个 MCP 只负责从 YApi 拉取结构化数据,至于如何生成 services、TypeScript 类型、model 或 API client,可以交给你的编码 agent 或项目专用生成器完成。

功能

  • 通过 YApi 页面 URL 或接口 ID 获取单个接口详情。
  • 读取 YApi 项目的接口目录。
  • 按关键字分页搜索项目接口。
  • 支持 YApi 项目 token 鉴权和 cookie/session 鉴权。
  • 返回归一化后的请求/响应元数据,也可按需返回原始 YApi 数据。

安装

npm install -g yapi-fetch-mcp

本地开发:

git clone https://github.com/xiaozhi666666/yapi-mcp.git
cd yapi-mcp
npm install
npm run build

配置

如果你的 YApi 支持项目 token,推荐使用:

export YAPI_HOST="https://yapi.example.com"
export YAPI_TOKEN="project-token"

如果你的 YApi 只能通过登录态访问,可以复制浏览器 cookie:

export YAPI_HOST="https://yapi.example.com"
export YAPI_COOKIE="_yapi_token=...; _yapi_uid=..."

工具参数里也可以直接传 host、token 和 cookie。

如何获取长期 Token

YAPI_TOKEN 指的是 YApi 的项目 token,通常是项目级别的长期 token。获取方式一般如下:

  1. 打开对应的 YApi 项目。
  2. 进入项目的 设置、项目设置 或类似页面。
  3. 找到 Token、项目 Token 或 开放接口 Token。
  4. 复制 token,并配置为 YAPI_TOKEN。

配置后,本 MCP 会把它作为 YApi API 的 token 查询参数发送,例如:

/api/interface/get?id=123&token=project-token

注意:这里的 YAPI_TOKEN 不是所有系统里的 accessToken。如果你的 accessToken 可以直接作为 YApi API 的 token 参数使用,就可以填到 YAPI_TOKEN;如果它必须通过 Authorization: Bearer ... 请求头传递,当前版本不会自动处理,请改用 YAPI_COOKIE 或按你的私有化 YApi 鉴权方式扩展代码。

MCP 客户端配置

Codex 项目级配置

如果你使用 Codex,并且希望这个 MCP 只在某个业务项目里生效,可以在该业务项目根目录创建:

.codex/config.toml

写入:

[mcp_servers.yapi]
command = "npx"
args = ["-y", "yapi-fetch-mcp"]

[mcp_servers.yapi.env]
YAPI_HOST = "https://yapi.example.com"
YAPI_TOKEN = "project-token"

然后在 Codex 中打开或重启这个项目。Codex 只有在项目被信任后才会加载项目级 .codex/config.toml。

注意:如果 .codex/config.toml 会提交到 Git,不建议把真实 YAPI_TOKEN 写进去。可以只提交示例配置,或者把真实 token 放到你的个人 ~/.codex/config.toml 中。

推荐用 npx:

{
  "mcpServers": {
    "yapi": {
      "command": "npx",
      "args": ["-y", "yapi-fetch-mcp"],
      "env": {
        "YAPI_HOST": "https://yapi.example.com",
        "YAPI_TOKEN": "project-token"
      }
    }
  }
}

如果已经全局安装,也可以直接使用命令:

{
  "mcpServers": {
    "yapi": {
      "command": "yapi-fetch-mcp",
      "env": {
        "YAPI_HOST": "https://yapi.example.com",
        "YAPI_TOKEN": "project-token"
      }
    }
  }
}

从源码运行:

{
  "mcpServers": {
    "yapi": {
      "command": "node",
      "args": ["/absolute/path/to/yapi-mcp/build/src/index.js"],
      "env": {
        "YAPI_HOST": "https://yapi.example.com",
        "YAPI_TOKEN": "project-token"
      }
    }
  }
}

工具

get_interface

通过 URL 或接口 ID 获取单个接口详情。

{
  "url": "https://yapi.example.com/project/12/interface/api/345"
}
{
  "host": "https://yapi.example.com",
  "interfaceId": 345,
  "token": "project-token"
}

返回字段包括:

  • method
  • path
  • headers
  • query
  • pathParams
  • bodySchema
  • responseSchema
  • 当 includeRaw 为 true 时返回原始 YApi 数据

list_project_interfaces

读取 YApi 项目的接口目录。

{
  "url": "https://yapi.example.com/project/12/interface/api/345"
}

search_project_interfaces

按关键字分页搜索项目接口。

{
  "projectId": 12,
  "keyword": "order",
  "page": 1,
  "limit": 20
}

MCP Registry

仓库已经包含 server.json 和 package.json#mcpName,npm 包发布后可以继续走 MCP Registry 发布流程。

常见发布流程:

npm publish --access public
mcp-publisher login github
mcp-publisher publish

npm 包名:

yapi-fetch-mcp

Registry server name:

io.github.xiaozhi666666/yapi-mcp

说明

当前使用的常见 YApi API:

  • /api/interface/get?id=:interfaceId
  • /api/interface/list_menu?project_id=:projectId
  • /api/interface/list?project_id=:projectId&page=1&limit=20

部分私有化 YApi 可能改造过鉴权方式。如果 token 不可用,可以尝试 YAPI_COOKIE。

License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for reading YApi interface metadata from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/yapi-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools