Apifox MCP server

Integrates with Apifox to provide access to API documentation, enabling developers to extract project details and fetch API information using authentication tokens via stdio transport.
Back to servers
Provider
sujianqingfeng
Release date
Feb 20, 2025
Language
TypeScript
Package
Stats
420 downloads

This MCP server serves as a bridge between Apifox (an API development and testing platform) and AI assistants that support the Model Context Protocol. It allows AI assistants to extract information from Apifox API documentation, making it easier to understand and use APIs during development.

Installation

You can install the MCP-Apifox server globally using npm or pnpm:

# Install globally with npm
npm install -g mcp-apifox

# Or with pnpm
pnpm add -g mcp-apifox

Configuration

You have two options to configure the MCP server:

Option 1: Using Environment Variables

{
  "mcpServers": {
    "apifox": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-apifox@latest"
      ],
      "env": {
        "APIFOX_ACCESS_TOKEN": "your_access_token_here"
      }
    }
  }
}

Option 2: Using Command Line Arguments

{
  "mcpServers": {
    "apifox": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-apifox@latest",
        "--token=your_access_token_here"
      ]
    }
  }
}

Usage

To retrieve interface information, you'll need to use a collaboration link with maintainer permissions:

https://app.apifox.com/link/project/${projectId}/apis/api-${apiId}

Available Tools

The MCP server provides two main tools:

get-apifox-project-id-and-api-id-from-url

This tool extracts the project ID and API ID from an Apifox URL.

Input:

  • text: A string containing an Apifox URL or path

Output:

  • A JSON object containing projectId and apiId

get-apifox-api-info

This tool retrieves detailed API information from Apifox.

Input:

  • projectId: The Apifox project ID
  • apiId: The Apifox API ID

Output:

  • The OpenAPI specification for the requested API

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