Home / MCP / MCP Apifox Server
Bridges Apifox API documentation with MCP-enabled AI assistants to extract API details and OpenAPI specs.
Configuration
View docs{
"mcpServers": {
"apifox": {
"command": "npx",
"args": [
"-y",
"mcp-apifox@latest"
],
"env": {
"APIFOX_ACCESS_TOKEN": ""
}
}
}
}You can connect Apifox API documentation to an MCP-enabled AI assistant by running a local MCP server that reads Apifox data and exposes it to the assistant. This bridge makes it easier for your AI to understand and operate against your Apifox APIs, leveraging the Model Context Protocol for smooth collaboration.
Install and run the MCP server locally, then point your MCP client at the running process. You can use either installation method shown below to start the Apifox MCP bridge. The server will read your Apifox API information from your tokens and expose it to the AI assistant so you can query API details, OpenAPI specs, and related data during development.
# Global installation (recommended)
npm install -g mcp-apifox
# Or using pnpm
pnpm add -g mcp-apifox{
"mcpServers": {
"apifox": {
"command": "npx",
"args": [
"-y",
"mcp-apifox@latest"
],
"env": {
"APIFOX_ACCESS_TOKEN": ""
}
}
}
}
```
```
{
"mcpServers": {
"apifox": {
"command": "npx",
"args": [
"-y",
"mcp-apifox@latest",
"--token=xxxx"
]
}
}
}
```
Make sure you replace the placeholder token with your actual Apifox access token. After starting, your MCP client can use the bridge to retrieve API information from Apifox by referencing the configured server name (apifox) and its command. You can obtain API details and the OpenAPI specification for specific project and API IDs through the bridge.Keep your Apifox access token secure. Do not expose the token in logs or shared configurations. Consider using environment variable management practices to protect secrets when running the MCP server.
If you encounter token errors, verify that APIFOX_ACCESS_TOKEN is correctly set in the environment where the MCP server runs. If using the second configuration method, ensure the token value is passed as a command-line argument and not omitted.
The bridge provides tools to extract IDs from Apifox URLs and fetch API information. The primary actions are: - get-apifox-project-id-and-api-id-from-url: extracts projectId and apiId from Apifox URLs - get-apifox-api-info: fetches the detailed API OpenAPI spec from Apifox using projectId and apiId
Extracts projectId and apiId from Apifox URLs or paths.
Fetches the detailed API OpenAPI specification from Apifox using the provided projectId and apiId.