Skip to main content
Glama
hizml
by hizml

yapi-mcp

English | 中文

A zero-dependency YApi MCP server that exposes YApi's API-management capabilities to Claude Code and any MCP client.

Why this exists

The npm package @yogeliu/yapi-mcp-server has two defects that make it completely unusable:

  1. Broken inputSchema serialization — it returns the Zod schema object itself as inputSchema. After JSON.stringify it becomes {"_def":...}, an invalid structure. MCP clients reject it with tools fetch failed, so none of the tools ever load.

  2. Wrong interface-list strategy — YApi's /api/interface/list ignores catid on most versions and returns only the first page by default. The original package's "iterate categories" approach causes massive duplication and misses most interfaces; it also reads the wrong id field (_id).

This project is rewritten from scratch with zero runtime dependencies (only Node ≥18 built-in fetch), hand-written valid JSON Schemas, and project-level pagination with dedup — fixing all of the above.

Related MCP server: YAPI MCP Server

Tools

Tool

Description

yapi_list_projects

List the configured project (id / name / desc)

yapi_get_categories

List project categories and the APIs under each

yapi_search_apis

Search APIs by keyword (title / path), optional method filter

yapi_get_api_details

Full detail of one API (params / headers / body / response)

yapi_save_api

Create or update an API (with api_id → update; without → create)

Install

No install needed — use it directly in your MCP config:

{ "command": "npx", "args": ["-y", "@hizml/yapi-mcp"] }

Option 2: clone

git clone https://github.com/hizml/yapi-mcp.git

Point the config at the local file:

{ "command": "node", "args": ["/absolute/path/to/yapi-mcp/yapi-mcp.mjs"] }

Configuration

Two environment variables:

  • YAPI_BASE_URL — YApi host, e.g. http://yapi.example.com

  • YAPI_TOKEN — format projectId:tokenValue, from the YApi project "Settings → token"

Claude Code (~/.claude.json)

{
  "mcpServers": {
    "yapi": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@hizml/yapi-mcp"],
      "env": {
        "YAPI_BASE_URL": "http://your-yapi-host",
        "YAPI_TOKEN": "227:your_token_here"
      }
    }
  }
}

Full example: examples/claude-code-config.json.

Features

  • Zero dependencies — pure Node ESM, only Node ≥18 built-in fetch

  • Valid JSON Schema — every inputSchema is hand-written standard JSON Schema, so clients validate it fine

  • Full pagination — project-level pagination + dedup, no missing or duplicate APIs

  • Robust errors — param errors, timeouts, and YApi errcode all become isError messages; the process never crashes

  • Debuggable — set DEBUG=1 to emit logs to stderr

Known limitations

  • Currently single-token (single-project); for multiple projects, run multiple instances

  • YApi's /api/interface/list total field is unreliable, so this tool stops paginating when a page returns fewer than the page size

License

MIT

Available Tools

5 tools
yapi_get_api_detailsA

获取接口详细信息(请求参数、请求头、请求体类型与结构、响应体等)。

ParametersJSON Schema
NameRequiredDescriptionDefault
api_idYes接口 ID(可由 search_apis 或 get_categories 结果获得)。

TDQS

A3.8/5.0
Behavior3/5

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

The description lists what data the tool returns (params, headers, body, response), which is useful behavioral context. However, with no annotations, it fails to disclose whether the operation is read-only, requires authentication, or has any side effects. A more explicit statement would improve clarity.

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, concise sentence that effectively conveys the tool's purpose without unnecessary words. It is front-loaded with the key action and details, though it could benefit from slight restructuring (e.g., listing items) for even better readability.

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 simple single-parameter tool and no output schema, the description provides adequate context by listing the types of details returned. However, it uses '等' (etc.) implying incompleteness and does not specify the response format or any limitations, leaving some ambiguity.

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% with a clear description of the api_id parameter. The tool description does not add additional meaning beyond the schema, meeting the baseline expectation.

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

Purpose5/5

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

The description clearly states the tool retrieves detailed API information including request parameters, headers, body structure, and response. It uses a specific verb ('获取...详细信息') and resource ('接口'), and distinguishes from sibling tools like search_apis (search) and get_categories (list categories).

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

Usage Guidelines4/5

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

The parameter description for api_id explicitly mentions it can be obtained from search_apis or get_categories, providing a clear usage context. However, the main description does not include explicit when-to-use or when-not-to-use guidance, but the parameter hint suffices.

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

yapi_get_categoriesB

获取指定项目的接口分类列表(分类 ID、名称,以及每个分类下的接口概要)。

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYes项目 ID。省略时使用 token 中的 projectId。

TDQS

B3.1/5.0
Behavior1/5

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

The description contradicts the input schema: it states the project_id parameter can be omitted (using a default from token), but the schema marks it as required. This inconsistency undermines agent trust and reliability. No annotations are provided, so the description fails to disclose behavioral traits accurately.

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, brief sentence that efficiently conveys the purpose and contents. No unnecessary words; it is front-loaded and easy to parse.

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?

The tool is simple with one parameter and no output schema, so the description is generally sufficient. However, the contradiction between description and input schema makes it incomplete and potentially confusing for the agent. Additionally, it does not explain the return format beyond a vague 'summary'.

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

Parameters2/5

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

Schema coverage is 100% (baseline 3), but the description adds misleading information about the parameter being optional when it is required per schema. This contradiction reduces the semantic value below baseline.

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

Purpose5/5

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

The description clearly states the verb '获取' (get) and the resource '接口分类列表' (interface category list) for a specified project, specifying what is returned (category ID, name, and interface summary). It distinguishes from sibling tools like yapi_get_api_details (gets API details) and yapi_list_projects (lists projects).

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 implies usage for retrieving categories of a project, but does not explicitly state when to use this tool versus alternatives, nor does it provide exclusions or prerequisites. It lacks guidance on when not to use it.

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

yapi_list_projectsA

列出当前 token 配置的 YApi 项目信息(项目 ID、名称、描述)。无参数。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the burden. It mentions the token-based authentication and that no parameters are required, indicating a read-only list operation. However, it does not disclose potential pagination, rate limits, or error cases, which would make it fully transparent.

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 sentence that efficiently communicates the action, scope, and field list. It is front-loaded with the key verb and resource, with no redundant information.

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

Completeness4/5

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

Given the tool has no parameters and no output schema, the description provides sufficient context: it lists the returned fields and the authentication context. It could be improved by mentioning the response format (e.g., array of objects), but it is largely complete for a simple list tool.

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

Parameters4/5

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

There are no parameters (0 params, 100% schema coverage). The description explicitly confirms 'no parameters,' which aligns with the schema. For zero-parameter tools, the baseline is 4, and the description adds the confirmation value.

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

Purpose5/5

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

The description clearly states the tool lists YApi project information for the current token, specifying the fields returned (ID, name, description). This action is distinct from sibling tools like yapi_get_api_details or yapi_save_api, which handle specific APIs or searches.

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 implies usage when a project list is needed but lacks explicit guidance on when to prefer this tool over alternatives. No exclusion criteria or recommended contexts are provided, relying on the user to infer from tool names.

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

yapi_save_apiA

创建或更新 YApi 接口。带 api_id 走更新(/api/interface/up),不带走创建(/api/interface/add)。至少需提供 project_id 与 catid。

ParametersJSON Schema
NameRequiredDescriptionDefault
descNo接口描述。
pathNo接口路径,例如 /api/foo/bar。
catidYes目标分类 ID。
titleNo接口标题。
api_idNo要更新的接口 ID。提供时为更新;省略时为创建。
methodNoHTTP 方法。
res_bodyNo响应体结构,JSON Schema 字符串。
req_queryNoquery 参数列表。
project_idYes目标项目 ID。
req_headersNo请求头列表。
req_body_typeNo请求体类型。
req_body_otherNo请求体结构,json 类型时为 JSON Schema 字符串。

TDQS

A3.8/5.0
Behavior2/5

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

With no annotations, the description carries full burden. It discloses only the create/update behavior and required parameters, but lacks details on side effects, authentication, error handling, or return values.

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, concise Chinese sentence that front-loads the main purpose and required parameters. There is no redundant information.

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 12 parameters and no output schema, the description lacks guidance on return values, error handling, and conditional parameter usage (e.g., path/method required for creation). It is insufficiently complete for a tool of this complexity.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds key value by explaining the conditional create/update logic tied to api_id, which is not evident from the schema alone.

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

Purpose5/5

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

The description clearly states the tool creates or updates a YApi interface, with specific conditions based on api_id. It distinguishes itself from sibling tools like yapi_get_api_details or yapi_search_apis by being the only mutative tool.

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

Usage Guidelines4/5

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

The description provides clear context on when to use create vs update based on api_id, and it identifies required parameters (project_id, catid). However, it does not explicitly exclude use cases or compare with siblings.

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

yapi_search_apisA

在项目内按关键词搜索接口(匹配 title/path,可选按 method 过滤),返回接口列表。

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes搜索关键词,按子串匹配接口 title 或 path(不区分大小写)。
methodNo可选。按 HTTP 方法过滤。
project_idNo项目 ID。省略时使用 token 中的 projectId。

TDQS

A4/5.0
Behavior3/5

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

No annotations provided, so description carries full burden. Discloses case-insensitive substring matching on title/path and optional method filter. But lacks details like pagination, result limits, or response structure (no output schema). Adequate but not thorough.

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?

Single sentence, front-loaded with action, minimal and efficient. Every word contributes to describing the tool's purpose and key options.

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

Completeness4/5

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

Given 3 parameters and no output schema, the description adequately explains input behavior. Lacks output details but the return of a 'list of APIs' is mentioned. Could be more complete with pagination info, but still serves its purpose.

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 baseline is 3. Description adds context that search is 'within a project' (scope), but otherwise the parameter descriptions in schema already cover the search functionality. No significant additional meaning.

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

Purpose5/5

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

Clearly states the tool searches APIs by keyword within a project, matching title/path with optional method filter. Distinguishes from sibling tools (e.g., yapi_get_api_details for details, yapi_save_api for saving) by specifying its unique search function.

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

Usage Guidelines4/5

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

Implies usage context: when needing to find APIs by search criteria. However, does not explicitly state when not to use or mention alternatives, but the context is clear enough given sibling tool names.

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 updatesv1.0.0
    • First observedyapi_get_api_details
    • First observedyapi_get_categories
    • First observedyapi_list_projects
    • First observedyapi_save_api
    • First observedyapi_search_apis

TDQS

A3.9/5.0
Disambiguation5/5

Each tool targets a distinct operation: listing projects, retrieving categories, getting API details, saving APIs, and searching. There is no functional overlap; an agent can clearly distinguish them.

Naming Consistency5/5

All tools follow a consistent 'yapi_verb_noun' pattern using snake_case, with clear and descriptive verbs (get, list, save, search). No mixing of conventions.

Tool Count5/5

Five tools is well-scoped for a YApi integration, covering the core interactions: project listing, category browsing, API details, creation/updating, and searching. Not excessive or insufficient.

Completeness4/5

Core CRUD and search are present, but a delete API tool is missing, which could be a gap for lifecycle management. However, the main workflows (discover, read, create/update) are covered.

Maintenance

ActivityStale
ResponsivenessNo issues

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

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
    B
    quality
    D
    maintenance
    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.
    9
    21
    3
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for YApi that enables LLMs to manage API interfaces, projects, and categories through natural language, supporting multiple projects and path fuzzy matching.
    22
    GPL 3.0

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/hizml/yapi-mcp'

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