Skip to main content
Glama

YApi MCP Bridge

A YApi Server based on the Model Context Protocol (MCP), allowing MCP-enabled AI clients to query, search, create, and update YApi interfaces.

Features

The following tools are currently available:

Tool

Purpose

Type

yapi_get_project

Get project details

Read-only

yapi_get_interface

Get a simplified interface definition, optionally returning the raw full data

Read-only

yapi_list_categories

Get project interface categories

Read-only

yapi_list_interfaces

Paginate project interfaces, filterable by status or tag

Read-only

yapi_list_category_interfaces

Paginate interfaces under a category

Read-only

yapi_search_interface

Search interfaces by title, path, or HTTP method

Read-only

yapi_create_category

Create an interface category

Write

yapi_create_interface

Create an interface

Write

yapi_update_interface

Update an interface

Write

The Server does not provide delete tools, to prevent AI clients from accidentally performing irreversible operations.

Related MCP server: YApi MCP Server

Install with npm

No need to clone the repository; you can run it directly:

npx -y yapi-mcp-bridge

You can also install it globally:

npm install -g yapi-mcp-bridge
yapi-mcp-bridge

After global installation, you can use the following command to view tool call statistics:

yapi-mcp-stats

Install from source

Requirements

  • Node.js 18 or higher

  • A YApi instance that is accessible

  • A YApi Cookie with access permissions for the corresponding project

Running from source also requires pnpm 10 or higher. On macOS, you can use Homebrew to install Node.js and pnpm:

brew install node pnpm

Install dependencies

After entering the project directory, run:

pnpm install

Configure YApi

Copy the environment variable example:

cp .env.example .env

Edit .env:

YAPI_HOST=https://yapi.example.com
YAPI_COOKIE=_yapi_token=xxx;_yapi_uid=xx;

Parameter descriptions:

  • YAPI_HOST: The YApi service address. Only fill in the protocol and domain name; do not include /api.

  • YAPI_COOKIE: The full Cookie string used when accessing YApi.

  • YAPI_LOG_FILE: Optional log file path. The default is ~/.yapi-mcp/logs/yapi-mcp.log.

After logging in to YApi, you can open the Network panel in the browser developer tools, select any YApi request, and copy the Cookie from the Request Headers. The Cookie is equivalent to login credentials; do not commit it to Git or share it with others. This project ignores .env by default.

Start the Server

Run in the project root directory:

pnpm start

This is a stdio MCP Server. After starting it directly, there is no ordinary HTTP page and no interactive prompt is printed; it waits for the MCP client to communicate via standard input and output.

After a successful start, the Server outputs similar information through stderr, which does not pollute the stdout used for MCP communication:

[yapi-mcp] server started (stdio), tools=9, log=~/.yapi-mcp/logs/yapi-mcp.log

Run the tests:

pnpm test

Connect to an MCP client

When using the npm package, add the following configuration to a client that supports stdio MCP Servers:

{
  "mcpServers": {
    "yapi": {
      "command": "npx",
      "args": [
        "-y",
        "yapi-mcp-bridge"
      ],
      "env": {
        "YAPI_HOST": "https://yapi.example.com",
        "YAPI_COOKIE": "_yapi_token=xxx;_yapi_uid=xx;"
      }
    }
  }
}

If starting from source, you can continue using the Node.js absolute path configuration:

{
  "command": "node",
  "args": ["/absolute/path/to/yapi-mcp-server/src/index.js"],
  "env": {
    "YAPI_HOST": "https://yapi.example.com",
    "YAPI_COOKIE": "_yapi_token=xxx;_yapi_uid=xx;"
  }
}

After modifying the configuration, restart or reload the MCP client. The client should discover 9 tools prefixed with yapi_.

Usage

After connecting, you can directly use natural language to have the AI client operate YApi.

Query projects and interfaces

获取 YApi 项目 1922 的详情。
列出 YApi 项目 1922 的所有接口分类。
在 YApi 项目 1922 中搜索路径包含 /order 的接口,并获取匹配接口的常用定义。

yapi_get_interface by default only returns the following commonly used information:

  • Interface ID, title, HTTP method, and path

  • Interface description

  • Path, Query, Header, and Body input parameters

  • Response type and response content

When you need to troubleshoot YApi metadata or get the raw response, you can explicitly request full: true:

获取 YApi 接口 5001 的原始全量数据。

Create an interface category

在 YApi 项目 1922 中创建一个名为“订单管理”的接口分类。

Create an interface

在 YApi 项目 1922、分类 3001 中创建接口:
标题为“创建订单”,方法为 POST,路径为 /orders,
请求体类型为 JSON,请求示例为 {"productId": 1001, "quantity": 2},
响应示例为 {"id": 9001, "status": "created"}。

Required parameters when creating an interface:

Parameter

Description

projectId

YApi project ID

categoryId

Interface category ID

title

Interface title

path

Interface path starting with /

method

HTTP method, e.g. GET, POST

requestBody and responseBody need to be passed as strings. If the content is JSON or JSON Schema, it also needs to be serialized into a string first.

Update an interface

把 YApi 接口 5001 的标题修改为“查询订单详情”,状态修改为 done,并添加 order 标签。

To update an interface, you only need to provide the interface ID and the fields to modify. Fields that are not provided are not sent to YApi.

Logs and call statistics

The Server writes logs to the following location by default:

~/.yapi-mcp/logs/yapi-mcp.log

Logs use the JSON Lines format, with one event per line. For example:

{"timestamp":"2026-08-21T08:00:00.000Z","event":"tool_call","tool":"yapi_get_interface","status":"success","durationMs":128}

Tool logs only record the tool name, call status, and elapsed time. They do not record call parameters, interface content, Cookies, or other credentials.

When the number of appended log records exceeds 1000, the Server automatically deletes the oldest 300 records to prevent the log file from growing indefinitely.

View tool call frequency, success count, failure count, and average elapsed time:

# 全局安装
yapi-mcp-stats

# 从源码运行
pnpm stats

You can change the log location via YAPI_LOG_FILE. When using a relative path, it is resolved relative to the Server's startup directory; it is recommended to configure an absolute path in MCP clients.

FAQ

Returns "Please log in" or no permission

Check the following:

  • Whether YAPI_COOKIE is complete and has not expired.

  • Whether the user corresponding to the current Cookie has project access or edit permissions.

  • Whether the MCP Server was restarted after changing the Cookie.

The client cannot find the Server

  • Confirm that src/index.js in the MCP configuration uses an absolute path.

  • Confirm that command points to an executable Node.js.

  • Run pnpm test in the project directory to confirm that the dependencies and runtime environment are normal.

Changes to .env have no effect

.env is loaded from the Server's current working directory by default. When starting from the terminal, run pnpm start in the project root directory; when starting from an MCP client, it is recommended to explicitly pass YAPI_HOST and YAPI_COOKIE via the env in the configuration.

Project structure

src/
├── handlers/       # MCP 工具 handler 与 YApi 方法映射
├── tools/          # 工具定义、Zod 输入输出 Schema
├── index.js        # stdio Server 入口
├── server.js       # McpServer 注册
└── yapi.js         # YApi HTTP API 封装
test/               # 单元测试与 MCP 注册测试

Security notes

  • Do not commit .env or YApi Cookies.

  • Write tools will actually modify YApi data. Confirm the project ID, category ID, and interface ID before executing.

  • It is recommended to use a YApi account with the smallest possible permission scope.

  • Default logs are stored in the .yapi-mcp/logs/ directory under the user's home directory and are not written to the npm installation directory.

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

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.
    25
    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.
    15
    22
    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.
    7
    GPL 3.0

View all related MCP servers

Related MCP Connectors

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • Official Microsoft MCP Server to query Microsoft Entra data using natural language

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

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

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