Apifox MCP Server
Allows management of Apifox projects, including API endpoints (list, get, create, update, delete), data models (schemas), folders, tags, and API definition integrity checks.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Apifox MCP Serverlist all API endpoints in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Apifox MCP Server
这是一个基于 Model Context Protocol (MCP) 的服务器,用于通过 LLM (如 Claude) 直接管理 Apifox 项目。
它允许你通过自然语言指令来查看、创建、更新和删除 Apifox 中的 API 接口、数据模型 (Schema)、文件夹等,并能检查 API 定义的完整性。
✨ 功能特性
API 接口管理:
列出接口 (
list_api_endpoints)获取接口详情 (
get_api_endpoint_detail)创建接口 (
create_api_endpoint) - 自动处理标准错误响应更新接口 (
update_api_endpoint)删除接口 (
delete_api_endpoint)接口完整性检查 (
check_api_responses,audit_all_api_responses)
数据模型 (Schema) 管理:
列出模型 (
list_schemas)获取模型详情 (
get_schema_detail)创建模型 (
create_schema)更新模型 (
update_schema)删除模型 (
delete_schema)
其他管理:
目录管理 (
list_folders,create_folder,delete_folder)标签管理 (
list_tags)按标签获取接口 (
get_apis_by_tag,add_tag_to_api)配置检查 (
check_apifox_config)
Related MCP server: Apifox MCP
🛠️ 安装
确保你的系统中已安装 Python 3.10 或更高版本。
克隆项目
git clone <repository_url> cd <repository_name>创建并激活虚拟环境 (可选但推荐)
使用 uv
uv venv # 激活虚拟环境 # Windows .venv\Scripts\activate # macOS/Linux source .venv/bin/activate使用 venv
python -m venv .venv # Windows .venv\Scripts\activate # macOS/Linux source .venv/bin/activate安装依赖
本项目支持使用 uv (推荐用于本地开发) 或 pip 来安装依赖。
使用 uv (推荐,更快的本地开发)
# 安装 uv (如果尚未安装) curl -LsSf https://astral.sh/uv/install.sh | sh # 安装依赖 uv sync # 运行 MCP server uv run python -m apifox_mcp.main使用 pip (传统方式)
pip install mcp[cli] requests # 运行 MCP server python -m apifox_mcp.main
⚙️ 配置
在使用前,你需要设置以下环境变量来连接你的 Apifox 项目。
环境变量 | 描述 | 获取方式 |
| Apifox 开放 API 令牌 | Apifox 客户端 -> 账号设置 -> API 访问令牌 |
| 目标项目 ID | 项目概览页 -> 项目设置 -> 基本设置 -> ID |
重点⚠️
APIFOX_TOKEN获取方式
APIFOX_PROJECT_ID获取方式
设置项目文档为公开
ps:我实际使用发现只有设置为文档发布才能正常操作项目
⚙️ 配置
在使用前,你需要获取以下凭证来连接你的 Apifox 项目。
环境变量 | 描述 | 获取方式 |
| Apifox 开放 API 令牌 | Apifox 客户端 -> 账号设置 -> API 访问令牌 |
| 目标项目 ID | 项目概览页 -> 项目设置 -> 基本设置 -> ID |
🐳 使用方法 (Docker)
方法一:从源码构建
git clone https://github.com/iwen-conf/apifox-mcp.git
cd apifox-mcp
docker build -t apifox-mcp .方法二:使用预构建镜像
从 Releases 下载 apifox-mcp.tar,然后加载:
docker load -i apifox-mcp.tar配置 Claude Desktop
编辑 Claude Desktop 的配置文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
方式一:使用 Docker (推荐用于生产环境)
{
"mcpServers": {
"apifox": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e", "APIFOX_TOKEN",
"-e", "APIFOX_PROJECT_ID",
"apifox-mcp"
],
"env": {
"APIFOX_TOKEN": "your_token_here",
"APIFOX_PROJECT_ID": "your_project_id_here"
}
}
}
}方式二:使用 uv (推荐用于本地开发)
{
"mcpServers": {
"apifox": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/apifox-mcp",
"python",
"-m",
"apifox_mcp.main"
],
"env": {
"APIFOX_TOKEN": "your_token_here",
"APIFOX_PROJECT_ID": "your_project_id_here"
}
}
}
}注意:
请将
your_token_here和your_project_id_here替换为你的实际凭证使用 uv 方式时,请将
/path/to/apifox-mcp替换为实际的项目路径
3. 命令行运行 (可选)
你也可以直接在命令行中测试:
# 使用环境变量
docker run -i --rm \
-e APIFOX_TOKEN=your_token \
-e APIFOX_PROJECT_ID=your_project_id \
apifox-mcp
# 或者使用 .env 文件
docker run -i --rm --env-file .env apifox-mcp📝 编写规范
本工具在创建和更新接口时强制执行以下规范,以确保文档质量:
中文描述: 必须提供中文的
title和description。完整 Schema:
response_schema和request_body_schema中的每个字段必须包含description。真实示例: 示例数据 (
example) 必须是真实值,不能是简单的类型占位符 (如 "string")。错误响应: 系统会自动为你补充标准的 4xx/5xx 错误响应,无需手动定义。
🤝 贡献
欢迎提交 Issue 和 Pull Request!
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/iwen-conf/apifox-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server