Skip to main content
Glama

mcp-yapi-server

npm version License: MIT GitHub stars GitHub forks

基于 Model Context Protocol (MCP) 的 YApi 集成服务器,在 Cursor 等支持 MCP 的编辑器中直接查询 YApi API 文档。

✨ 功能特性

  • 🔗 直接粘贴 URL - 最简单!粘贴 YApi 链接即可查询

  • 🔍 查询接口详情 - 完整的请求/响应参数

  • 📋 列出接口 - 查看项目所有接口

  • 🔎 搜索接口 - 按关键词搜索

  • 🤖 AI 辅助 - 自动生成代码、类型定义等

Related MCP server: YApi MCP Server

📦 安装

npm install -g mcp-yapi-server

或作为项目依赖:

npm install mcp-yapi-server

🚀 快速开始

1. 安装

npm install -g mcp-yapi-server

2. 配置 Cursor

在 Cursor 设置中添加 MCP 服务器配置:

推荐方式 - 本地安装:

# 在项目目录中安装
npm install mcp-yapi-server
{
  "mcpServers": {
    "yapi": {
      "command": "node",
      "args": ["./node_modules/mcp-yapi-server/dist/index.js"],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "your_token_here"
      }
    }
  }
}

或全局安装:

npm install -g mcp-yapi-server
{
  "mcpServers": {
    "yapi": {
      "command": "mcp-yapi-server",
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "your_token_here"
      }
    }
  }
}

⚠️ 注意: 不推荐使用 npx 方式,因为依赖可能无法正确解析。请使用本地安装或全局安装。

3. 重启 Cursor

4. 开始使用

在 Cursor 中直接粘贴 YApi 链接:

https://yapi.example.com/project/100/interface/api/12345

📚 文档

🔧 常见问题

"No server info found"

原因: Node.js 版本 < 18
解决: nvm install 18 && nvm use 18

"请登录..."

原因: 需要配置 Token
解决: 在 Cursor 配置中设置 YAPI_TOKEN

详见 故障排除文档

🛠 开发

# 克隆项目
git clone https://github.com/TStoneLee/mcp-yapi-server.git
cd mcp-yapi-server

# 安装依赖
npm install

# 开发模式
npm run dev

# 构建
npm run build

📄 许可证

MIT License

🔗 相关链接

Available Tools

5 tools
yapi_get_interfaceC

获取YApi接口的详细信息,包括请求参数、响应参数、请求示例等

ParametersJSON Schema
NameRequiredDescriptionDefault
interface_idYesYApi接口ID
tokenNo访问令牌(可选,用于访问私有项目)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral context. It mentions retrieving detailed information but doesn't disclose authentication requirements (token is optional but not explained), rate limits, error conditions, or what format the information returns. The description doesn't contradict annotations since none exist, but provides inadequate behavioral transparency for a tool that likely interacts with an API system.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose. It's appropriately concise without being overly brief. However, it could be slightly more front-loaded by explicitly mentioning it retrieves by ID to distinguish from the URL-based sibling.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 2 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'detailed information' includes beyond listing some components, doesn't mention authentication context despite the token parameter, and provides no guidance on error handling or response format. The description should do more to compensate for the lack of structured metadata.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain interface_id format, token usage scenarios, or provide examples. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '获取YApi接口的详细信息' (get detailed information of a YApi interface) with specific components mentioned (request parameters, response parameters, request examples). It distinguishes from siblings like yapi_list_interfaces (list) and yapi_search_interface (search), but doesn't explicitly differentiate from yapi_get_interface_by_url which likely retrieves by URL instead of ID.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose this over yapi_get_interface_by_url (likely similar functionality with different input) or yapi_search_interface (broader search capability). No context about prerequisites or typical use cases is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

yapi_get_interface_by_urlB

通过YApi接口URL获取详细信息。支持直接粘贴YApi链接,如: https://yapi.example.com/project/100/interface/api/12345

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesYApi接口完整URL,例如: https://yapi.example.com/project/100/interface/api/12345
tokenNo访问令牌(可选,用于访问私有项目)

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the token parameter is '可选' (optional) for accessing private projects, which adds some context about authentication needs. However, it doesn't describe what '详细信息' (detailed information) includes, potential rate limits, error conditions, or whether this is a read-only operation (though '获取' implies reading).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences. The first sentence states the purpose, and the second provides usage guidance with a concrete example. There's no wasted text, and information is front-loaded. It could be slightly more structured by explicitly separating purpose from usage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 2 parameters with full schema coverage but no annotations and no output schema, the description is minimally adequate. It covers the basic purpose and usage but lacks details about what '详细信息' includes in the response, error handling, or behavioral constraints. For a tool that fetches data, more context about the return format would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so both parameters are already documented in the schema. The description adds minimal value beyond the schema: it reinforces the URL format example and mentions the token is for private projects. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '通过YApi接口URL获取详细信息' (get detailed information through YApi interface URL). It specifies the verb '获取' (get) and resource '详细信息' (detailed information) for YApi interfaces. However, it doesn't explicitly differentiate from sibling tools like 'yapi_get_interface' (which likely uses ID instead of URL) or 'yapi_search_interface'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by stating it '支持直接粘贴YApi链接' (supports directly pasting YApi links) with an example URL format. This suggests when to use this tool (when you have a full URL). However, it doesn't explicitly state when NOT to use it or mention alternatives like 'yapi_get_interface' (which might use an ID parameter instead).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

yapi_get_projectC

获取YApi项目的基本信息,包括项目名称、描述、成员等

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesYApi项目ID
tokenNo访问令牌(可选)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets' information, implying a read-only operation, but doesn't specify authentication needs (e.g., token usage), rate limits, or response format. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose and lists retrieved information. It avoids redundancy, though it could be slightly more structured by separating usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose but lacks behavioral details and usage guidelines, making it incomplete for optimal agent understanding without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('project_id' and optional 'token'). The description adds no additional meaning beyond what the schema provides, such as explaining token usage or project_id format, resulting in the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('获取' meaning 'get') and resource ('YApi项目的基本信息' meaning 'basic information of YApi project'), specifying what information is retrieved (project name, description, members). It distinguishes from siblings like 'yapi_get_interface' by focusing on projects rather than interfaces, though it doesn't explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'yapi_get_interface' or 'yapi_list_interfaces', nor does it specify prerequisites or exclusions, leaving usage context implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

yapi_list_interfacesC

获取YApi项目或分类下的接口列表

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesYApi项目ID
cat_idNo分类ID(可选)
tokenNo访问令牌(可选)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions '获取' (get) which suggests a read operation, but doesn't disclose behavioral traits like authentication needs (token parameter is optional but not explained), rate limits, pagination, or what the output looks like (no output schema). For a list operation with no annotations, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's purpose without any fluff. It's appropriately sized and front-loaded, with every word contributing to understanding the action and scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 3 parameters (with 100% schema coverage but no behavioral context), the description is incomplete. It doesn't explain the return format, error handling, or how to interpret results (e.g., list structure). For a list tool with siblings, more context on usage and output is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (project_id, cat_id, token). The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain relationships between project_id and cat_id or token usage). Baseline is 3 when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('获取' meaning 'get') and resource ('接口列表' meaning 'interface list') with scope ('YApi项目或分类下' meaning 'under YApi project or category'). It distinguishes from siblings like yapi_get_interface (single interface) and yapi_search_interface (search), but doesn't explicitly mention these distinctions. The purpose is specific and actionable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like yapi_search_interface or yapi_get_interface_by_url. The description implies it lists interfaces under a project or category, but doesn't specify scenarios (e.g., for browsing vs. searching) or prerequisites. Usage is implied from context but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

yapi_search_interfaceB

在YApi项目中搜索接口,支持按接口名称、路径搜索

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesYApi项目ID
keywordYes搜索关键词
tokenNo访问令牌(可选)

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool searches interfaces but doesn't disclose behavioral traits like whether it's read-only (implied but not explicit), pagination behavior, rate limits, authentication requirements (though 'token' is optional in schema), or what happens if no results are found. For a search tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese: '在YApi项目中搜索接口,支持按接口名称、路径搜索'. It's front-loaded with the core purpose and includes a useful detail (search by name/path) without unnecessary elaboration. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search function with 3 parameters), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and search criteria but lacks details on behavior, output format, error handling, or sibling tool differentiation. It meets the bare minimum for a search tool but leaves gaps that could hinder effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters ('project_id', 'keyword', 'token'). The description adds marginal value by mentioning search by interface name and path, which relates to the 'keyword' parameter but doesn't provide additional syntax or format details beyond what the schema implies. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '在YApi项目中搜索接口' (search for interfaces in YApi projects). It specifies the action (搜索/search) and resource (接口/interfaces) with scope (YApi项目中/in YApi projects). However, it doesn't explicitly differentiate from sibling tools like 'yapi_list_interfaces' or 'yapi_get_interface_by_url', which likely have different search/filtering approaches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance: it mentions supporting search by interface name and path, but offers no explicit when-to-use instructions, prerequisites, or alternatives. There's no comparison with sibling tools (e.g., 'yapi_list_interfaces' might list all interfaces without filtering), leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updates
    • First observedyapi_get_interface
    • First observedyapi_get_interface_by_url
    • First observedyapi_get_project
    • First observedyapi_list_interfaces
    • First observedyapi_search_interface

TDQS

B3.4/5.0
Disambiguation4/5

The tools are mostly distinct with clear purposes: get_interface, get_interface_by_url, get_project, list_interfaces, and search_interface. However, yapi_get_interface and yapi_get_interface_by_url could cause some confusion as both retrieve interface details, though the latter specifies a URL-based method. The descriptions help differentiate them, but there is minor overlap in functionality.

Naming Consistency5/5

All tool names follow a consistent yapi_verb_noun pattern using snake_case, such as yapi_get_interface, yapi_list_interfaces, and yapi_search_interface. This predictability makes it easy for agents to understand and use the tools without confusion about naming conventions.

Tool Count5/5

With 5 tools, this server is well-scoped for interacting with YApi, covering key operations like retrieving, listing, and searching interfaces and projects. The count is appropriate, avoiding bloat while providing essential functionality for the domain.

Completeness4/5

The tool set covers core read operations for YApi, including getting, listing, and searching interfaces and projects. However, there are minor gaps, such as no tools for creating, updating, or deleting interfaces or projects, which might limit full lifecycle management. Agents can still perform basic queries effectively.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • MCP-native collaborative markdown editor with real-time AI document editing

  • The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.

  • The OpenRouter MCP server plugs OpenRouter into the AI tools you already use. Once connected, your assistant can pull live OpenRouter data (models, prices, your credits, rankings, and docs) and send quick test messages, all without leaving your editor.

  • Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    29
    9
    GPL 3.0
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables 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.
    16
    22
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    An MCP server for the YApi platform that allows AI assistants to search, create, and manage API documentation directly within tools like Cursor. It supports multi-project management and seamless integration into AI-driven programming workflows for interface maintenance.
    2,255
    118
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TStoneLee/mcp-yapi-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server