Home / MCP / ApiFox MCP Server

ApiFox MCP Server

An MCP-based ApiFox server that fetches and manages ApiFox interfaces.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "apifox_http": {
            "url": "http://localhost:3000/sse"
        }
    }
}

You set up an MCP-based ApiFox server that exposes ApiFox interface data over an MCP connection. This server lets you fetch and manage ApiFox interfaces, then share them with large language models or automation pipelines through an MCP client using HTTP SSE or a local runtime.

How to use

Connect your MCP client to the ApiFox MCP Server using SSE. The server runs on a configured port (default 3000) and streams interface information to your client for use in your business logic. You can run the server via HTTP mode or via a local runtime so that your application can request ApiFox data as needed.

How to install

Prerequisites: Node.js (recommended latest LTS) and npm or pnpm. You will also need access to your ApiFox API key and your ApiFox project ID.

Option A: Quick install and run with npx (HTTP server)

npx @wangmhaha/apifox-mcp-server@latest --apifox-api-key=<your-apifox-api-key> --project=<your-project-id>

Configure Cursor to connect via SSE to the MCP server using the default port (3000).

"apifox-mcp-server": {
    "url": "http://localhost:3000/sse",
  }

Option B: Run from a configuration file using local commands (HTTP mode)

"apifox-mcp-server": {
   "command": "npx",
   "args": ["-y", "@wangmhaha/apifox-mcp-server@latest", "--local"],
   "env": {
     "APIFOX_API_KEY": "<your-apifox-api-key>",
     "PROJECT_ID": "<your-project-id>"
   }
}

Option C: Run locally from source (build and start)

pnpm install
pnpm build
pnpm start:http

Then configure the local HTTP SSE endpoint as above, pointing to http://localhost:3000/sse, and include your ApiFox credentials in the environment variables.

Additional configuration and run options

If you choose to run from local sources, you can also start using a direct Node runtime with a local build artifact.

"apifox-mcp-server": {
  "command": "node",
  "args": ["<you-local-path>/build/index.js", "--local"],
  "env": {
    "APIFOX_API_KEY": "<your-apifox-api-key>",
    "PROJECT_ID": "<your-project-id>"
  }
}

Environment variables and configuration notes

The following environment variables are used by the server. You can set them in your OS environment or in the server/CLI configuration blocks shown above.

APIFOX_API_KEY=your_api_key_here
PROJECT_ID=your_project_ID
PORT=3000  # optional, defaults to 3000

Technical stack

This server is built with Node.js and TypeScript, runs on Express.js, and uses the Model Context Protocol SDK for MCP interactions. It also uses Zod for data validation.

License

ISC License

Available tools

HTTP service

Exposes an HTTP SSE endpoint for MCP clients to subscribe to and receive ApiFox interface data.

CLI integration

Supports running via CLI commands and scriptable configurations for automation.

Type-safe development

Uses TypeScript for type safety across server code and MCP interfaces.

Environment-driven config

Reads credentials and project parameters from environment variables for flexible deployments.

MCP SDK integration

Leverages the Model Context Protocol SDK to conform to MCP data models and exchange.