{"id":46732164,"url":"https://github.com/iwen-conf/apifox-mcp","last_synced_at":"2026-03-09T15:33:41.670Z","repository":{"id":329057810,"uuid":"1117670687","full_name":"iwen-conf/apifox-mcp","owner":"iwen-conf","description":"Apifox MCP 服务器 - 让 Claude 等 AI 助手通过自然语言管理你的 Apifox 项目，轻松创建、更新和审计 API 接口","archived":false,"fork":false,"pushed_at":"2025-12-18T07:49:41.000Z","size":142,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-20T17:21:29.933Z","etag":null,"topics":["ai-tools","api-documentation","apifox","docker","mcp","model-context-protocol"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iwen-conf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-16T16:38:19.000Z","updated_at":"2025-12-20T06:23:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iwen-conf/apifox-mcp","commit_stats":null,"previous_names":["iwen-conf/apifox-mcp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/iwen-conf/apifox-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwen-conf%2Fapifox-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwen-conf%2Fapifox-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwen-conf%2Fapifox-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwen-conf%2Fapifox-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwen-conf","download_url":"https://codeload.github.com/iwen-conf/apifox-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwen-conf%2Fapifox-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30301109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","api-documentation","apifox","docker","mcp","model-context-protocol"],"created_at":"2026-03-09T15:33:41.000Z","updated_at":"2026-03-09T15:33:41.650Z","avatar_url":"https://github.com/iwen-conf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apifox MCP Server\n\n[![Python](https://img.shields.io/badge/Python-3.10%2B-blue?logo=python\u0026logoColor=white)](https://www.python.org/)\n[![uv](https://img.shields.io/badge/uv-Compatible-purple?logo=python\u0026logoColor=white)](https://docs.astral.sh/uv/)\n[![MCP](https://img.shields.io/badge/MCP-Compatible-green?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyek0xMiAyMGMtNC40MSAwLTgtMy41OS04LThzMy41OS04IDgtOCA4IDMuNTkgOCA4LTMuNTkgOC04IDh6Ii8+PC9zdmc+)](https://modelcontextprotocol.io/)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![Apifox](https://img.shields.io/badge/Apifox-Integration-orange?logo=swagger\u0026logoColor=white)](https://apifox.com/)\n\n---\n\n这是一个基于 [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) 的服务器，用于通过 LLM (如 Claude) 直接管理 [Apifox](https://apifox.com/) 项目。\n\n它允许你通过自然语言指令来查看、创建、更新和删除 Apifox 中的 API 接口、数据模型 (Schema)、文件夹等，并能检查 API 定义的完整性。\n\n## ✨ 功能特性\n\n*   **API 接口管理**:\n    *   列出接口 (`list_api_endpoints`)\n    *   获取接口详情 (`get_api_endpoint_detail`)\n    *   创建接口 (`create_api_endpoint`) - 自动处理标准错误响应\n    *   更新接口 (`update_api_endpoint`)\n    *   删除接口 (`delete_api_endpoint`)\n    *   接口完整性检查 (`check_api_responses`, `audit_all_api_responses`)\n*   **数据模型 (Schema) 管理**:\n    *   列出模型 (`list_schemas`)\n    *   获取模型详情 (`get_schema_detail`)\n    *   创建模型 (`create_schema`)\n    *   更新模型 (`update_schema`)\n    *   删除模型 (`delete_schema`)\n*   **其他管理**:\n    *   目录管理 (`list_folders`, `create_folder`, `delete_folder`)\n    *   标签管理 (`list_tags`)\n    *   按标签获取接口 (`get_apis_by_tag`, `add_tag_to_api`)\n    *   配置检查 (`check_apifox_config`)\n\n## 🛠️ 安装\n\n确保你的系统中已安装 Python 3.10 或更高版本。\n\n1.  **克隆项目**\n    ```bash\n    git clone \u003crepository_url\u003e\n    cd \u003crepository_name\u003e\n    ```\n\n2.  **创建并激活虚拟环境 (可选但推荐)**\n\n    **使用 uv**\n    ```bash\n    uv venv\n    # 激活虚拟环境\n    # Windows\n    .venv\\Scripts\\activate\n    # macOS/Linux\n    source .venv/bin/activate\n    ```\n\n    **使用 venv**\n    ```bash\n    python -m venv .venv\n    # Windows\n    .venv\\Scripts\\activate\n    # macOS/Linux\n    source .venv/bin/activate\n    ```\n\n3.  **安装依赖**\n\n    本项目支持使用 [uv](https://docs.astral.sh/uv/) (推荐用于本地开发) 或 pip 来安装依赖。\n\n    **使用 uv (推荐，更快的本地开发)**\n    ```bash\n    # 安装 uv (如果尚未安装)\n    curl -LsSf https://astral.sh/uv/install.sh | sh\n    \n    # 安装依赖\n    uv sync\n    \n    # 运行 MCP server\n    uv run python -m apifox_mcp.main\n    ```\n\n    **使用 pip (传统方式)**\n    ```bash\n    pip install mcp[cli] requests\n    \n    # 运行 MCP server\n    python -m apifox_mcp.main\n    ```\n\n## ⚙️ 配置\n\n在使用前，你需要设置以下环境变量来连接你的 Apifox 项目。\n\n| 环境变量 | 描述 | 获取方式 |\n| :--- | :--- | :--- |\n| `APIFOX_TOKEN` | Apifox 开放 API 令牌 | Apifox 客户端 -\u003e 账号设置 -\u003e API 访问令牌 |\n| `APIFOX_PROJECT_ID` | 目标项目 ID | 项目概览页 -\u003e 项目设置 -\u003e 基本设置 -\u003e ID |\n\n## 重点⚠️\n### APIFOX_TOKEN获取方式\n\u003cimg width=\"1594\" height=\"1029\" alt=\"截屏2025-12-17 01 58 51\" src=\"https://github.com/user-attachments/assets/aad5da36-a99d-484b-959c-116918897487\" /\u003e\n\n\n### APIFOX_PROJECT_ID获取方式\n\n\u003cimg width=\"2032\" height=\"1167\" alt=\"截屏2025-12-17 01 57 06\" src=\"https://github.com/user-attachments/assets/a381baf8-7da0-4d88-950c-ac8b78c7af8d\" /\u003e\n\n\n### 设置项目文档为公开\nps:我实际使用发现只有设置为文档发布才能正常操作项目\n\n \u003cimg width=\"1594\" height=\"1029\" alt=\"截屏2025-12-17 01 55 12\" src=\"https://github.com/user-attachments/assets/59cb26ea-26af-47a4-8329-aabe4ec63bce\" /\u003e\n\n\n\n## ⚙️ 配置\n\n在使用前，你需要获取以下凭证来连接你的 Apifox 项目。\n\n| 环境变量 | 描述 | 获取方式 |\n| :--- | :--- | :--- |\n| `APIFOX_TOKEN` | Apifox 开放 API 令牌 | Apifox 客户端 -\u003e 账号设置 -\u003e API 访问令牌 |\n| `APIFOX_PROJECT_ID` | 目标项目 ID | 项目概览页 -\u003e 项目设置 -\u003e 基本设置 -\u003e ID |\n\n## 🐳 使用方法 (Docker)\n\n### 方法一：从源码构建\n\n```bash\ngit clone https://github.com/iwen-conf/apifox-mcp.git\ncd apifox-mcp\ndocker build -t apifox-mcp .\n```\n\n### 方法二：使用预构建镜像\n\n从 [Releases](https://github.com/iwen-conf/apifox-mcp/releases) 下载 `apifox-mcp.tar`，然后加载：\n\n```bash\ndocker load -i apifox-mcp.tar\n```\n\n### 配置 Claude Desktop\n\n编辑 Claude Desktop 的配置文件：\n- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n- **Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n#### 方式一：使用 Docker (推荐用于生产环境)\n\n```json\n{\n  \"mcpServers\": {\n    \"apifox\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-e\", \"APIFOX_TOKEN\",\n        \"-e\", \"APIFOX_PROJECT_ID\",\n        \"apifox-mcp\"\n      ],\n      \"env\": {\n        \"APIFOX_TOKEN\": \"your_token_here\",\n        \"APIFOX_PROJECT_ID\": \"your_project_id_here\"\n      }\n    }\n  }\n}\n```\n\n#### 方式二：使用 uv (推荐用于本地开发)\n\n```json\n{\n  \"mcpServers\": {\n    \"apifox\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"run\",\n        \"--directory\",\n        \"/path/to/apifox-mcp\",\n        \"python\",\n        \"-m\",\n        \"apifox_mcp.main\"\n      ],\n      \"env\": {\n        \"APIFOX_TOKEN\": \"your_token_here\",\n        \"APIFOX_PROJECT_ID\": \"your_project_id_here\"\n      }\n    }\n  }\n}\n```\n\n\u003e **注意**: \n\u003e - 请将 `your_token_here` 和 `your_project_id_here` 替换为你的实际凭证\n\u003e - 使用 uv 方式时，请将 `/path/to/apifox-mcp` 替换为实际的项目路径\n\n### 3. 命令行运行 (可选)\n\n你也可以直接在命令行中测试：\n\n```bash\n# 使用环境变量\ndocker run -i --rm \\\n  -e APIFOX_TOKEN=your_token \\\n  -e APIFOX_PROJECT_ID=your_project_id \\\n  apifox-mcp\n\n# 或者使用 .env 文件\ndocker run -i --rm --env-file .env apifox-mcp\n```\n\n## 📝 编写规范\n\n本工具在创建和更新接口时强制执行以下规范，以确保文档质量：\n\n1.  **中文描述**: 必须提供中文的 `title` 和 `description`。\n2.  **完整 Schema**: `response_schema` 和 `request_body_schema` 中的每个字段必须包含 `description`。\n3.  **真实示例**: 示例数据 (`example`) 必须是真实值，不能是简单的类型占位符 (如 \"string\")。\n4.  **错误响应**: 系统会自动为你补充标准的 4xx/5xx 错误响应，无需手动定义。\n\n## 🤝 贡献\n\n欢迎提交 Issue 和 Pull Request！\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwen-conf%2Fapifox-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwen-conf%2Fapifox-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwen-conf%2Fapifox-mcp/lists"}