Skip to main content
Glama
apifox-import-mcp

apifox-import-mcp

by hexonal

apifox-import-mcp

A Model Context Protocol (MCP) server for importing OpenAPI documents to Apifox.

Features

  • Import OpenAPI to Apifox: Directly import OpenAPI YAML/JSON files to your Apifox project

  • Validate OpenAPI Files: Validate and extract statistics from OpenAPI documents

  • Easy Configuration: Configure via environment variables in .mcp.json

  • Async Operations: Built with async/await for optimal performance

  • Error Handling: Comprehensive error messages for troubleshooting

Related MCP server: APIMatic Validator MCP Server

Installation

uvx apifox-import-mcp

Using pip

pip install apifox-import-mcp

From Source

git clone https://github.com/hexonal/apifox-import-mcp.git
cd apifox-import-mcp
pip install -e .

Configuration

Add to your .mcp.json:

{
  "mcpServers": {
    "apifox-import": {
      "command": "uvx",
      "args": ["apifox-import-mcp"],
      "env": {
        "APIFOX_PROJECT_ID": "your-project-id",
        "APIFOX_ACCESS_TOKEN": "your-access-token"
      }
    }
  }
}

Environment Variables

Variable

Required

Description

Default

APIFOX_PROJECT_ID

Yes

Apifox project ID

-

APIFOX_ACCESS_TOKEN

Yes

Apifox access token

-

APIFOX_API_BASE

No

API base URL

https://api.apifox.com/api/v1

Tools

import_openapi

Import OpenAPI document to Apifox project.

Parameters:

  • file_path (required): Absolute path to OpenAPI YAML/JSON file

  • delete_unmatched (optional): Whether to delete unmatched resources (default: true)

  • api_overwrite_mode (optional): API overwrite mode (default: "methodAndPath")

    • Options: "methodAndPath", "ignore", "all"

  • schema_overwrite_mode (optional): Schema overwrite mode (default: "title")

    • Options: "title", "ignore", "all"

Returns:

{
  "status": "success",
  "data": {
    "api": {
      "created": 5,
      "updated": 2,
      "errors": 0,
      "ignored": 0
    },
    "folder": {
      "created": 3,
      "updated": 1
    }
  }
}

Example Usage:

User: Import the OpenAPI file at /path/to/openapi.yaml to Apifox
Claude: Calling import_openapi tool...

validate_openapi

Validate OpenAPI file and extract statistics.

Parameters:

  • file_path (required): Absolute path to OpenAPI YAML/JSON file

Returns:

{
  "status": "success",
  "data": {
    "file": "/path/to/openapi.yaml",
    "size": "25.3 KB",
    "format": "YAML",
    "version": "3.0.3",
    "endpoints": 5,
    "schemas": 12,
    "tags": ["Tag1", "Tag2"]
  }
}

Example Usage:

User: Validate the OpenAPI file at /path/to/openapi.yaml
Claude: Calling validate_openapi tool...

Troubleshooting

Error: "APIFOX_PROJECT_ID not set"

Make sure your .mcp.json includes the APIFOX_PROJECT_ID environment variable.

Error: "File not found: /path/to/file.yaml"

Verify the file path is correct and the file exists. Use absolute paths, not relative paths.

Error: "Invalid OpenAPI format"

Ensure your file is valid YAML or JSON and conforms to the OpenAPI specification.

Error: "HTTP 401: Invalid access token"

Check that your APIFOX_ACCESS_TOKEN is correct and has not expired.

Error: "HTTP 404: Project not found"

Verify your APIFOX_PROJECT_ID is correct.

Development

Setup

git clone https://github.com/hexonal/apifox-import-mcp.git
cd apifox-import-mcp
pip install -e ".[dev]"

Run Tests

pytest tests/ -v

Code Formatting

black .
isort .

Type Checking

mypy apifox_import_mcp/

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to automatically manage Apifox API documentation by importing OpenAPI/Swagger specifications and exporting existing API structures. Supports batch operations, intelligent deprecation marking, and smart scope detection for partial module imports.
      2
      3
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables validation of OpenAPI 2.0 and 3.0 specifications in JSON or YAML format using APIMatic's comprehensive API validation service through the Model Context Protocol.
      1
      7
      ISC
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables users to import OpenAPI 3 and Swagger 2 formatted JSON data directly into Apifox projects. It provides a tool for automating API documentation management and synchronization through Model Context Protocol clients.
      -