Code-to-ApiFox

Provides Swagger specification generation and ApiFox integration via STDIO and HTTP MCP interfaces.
  • javascript

1

GitHub Stars

javascript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "xzg0919-code-to-apifox-mcp": {
      "command": "code-to-apifox-mcp",
      "args": [
        "--stdio"
      ]
    }
  }
}

You run a Node.js MCP server that generates Swagger documentation and streams it into ApiFox. It supports both STDIO and HTTP connections, lets you manage ApiFox credentials via a config file, and provides a straightforward way to obtain Swagger specifications and publish them to ApiFox from your AI assistants or development environment.

How to use

You can use this MCP server in two modes: STDIO mode for local, script-driven workflows and HTTP mode to expose a small API surface for automation. In STDIO mode, you run the MCP client as a local process that your AI assistant or orchestration code can connect to. In HTTP mode, you start a server that listens for tool requests and responds with Swagger specs or ApiFox upload results.

Primary workflows you can perform: obtain a ready-to-use Swagger specification, and upload that Swagger to ApiFox using project credentials. You can also supply your own Swagger JSON to upload via explicit parameters.

How to install

Prerequisites: ensure you have Node.js 18 or newer and npm installed.

Global installation (recommended):

npm install -g code-to-apifox-mcp

# STDIO client mode
code-to-apifox-mcp --stdio

# HTTP service mode
code-to-apifox-mcp

Temporary usage without installation:

npx code-to-apifox-mcp --stdio
npx code-to-apifox-mcp

Local development from source (if you clone the project):

git clone https://github.com/xzg0919/code-to-apifox-mcp.git
cd code-to-apifox-mcp

# Install dependencies
npm install

# Development servers
npm run dev:stdio    # STDIO模式
npm run dev          # HTTP模式

Additional sections

Configuration and credentials are managed through a configuration file and optional environment variables. Create a default configuration file at the project root with your ApiFox project details to streamline uploads.

Normal startup details and health checks are available for both modes. The local HTTP service listens on port 3033 by default, and you can verify health with a dedicated health endpoint.

You can integrate the server into a supporting AI assistant by configuring an MCP client entry that launches the MCP server in STDIO mode, enabling the assistant to request a Swagger specification and upload it to ApiFox.

If you prefer programmatic usage inside a Node.js project, you can instantiate the SwaggerUploadService with a configuration that points to ApiFox endpoints, then call methods to get the Swagger specification or upload it to ApiFox.

Common items to configure include the ApiFox base URL and API version, as well as project IDs and access tokens used for authentication.

Swagger tools and endpoints

The server exposes a few key capabilities: obtaining a standardized Swagger specification and uploading that specification to ApiFox. These tools are available via both STDIO and HTTP interfaces, depending on how you run the server.

Available tools

getSwaggerSpecification

Fetches a standard Swagger JSON specification sample that demonstrates the full Petstore example and explains best practices. Returns a complete Swagger/OpenAPI template for learning and templating API docs.

uploadSwaggerToApiFox

Uploads a Swagger JSON string to ApiFox using a specified projectId and accessToken, returning the result details of the upload.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
Code-to-ApiFox MCP Server - xzg0919/code-to-apifox-mcp | VeilStrat