Skip to main content
Glama

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

Related MCP server: Apidog MCP Server

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

Available Tools

7 tools
yapi_get_by_urlGet YAPI Data by URLA

Parse a YAPI page URL and fetch the corresponding data automatically. Supports project URLs (/project/{id}/interface/api), interface URLs (/project/{id}/interface/api/{interfaceId}), and category URLs (/project/{id}/interface/api/cat_{catId}).

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesFull YAPI page URL, e.g. http://yapi.example.com/project/1/interface/api/100

TDQS

A4.1/5.0
Behavior3/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. It discloses supported URL patterns and the automatic fetch behavior, but lacks details on error handling, idempotency, permission requirements, or rate limits. For a fetch tool, this is minimal but acceptable.

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, front-loaded sentence that states the purpose and then lists the supported patterns. Every sentence is necessary, and no extra words are used.

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 one required parameter, no output schema, and no annotations, the description covers the essential: what URLs work. It could mention fallback behavior or error responses, but for a simple fetch tool, it is reasonably complete.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds significant context by specifying the exact URL formats and examples (e.g., project, interface, category URLs). This goes beyond the schema's generic 'Full YAPI page URL' description.

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 it parses a YAPI page URL and fetches corresponding data automatically, and enumerates three specific URL patterns it supports (project, interface, category). This differentiates it from sibling tools like yapi_get_project or yapi_get_interface, which require specific IDs rather than URLs.

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 YAPI page URL is available, but it does not explicitly state when to prefer this tool over alternatives like yapi_get_project or yapi_get_interface. There is no mention of when NOT to use it or any prerequisites.

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

yapi_get_cat_menuGet YAPI Category MenuB

Get the list of interface categories (folders) for a project. Returns category IDs, names, and descriptions.

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesThe YAPI project ID

TDQS

B3.4/5.0
Behavior3/5

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

Without annotations, the description carries full burden. It indicates the tool is read-only (returns data) and specifies output fields, but does not disclose potential errors, authentication requirements, or side effects. This is adequate but not exhaustive.

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 consists of two sentences: the first states the purpose, the second lists the return values. No redundant information, front-loaded appropriately. Every word contributes.

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 low complexity (one required parameter, no output schema), the description covers the core functionality: it tells what the tool does, the required input, and what it returns. Missing details like response format or error handling are minor given the simplicity.

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 coverage is 100% with a single parameter 'project_id' described as 'The YAPI project ID'. The description only adds context ('for a project') that is already implied by the parameter name. No additional semantic value beyond the schema.

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 it retrieves a list of interface categories (folders) for a project, specifying the returned fields (IDs, names, descriptions). However, it does not differentiate from sibling tool 'yapi_get_full_menu', which likely returns a similar or broader set of data.

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 like yapi_get_full_menu. There is no mention of prerequisites, preferred contexts, or situations where this tool is not appropriate.

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

yapi_get_full_menuGet Full Interface MenuA

Get all interfaces grouped by category for a project. Returns the complete category-to-interface hierarchy. Warning: may return large payloads for big projects.

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesThe YAPI project ID

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description provides a warning about potentially large payloads, which is a key behavioral trait. However, it does not explicitly state that the operation is read-only or mention any authentication requirements.

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?

Three sentences: purpose, output description, and a warning. All sentences are relevant and concise, though the structure could be slightly more front-loaded.

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 a single parameter and no output schema, the description is fairly complete: it states the action, output hierarchy, and a performance warning. Missing details like pagination or sorting, but acceptable for this tool.

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 coverage is 100% for project_id, and the description adds no additional semantic meaning beyond what the schema already provides ('The YAPI project ID'). Baseline score of 3 is appropriate.

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?

Describes the tool's function clearly: 'Get all interfaces grouped by category for a project.' Specifies the output as 'complete category-to-interface hierarchy,' distinguishing it from siblings like yapi_get_cat_menu.

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_get_cat_menu or yapi_list_by_category. The warning about large payloads is helpful but does not explicitly 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_get_interfaceGet YAPI Interface DetailA

Get complete details of a single API interface including request parameters (headers, query, body), response body schema, description, and status.

ParametersJSON Schema
NameRequiredDescriptionDefault
interface_idYesThe interface ID to retrieve details for

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It accurately describes the tool as a read operation returning detailed interface data. However, it does not disclose potential side effects, authentication requirements, or rate limits, though for a simple get operation this is acceptable.

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, well-structured sentence that immediately conveys the tool's purpose and included components. It is concise with no extraneous information, earning its place without waste.

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's simplicity (one required parameter, no output schema), the description covers the essential functionality. It explains what the tool returns and is mostly self-contained. However, it does not address differences from sibling tool yapi_get_by_url, which might retrieve similar details.

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 the single parameter 'interface_id' well-documented in the schema. The description adds contextual value by specifying what details are returned, but does not provide additional parameter-level semantics beyond the schema.

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 it retrieves complete details of a single API interface, listing specific components like request parameters and response schema. It distinguishes from sibling tools such as yapi_list_interfaces (listing) and yapi_get_by_url (by URL) by focusing on a single interface by 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?

No guidance is provided on when to use this tool versus alternatives like yapi_get_by_url or yapi_list_interfaces. It does not mention prerequisites, limitations, or exclusion criteria, leaving the agent to infer usage solely from the description.

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

yapi_get_projectGet YAPI Project InfoB

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

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesThe YAPI project ID

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description should disclose behavioral traits. It implies a read operation but does not mention auth needs, rate limits, or error handling. Minimal disclosure.

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, no filler, front-loaded with purpose. Efficiently communicates the tool's function.

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?

Adequate for a simple retrieval tool with one parameter. Lacks details on prerequisites, error conditions, or expected behavior for invalid inputs.

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 already describes the single parameter with 100% coverage. Description adds no extra meaning beyond the schema; lists return fields but that is not parameter-specific.

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?

Description clearly states the tool retrieves project basic information, listing specific data fields. It distinguishes from siblings by the resource (project info) but does not explicitly differentiate from other yapi tools.

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_get_by_url or yapi_get_full_menu. The description lacks usage context or exclusions.

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

yapi_list_by_categoryList Interfaces by CategoryB

List interfaces belonging to a specific category with pagination.

ParametersJSON Schema
NameRequiredDescriptionDefault
cat_idYesThe category ID (obtained from yapi_get_cat_menu)
pageNoPage number (default: 1)
limitNoItems per page, max 100 (default: 20)

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It mentions pagination, which is a useful behavioral clue, but does not disclose whether the operation is read-only, requires authentication, or has any rate limits or side effects.

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 conveys the essential purpose without extraneous words. It is appropriately front-loaded and concise.

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 no output schema, the description should ideally explain the return format, which it does not. It adequately describes the input and basic behavior (pagination) but lacks context on the response structure or edge cases.

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 input schema has 100% description coverage, so baseline is 3. The description only adds 'with pagination', which loosely relates to page and limit parameters but provides no additional semantics beyond what the schema already specifies.

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 verb 'List' and resource 'interfaces belonging to a specific category with pagination', making the core function clear. However, it does not differentiate from the sibling tool 'yapi_list_interfaces', which likely lists all interfaces without category filter.

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 listing interfaces in a specific category, but it does not explicitly state when to use this tool versus alternatives like 'yapi_list_interfaces' or 'yapi_get_interface'. No guidance on when not to use it is provided.

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

yapi_list_interfacesList YAPI InterfacesB

List interfaces in a project with pagination. Returns basic info (ID, title, path, method, status) for each interface.

ParametersJSON Schema
NameRequiredDescriptionDefault
project_idYesThe YAPI project ID
pageNoPage number (default: 1)
limitNoItems per page, max 100 (default: 20)

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations, description bears full burden. It states it returns basic info but does not disclose behavioral traits like read-only nature, authentication needs, error behavior, or pagination behavior (e.g., max pages, order).

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?

Two concise, front-loaded sentences. No wasted words.

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 no output schema and 3 simple params, description covers basic return info. Lacks mention of how to obtain project_id (e.g., from yapi_get_project) and default sort order, but is largely sufficient for a listing tool.

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 covers all parameters with descriptions (100% coverage). Description adds context about return fields but does not meaningfully enhance parameter understanding beyond schema.

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?

Description clearly states verb (List), resource (interfaces in a project), and key features (pagination). It distinguishes from siblings like yapi_get_interface (single interface) and yapi_list_by_category (by category).

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 (e.g., yapi_get_interface for a single interface, yapi_list_by_category for categorized listing). No exclusions or prerequisites mentioned.

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

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: URL parsing, category listing, full hierarchy, single interface details, project info, listing by category, and general listing. No overlap.

Naming Consistency4/5

All tools follow the pattern 'yapi_<verb>_<noun>', but 'yapi_get_by_url' deviates slightly from the direct resource naming of others (e.g., 'yapi_get_interface'). Overall consistent.

Tool Count5/5

7 tools is well-scoped for a read-only API documentation server, covering project info, categories, full hierarchy, interface details, and multiple listing methods.

Completeness4/5

The surface covers core read operations; missing search by method/status or interface modification is acceptable for a read-only server. Minor gaps in filtering.

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI tools to search and explore API documentation from Apidog projects or OpenAPI/Swagger specifications, providing endpoint details, schemas, and project statistics through natural language queries.
    1,236
    1
    ISC
  • 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
    C
    quality
    D
    maintenance
    Enables AI assistants to manage YAPI API documentation by providing tools to create, update, and retrieve interface details. It also supports running automated tests and managing API data across multiple configured projects.
    11
    19
    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/AlwaysLoveme/yapi-mcp-server'

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