home / mcp / apifox api mcp server

Apifox API MCP Server

Provides access to Apifox API documentation for MCP-enabled IDEs to power AI-assisted coding and exploration.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "apifox-apifox-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "apifox-mcp-server@latest",
        "--project-id=<project-id>"
      ],
      "env": {
        "APIFOX_ACCESS_TOKEN": "<access-token>"
      }
    }
  }
}

Apifox MCP Server lets you expose API documentation from your Apifox project as a data source for MCP-enabled IDEs, so you can have AI-driven tooling access your interfaces to generate code, search docs, and more. The server caches data locally, and you can refresh it to keep AI access up to date.

How to use

You work with an MCP client to connect to Apifox MCP Server and enable AI-assisted development against your API docs. The server reads the entire Apifox project’s interface data and caches it on your local machine, so AI tools inside your IDE can access all documented APIs.

How to install

Prerequisites: you need Node.js installed (version 18 or newer, with the latest LTS recommended) and an MCP-capable IDE such as Cursor or VSCode with the Cline extension.

Install and configure the MCP server by following these steps. Use the exact commands and replace placeholders with your own values.

{
  "mcpServers": {
    "API 文档": {
      "command": "npx",
      "args": [
        "-y",
        "apifox-mcp-server@latest",
        "--project-id=<project-id>"
      ],
      "env": {
        "APIFOX_ACCESS_TOKEN": "<access-token>"
      }
    }
  }
}

Additional setup notes

If you are on Windows and the first config doesn’t work, use the Windows-specific setup shown here.

{
  "mcpServers": {
    "API 文档": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "apifox-mcp-server@latest",
        "--project-id=<project-id>"
      ],
      "env": {
        "APIFOX_ACCESS_TOKEN": "<access-token>"
      }
    }
  }
}

Notes and recommendations

- Replace <access-token> with your personal Apifox API access token and <project-id> with your Apifox project ID. MCP Server names should include the phrase API 文档 to help AI identify the server’s purpose. If you work with multiple Apifox projects, you can add multiple MCP Server configurations, each with its own <project-id>.

- If you plan to include environment-wide usage, you can configure APIFOX_ACCESS_TOKEN as an environment variable on each machine to avoid leaking tokens in shared config files.

- For private deployments, add the base URL parameter to the MCP config: --apifox-api-base-url=http(s)://your-private-api-host . Ensure your network can access npmjs.com for package retrieval.

- You can also read Swagger/OAS files directly by replacing the project ID parameter with --oas <oas-url-or-path> in your MCP command.

Troubleshooting and tips

If your API data updates in Apifox, remember to refresh the interface data in the AI tooling so that the latest docs are used by the AI.