Yapi MCP Server logo

Yapi MCP Server

Community
lzsheng

yapi mcp server

Publisherlzsheng
RepositoryYapi-MCP
LanguageTypeScript
Forks
31
Stars
120
Available tools
5
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Yapi MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 5 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    120 stars and 31 forks from the linked repository.

Yapi Auto MCP Server

一个用于 YApi 的 Model Context Protocol (MCP) 服务器,让你能够在 Cursor 等 AI 编程工具中直接操作 YApi 接口文档。

项目简介

Yapi Auto MCP Server 是一个基于 Model Context Protocol 的服务器,专为 YApi 接口管理平台设计。它允许你在 Cursor、Claude Desktop 等支持 MCP 的 AI 工具中直接:

  • 🔍 搜索和查看 YApi 项目中的接口文档
  • ✏️ 创建和更新 接口定义
  • 📋 管理项目和分类 结构
  • 🔗 无缝集成 AI 编程工作流
  • 🛠 支持多个 YApi Project配置

通过 MCP 协议,AI 助手可以理解你的 YApi 接口结构,在编程过程中提供更准确的建议和代码生成。

主要功能

🔍 接口查询和搜索

  • yapi_search_apis: 按名称、路径、标签等条件搜索接口
  • yapi_get_api_desc: 获取特定接口的详细信息(请求/响应结构、参数等)
  • yapi_list_projects: 列出所有可访问的项目
  • yapi_get_categories: 获取项目下的接口分类和接口列表

✏️ 接口管理

  • yapi_save_api: 创建新接口或更新现有接口
    • 支持完整的接口定义(路径、方法、参数、请求体、响应等)
    • 支持 JSON Schema 和表单数据格式
    • 自动处理接口状态和分类管理

🎯 智能特性

  • 多项目支持: 同时管理多个 YApi 项目
  • 缓存机制: 提高查询响应速度
  • 详细日志: 便于调试和监控
  • 灵活配置: 支持环境变量和命令行参数

快速开始

推荐方式:使用 npx(无需安装)

  1. 获取 YApi Token:登录你的 YApi 平台,在项目设置中获取 Token
  2. 配置 Cursor:在 Cursor 设置中添加 MCP 服务器:
json
{
  "mcpServers": {
    "yapi-auto-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "yapi-auto-mcp",
        "--stdio",
        "--yapi-base-url=https://your-yapi-domain.com",
        "--yapi-token=projectId:your_token_here"
      ]
    }
  }
}
  1. 开始使用:重启 Cursor,你就可以在对话中直接操作 YApi 了!

安装配置

方式一:npx 直接使用(推荐)

无需本地安装,通过 npx 直接运行:

json
{
  "mcpServers": {
    "yapi-auto-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "yapi-auto-mcp",
        "--stdio",
        "--yapi-base-url=https://yapi.example.com",
        "--yapi-token=projectId:token1,projectId2:token2",
        "--yapi-cache-ttl=10",
        "--yapi-log-level=info"
      ]
    }
  }
}

方式二:使用环境变量

在 MCP 配置中定义环境变量:

json
{
  "mcpServers": {
    "yapi-auto-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "yapi-auto-mcp",
        "--stdio"
      ],
      "env": {
        "YAPI_BASE_URL": "https://yapi.example.com",
        "YAPI_TOKEN": "projectId:token1,projectId2:token2",
        "YAPI_CACHE_TTL": "10",
        "YAPI_LOG_LEVEL": "info"
      }
    }
  }
}

方式三:本地开发模式

适合需要修改代码或调试的场景:

  1. 克隆和安装:
bash
git clone <repository-url>
cd yapi-mcp
pnpm install
  1. 配置环境变量(在项目根目录创建 .env 文件):
env
# YApi 基础配置
YAPI_BASE_URL=https://your-yapi-domain.com
YAPI_TOKEN=projectId:your_token_here,projectId2:your_token2_here

# 服务器配置
PORT=3388

# 可选配置
YAPI_CACHE_TTL=10
YAPI_LOG_LEVEL=info
  1. 启动服务:

SSE 模式(HTTP 服务):

bash
pnpm run dev

然后在 Cursor 中配置:

json
{
  "mcpServers": {
    "yapi-mcp": {
      "url": "http://localhost:3388/sse"
    }
  }
}

Stdio 模式:

bash
pnpm run build
node dist/cli.js --stdio

使用指南

获取 YApi Token

  1. 登录你的 YApi 平台
  2. 进入项目设置页面
  3. 在 Token 配置中生成或查看 Token

Token 获取示例

Token 格式说明:

  • 单项目:projectId:token
  • 多项目:projectId1:token1,projectId2:token2

使用示例

配置完成后,你可以在 Cursor 中这样使用:

使用示例

常用操作示例:

  1. 搜索接口:

    "帮我找一下用户登录相关的接口"

  2. 查看接口详情:

    "显示用户注册接口的详细信息"

  3. 创建新接口:

    "帮我创建一个获取用户列表的接口,路径是 /api/users,使用 GET 方法"

  4. 更新接口:

    "更新用户登录接口,添加验证码参数"

高级配置

命令行参数详解

参数描述示例默认值
--yapi-base-urlYApi 服务器基础 URL--yapi-base-url=https://yapi.example.com-
--yapi-tokenYApi 项目 Token(支持多项目)--yapi-token=1026:token1,1027:token2-
--yapi-cache-ttl缓存时效(分钟)--yapi-cache-ttl=1010
--yapi-log-level日志级别--yapi-log-level=infoinfo
--portHTTP 服务端口(SSE 模式)--port=33883388
--stdio启用 stdio 模式(MCP 必需)--stdio-

环境变量说明

创建 .env 文件进行配置:

env
# 必需配置
YAPI_BASE_URL=https://your-yapi-domain.com
YAPI_TOKEN=projectId:your_token_here

# 可选配置
PORT=3388                    # HTTP 服务端口
YAPI_CACHE_TTL=10           # 缓存时效(分钟)
YAPI_LOG_LEVEL=info         # 日志级别:debug, info, warn, error, none

日志级别说明

  • debug: 输出所有日志,包括详细的调试信息
  • info: 输出信息、警告和错误日志(默认)
  • warn: 只输出警告和错误日志
  • error: 只输出错误日志
  • none: 不输出任何日志

配置方式选择建议

使用场景推荐方式优势
日常使用npx + 命令行参数无需安装,配置简单
团队共享npx + 环境变量配置统一,易于管理
开发调试本地安装 + SSE 模式便于调试和修改代码
企业部署本地安装 + stdio 模式性能更好,更稳定

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "lzsheng-yapi-mcp": {
      "command": "",
      "args": []
    }
  }
}

Available Tools

  • yapi_get_api_desc

    获取YApi中特定接口的详细信息

  • yapi_save_api

    新增或更新YApi中的接口信息

  • yapi_search_apis

    搜索YApi中的接口

  • yapi_list_projects

    列出YApi的项目ID(projectId)和项目名称

  • yapi_get_categories

    获取YApi项目下的接口分类列表,以及每个分类下的接口信息

Use Yapi MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Yapi MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Yapi MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Yapi MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "lzsheng-yapi-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "yapi-auto-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Yapi MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Yapi MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Yapi MCP Server to help me with this task?
Yapi MCP Server
Sure. I read it.
Here is what I found using Yapi MCP Server.

Option 2: Add an MCP server URL

Use this when Yapi MCP Server is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for Yapi MCP Server.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Yapi MCP Server connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Yapi MCP Server tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Yapi MCP Server tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Yapi MCP Server to help me with this task?
Yapi MCP Server
Sure. I read it.
Here is what I found using Yapi MCP Server.

Frequently asked questions

What is the Yapi MCP Server MCP server used for?

Yapi MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Yapi MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Yapi MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Yapi MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Yapi MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Yapi MCP Server MCP to TypingMind?

Yapi MCP Server can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Yapi MCP Server MCP provide in TypingMind?

Yapi MCP Server exposes 5 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Yapi MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Yapi MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇