About YAPI MCP Server
YAPI MCP Server lets LLMs retrieve API documentation from a YAPI instance. It supports listing project interfaces, searching by title or path, and fetching full specifications.
Key features
- 01List project interface categories
- 02Retrieve full interface specifications
- 03Search titles and paths
- 04Use a default project token
Use cases
- 01Browse APIs in a YAPI project
- 02Inspect request and response schemas
- 03Find endpoints by keyword
MCP support
It exposes YAPI project interfaces to MCP clients through tools for listing, searching and retrieving details. The server connects to a configured YAPI instance using its URL and project token.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEYAPI MCP Server
A Model Context Protocol (MCP) server for interacting with a YAPI instance. This server enables LLMs to retrieve API documentation details from your YAPI projects.
Features
- List Interfaces: Get all interface categories and basic interface info within a project
- Get Interface Details: Retrieve detailed information for a specific interface by its ID
- Search Interfaces: Search for interfaces by keyword in titles or paths
Tools
yapi_list_interfaces
Lists all interface categories and the interfaces within them for a specific YAPI project.
Input:
project_token(optional): The token for the YAPI project. Not required ifYAPI_PROJECT_TOKENenv is set.
Returns: JSON array of categories with simplified interface objects (id, title, path, method, status).
yapi_get_interface_details
Gets detailed information for a specific YAPI interface by its ID.
Input:
project_token(optional): The token for the YAPI project. Not required ifYAPI_PROJECT_TOKENenv is set.interface_id(number, required): The ID of the specific YAPI interface.
Returns: JSON object with full interface specification (request/response parameters, headers, body schemas, etc.).
yapi_search_interfaces
Searches for interfaces by keyword in their titles or paths.
Input:
project_token(optional): The token for the YAPI project. Not required ifYAPI_PROJECT_TOKENenv is set.keyword(string, required): The keyword to search for.
Returns: JSON array of matching interfaces with their category information.
Prerequisites
- A running YAPI instance
- Access to the project token(s) for the YAPI projects you want to interact with (found in YAPI project "Settings" -> "Tokens")
- Node.js 18+ installed
Environment Variables
| Variable | Required | Description |
|---|---|---|
YAPI_URL | Yes | Base URL of your YAPI instance (e.g., http://yapi.example.com) |
YAPI_PROJECT_TOKEN | No | Default project token. If set, project_token parameter becomes optional in tool calls |
Installation & Configuration
Build from Source
git clone <this-repo>
cd yapi-mcp-server
npm install
npm run build
Local Development (npm link)
For local development, use npm link to create a global symlink:
cd yapi-mcp-server
npm link
This makes mcp-server-yapi command available globally, avoiding hardcoded paths.
Claude Desktop
Add to your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %AppData%\Claude\claude_desktop_config.json
{
"mcpServers": {
"yapi": {
"command": "mcp-server-yapi",
"env": {
"YAPI_URL": "<your-yapi-url>",
"YAPI_PROJECT_TOKEN": "<your-project-token>"
}
}
}
}
Claude Code (CLI)
Use the claude mcp command to add the server:
# Add to user config (available in all projects)
claude mcp add-json yapi -s user '{
"type": "stdio",
"command": "mcp-server-yapi",
"env": {
"YAPI_URL": "<your-yapi-url>",
"YAPI_PROJECT_TOKEN": "<your-project-token>"
}
}'
# Or add to project config (only for current project)
claude mcp add-json yapi -s project '{
"type": "stdio",
"command": "mcp-server-yapi",
"env": {
"YAPI_URL": "<your-yapi-url>",
"YAPI_PROJECT_TOKEN": "<your-project-token>"
}
}'
# Verify the configuration
claude mcp list
claude mcp get yapi
Cursor IDE
Add to your Cursor MCP settings:
macOS: ~/.cursor/mcp.json
Windows: %USERPROFILE%\.cursor\mcp.json
{
"mcpServers": {
"yapi": {
"command": "mcp-server-yapi",
"env": {
"YAPI_URL": "<your-yapi-url>",
"YAPI_PROJECT_TOKEN": "<your-project-token>"
}
}
}
}
Using npx (Recommended for distribution)
If published to npm, use npx for automatic version management:
{
"mcpServers": {
"yapi": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-yapi"],
"env": {
"YAPI_URL": "<your-yapi-url>",
"YAPI_PROJECT_TOKEN": "<your-project-token>"
}
}
}
}
Usage Examples
Once configured, you can ask Claude to:
- "List all APIs in my YAPI project"
- "Get details for interface ID 12345"
- "Search for APIs related to 'user' in my project"
- "Show me all POST endpoints"
Troubleshooting
Server not starting
- Ensure Node.js 18+ is installed
- Verify the path to
dist/index.jsis correct - Check that
YAPI_URLis set and accessible
Authentication errors
- Verify your
YAPI_PROJECT_TOKENis correct - Check token permissions in YAPI project settings
Network errors
- Ensure your YAPI instance is accessible from your machine
- Check firewall settings if using internal network
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run watch
# Run directly (requires env vars)
YAPI_URL=http://yapi.example.com npm start
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.