Apifox MCP server

Bridges Claude with Apifox API testing platform, enabling direct interaction with API documentation and testing capabilities through environment variable authentication and TypeScript/Express implementation.
Back to servers
Provider
Wang Min
Release date
Mar 21, 2025
Language
TypeScript
Package
Stats
1.1K downloads
1 star

The ApiFox MCP Server is a service that integrates with Cursor via the Model Context Protocol (MCP) to provide access to ApiFox interface information. This allows large language models to utilize your API documentation when helping you implement business logic in Cursor.

Installation Options

Quick Start with NPX

The fastest way to get started is using npx:

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

Installing from Source

If you prefer to install from source:

pnpm install
pnpm build
pnpm start:http

Configuration

Environment Variables

You can configure the server using environment variables. Create a .env file in the project root by copying .env.example:

APIFOX_API_KEY=your_api_key_here
PROJECT_ID=your_project-ID
PORT=3000  # Optional, defaults to 3000

Connecting to Cursor

Using SSE Connection

To connect Cursor to the MCP server using SSE, add the following to your Cursor MCP configuration:

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

Using Command Configuration (Recommended)

For a more complete setup, use the command configuration approach:

"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>"
  }
}

Running from Local Build

If running the server from a local build:

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

Technical Details

The server leverages several technologies:

  • Node.js and TypeScript for type-safe development
  • Express.js for HTTP service handling
  • Model Context Protocol SDK for integration
  • Zod for data validation

The server runs on port 3000 by default but can be configured using the PORT environment variable.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later