mcp-server-yapi

mcp-server-yapi

MCP server for YApi that enables LLMs to manage API interfaces, projects, and categories through natural language, supporting multiple projects and path fuzzy matching.

Category
Visit Server

README

mcp-server-yapi

version smithery badge

mcp-server-yapi 是一个为 YApi 设计的 MCP 服务器。它将 YApi 的常用功能封装为一系列工具,允许大语言模型(LLM)通过自然语言与你的 YApi 平台进行交互,实现接口管理自动化。

✨ 核心功能

🚀 企业增强版特性:

  • 多项目支持: 同时管理多个YAPI项目,支持不同域名和token
  • 文件配置: 支持JSON文件配置,管理更简洁安全
  • 路径模糊匹配: 接口查询支持路径模糊匹配,无需记住接口ID
  • 高性能列表: 默认获取2000条接口数据,满足大项目需求

📋 基础功能:

  • 项目管理: 获取项目基本信息
  • 接口管理: 创建、保存、更新、获取接口信息
  • 接口分类: 创建分类、获取分类菜单
  • 接口列表: 获取项目或分类下的接口列表

⚙️ 客户端配置

安装要求

  • Node.js >= v18.0.0
  • Cursor, Windsurf, Claude Desktop 或者其它支持 MCP 协议的客户端

配置示例

YAPI 的项目 TOKEN:在"项目->设置->token 配置"中

单项目配置(向后兼容)

{
  "mcpServers": {
    "mcp-server-yapi": {
      "command": "npx",
      "args": ["-y", "@yogeliu/mcp-server-yapi"],
      "env": {
        "YAPI_BASE_URL": "YAPI服务地址,例:https://xxx.yyy.com",
        "YAPI_TOKEN": "项目TOKEN",
        "MCP_DEBUG_CONSOLE": "false"
      }
    }
  }
}

多项目配置(推荐)

方式1:使用配置文件(推荐)

  1. 创建 yapi-projects.json 配置文件:
{
  "go_equity_package": {
    "baseUrl": "https://fed.qschou.com",
    "token": "your_project_token_here"
  },
  "test_project": {
    "baseUrl": "https://test.example.com", 
    "token": "test_project_token"
  }
}
  1. MCP客户端配置:
{
  "mcpServers": {
    "mcp-server-yapi": {
      "command": "npx",
      "args": ["-y", "@yogeliu/mcp-server-yapi"],
      "env": {
        "YAPI_PROJECTS_FILE": "./yapi-projects.json",
        "YAPI_DEFAULT_PROJECT": "go_equity_package",
        "MCP_DEBUG_CONSOLE": "false"
      }
    }
  }
}

方式2:使用环境变量(不推荐)

{
  "mcpServers": {
    "mcp-server-yapi": {
      "command": "npx",
      "args": ["-y", "@yogeliu/mcp-server-yapi"],
      "env": {
        "YAPI_PROJECTS": "{\"project1\":{\"baseUrl\":\"https://yapi1.com\",\"token\":\"token1\"},\"project2\":{\"baseUrl\":\"https://yapi2.com\",\"token\":\"token2\"}}",
        "YAPI_DEFAULT_PROJECT": "project1",
        "MCP_DEBUG_CONSOLE": "false"
      }
    }
  }
}

🔧 本地开发调试

请确保你的开发环境中已安装 Node.js (版本 >=18)。

  1. 克隆并编译
# 克隆仓库
git clone https://github.com/kales0202/mcp-server-yapi.git

# 进入项目目录
cd mcp-server-yapi

# 安装依赖
npm install

# 编译生成dist/index.js
npm run build
  1. 与 AI Agent 结合

你可以将此服务集成到支持 MCP 协议的 AI Agent 客户端中,将以下配置添加到你的客户端配置文件中

YAPI 的项目 TOKEN:在"项目->设置->toekn 配置"中

{
  "mcpServers": {
    "mcp-server-yapi": {
      "command": "node",
      "args": ["/absolute/path/to/your/mcp-server-yapi/dist/index.js"],
      "env": {
        "YAPI_BASE_URL": "YAPI服务地址",
        "YAPI_TOKEN": "项目TOKEN",
        "MCP_DEBUG_CONSOLE": "false"
      }
    }
  }
}

🛠️ 可用工具列表

  • get_project: 获取项目基本信息
  • add_cat: 新增接口分类
  • get_cat_menu: 获取菜单列表
  • list_cat: 获取某个分类下接口列表
  • list_menu: 获取接口菜单列表
  • get_interface: 获取接口数据
  • list_interface: 获取接口列表数据
  • save_interface: 新增或者更新接口
  • add_interface: 新增接口
  • up_interface: 更新接口
  • import_data: 服务端数据导入

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured