Content
# Apifox MCP Server
Using Apifox MCP Server, you can provide the interface documentation in the Apifox project as a data source to IDE tools that support AI programming, such as Cursor, so that AI can directly access the interface documentation data corresponding to the project.
Developers can use AI assistants to complete the following tasks: generate or modify code based on interface documentation, search interface documentation content, etc. As for what more powerful things AI can do with this interface documentation data, please use your and your team's imagination 😜
## 🎯 How to Use
After installing and configuring MCP, Apifox MCP Server will automatically read all the interface documentation data in the entire Apifox project and cache it on the local computer. AI can read the interface documentation data of all interfaces in the project through MCP.
You just need to tell AI what you want to do through the API documentation, for example:
1. "Get the API documentation through MCP, and then generate the definition code for Product and its related models"
2. "According to the API documentation, add several new fields in the API documentation to the Product DTO"
3. "Add comments to each field of the Product class according to the API documentation"
4. "According to the API documentation, generate all MVC code related to the /users interface"
Note: The interface documentation data is cached locally by default. If the data in Apifox is updated, please tell AI to refresh the interface documentation data, otherwise the data read by AI may not be the latest.
## 🚀 Installation Method
### Prerequisites
- Node.js environment installed (version >= 18, the latest LTS version is recommended)
- Any IDE that supports MCP:
- Cursor
- VSCode + Cline plugin
### Installation
1. **Generate Access Token in Apifox**
a. Open Apifox, hover the mouse over the avatar in the upper right corner of the page, and click "Account Settings -> API Access Token"
b. Create a new API access token, see the help documentation for details
c. Get the API access token and replace `<access-token>` in the configuration file below
2. **Get Apifox Project ID**
a. Open the corresponding project in Apifox
b. Click "Project Settings" in the left sidebar, and you can copy the project ID on the "Basic Settings" page
c. Get the project ID and replace `<project-id>` in the configuration file below
3. **Configure IDE**
Add the following JSON configuration to the corresponding MCP configuration file of the IDE:
```json
{
"mcpServers": {
"API 文档": {
"command": "npx",
"args": [
"-y",
"apifox-mcp-server@latest",
"--project-id=<project-id>"
],
"env": {
"APIFOX_ACCESS_TOKEN": "<access-token>"
}
}
}
}
```
If you are using the Windows operating system and the above configuration file does not work properly, please use the following configuration file:
```json
{
"mcpServers": {
"API 文档": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"apifox-mcp-server@latest",
"--project-id=<project-id>"
],
"env": {
"APIFOX_ACCESS_TOKEN": "<access-token>"
}
}
}
}
```
- Cursor: Add to the global `~/.cursor/mcp.json` or the project's `.cursor/mcp.json`
- Cline: Open Cline panel > MCP Server > Configure MCP Server
**Note:**
1. Please replace the above `<access-token>` and `<project-id>` with your personal Apifox API access token and Apifox project ID.
2. It is recommended to fill in the MCP Server name in the configuration file with a name containing the words "API 文档" such as "API 文档" or "xxx API 文档", so that AI can more easily correctly identify the purpose of this MCP Server. It is not recommended to fill in "Apifox" or "Apifox MCP", AI is not easy to identify the purpose of this writing.
3. If you need to use the API documentation of multiple projects, add multiple MCP Servers in the configuration file (different projects have different `<project-id>`), and fill in the name of the MCP Server as "xxx API 文档".
4. If the team is used to synchronizing the MCP configuration file to the code repository, it is recommended to delete "APIFOX_ACCESS_TOKEN": "`<access-token>`" in the configuration and change it to each member configuring an environment variable named APIFOX_ACCESS_TOKEN on their own computer to avoid APIFOX_ACCESS_TOKEN leakage problems.
5. For users using the private deployment version, please add the parameter in the MCP configuration file of the IDE: "--apifox-api-base-url=`<API address of the private deployment server, starting with http:// or https://>`". In addition, please ensure that the network can access `www.npm.com` normally.
6. In addition to the Apifox project, it also supports directly reading Swagger/OAS files. Please delete the `"--project-id=<project-id>"` parameter and add the `"--oas=<oas-url-or-path>"` parameter. Such as: `npx apifox-mcp-server --oas https://petstore.swagger.io/v2/swagger.json` or `npx apifox-mcp-server --oas ~/data/petstore/swagger.json`
## ❓Help and Support
Apifox MCP Server is still in the internal testing stage. You are welcome to give us suggestions and ideas. Please join the internal testing group:

Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
git
A Model Context Protocol server for Git automation and interaction.