Overview
What is Yapi Mcp Server?
Yapi Mcp Server is a Model Context Protocol (MCP) server that integrates with the YApi API management platform. It automatically generates TypeScript type definitions, mock data, and API request code for frontend developers.
How to use Yapi Mcp Server?
Install the server via npx -y @vtian/yapi-mcp-server --stdio in your MCP client (e.g., Cursor). Create a yapi.config.json file in your project root with the required remoteUrl and type fields. Then use the five provided tools — read_config, get_yapi_data, generate_types, generate_mock_from_yapi, and generate_api_code — through natural language prompts.
Key features of Yapi Mcp Server
- Reads YApi config file automatically
- Fetches YApi project data with 30‑minute cache
- Generates TypeScript interfaces from response schemas
- Creates realistic mock data matching API structures
- Produces Axios or Fetch API request code
- Works with any MCP‑compatible client
Use cases of Yapi Mcp Server
- List all interfaces in a YApi project
- Update YApi interface data when the API changes
- Generate mock data for a specific interface by ID or name
- Update TypeScript type definitions for a given interface
- Generate Axios or Fetch API call code for a specific endpoint
FAQ from Yapi Mcp Server
How does this server differ from yapi-cli?
The recommended yapi-cli supports CLI, MCP, skill, multiple YApi projects and spaces, and uses yapiopenapi to reduce context size and token usage.
What configuration is required?
Create a yapi.config.json file with remoteUrl (YApi export URL) and type (“yapi”). Optional fields include dataKey, mockPath, typePath, and apiPath.
How long is YApi data cached?
YApi data is cached for 30 minutes to reduce network requests.
What transport protocol does the server use?
The server uses stdio transport, as shown in the example Cursor configuration with --stdio.
What tools are available in the server?
Five tools: read_config, get_yapi_data, generate_types, generate_mock_from_yapi, and generate_api_code.