Metadata-Version: 2.4
Name: apifox-mcp-community
Version: 3.0.1
Summary: Apifox MCP Server v3 — 基于 MCP 协议的 Apifox API 管理工具，支持动态工具注册
Author: ChenShi
License: MIT
Keywords: api,apifox,mcp,model-context-protocol
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp>=1.0.0
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# Apifox MCP Community

基于 MCP 协议的 Apifox API 管理工具。

- 🧩 **80+ MCP 工具**，覆盖 **13 个功能域**
- ⚡ **多维工具激活** — 按域 / 按权限 / 按工具名灵活加载
- 📦 `pip install` 即用，无需手动配置路径

> ⚠️ **本项目非 Apifox 官方 MCP。** 项目 API 信息来源于官方 MCP 工具与个人实践总结。官方工具请访问 [Apifox 官方 MCP](https://docs.apifox.com/8395000m0)。

---

## 📦 安装

**要求**：Python 3.11+

```bash
pip install apifox-mcp-community
```

安装后在 MCP 客户端中填入 [下方配置](#️-配置文件)。

---

## ⚙️ 配置文件

> - 实际使用时请删除 JSON 中的注释。
> - 实测可在Claude code以及Trae中正常使用，若其他Code Agent中启动失败请让Ai改为兼容的格式。
```jsonc
{
  "mcpServers": {
    "apifox_mcp_community": {
      "command": "python",
      "args": ["-m", "apifox_mcp.main"],
      "env": {
        "APIFOX_TOKEN": "你的token",
        "APIFOX_PROJECT_ID": "你的项目id",
        "APIFOX_API_VERSION": "2026-05-28",
        "APIFOX_MCP_MODE": "full", // mcp启动模式，决定了模型会加载哪些工具
        "APIFOX_MCP_CLUSTER": "design", // 仅在MODE为cluster时有效
        "APIFOX_PUBLIC_API_BASE": "https://api.apifox.com",
        "APIFOX_MCP_TOOL_TIMEOUT": "10.0", // 工具超时时间，防止mcp内部问题无法返回阻塞对话
        "APIFOX_HTTP_TIMEOUT": "30.0",
        "APIFOX_MAX_RETRIES": "2",
        "APIFOX_AI_BRANCH": "" // Ai-branch名称，为空则默认不开启，编辑直接在main分支进行
        // 实际使用时请删除以上注释
      }
    }
  }
}
```

---

## 获取认证信息

### Token
进入 Apifox → 右上角头像 → 账号设置 → API 访问令牌 → 新建

### 项目 ID
项目设置 → 通用设置 → 点击项目 ID 即可复制

---

## 启动模式

> 详细工具清单见 [GitHub 仓库](https://github.com/{your-username}/apifox-mcp-community) `docs/modes/`

### Full（默认）
全量加载 80+ 工具。约 **20k token** 上下文。

### Dynamic
启动时加载 9 个核心工具，AI 按需激活后续功能域：
```python
activate_domain("http_api", readonly=True)
```

### Cluster
预设工作流环境，工具集 session 内不变，零缓存失效。

| 集群 | 包含域 | 用途 |
|------|--------|------|
| **design** | http_api / schema / response / doc / environment | 搭建 API 文档体系 |
| **testing** | test_case / test_scenario / test_report + 只读域 | 编写测试用例并审查 |
| **review** | 全部 13 个域（只读） | 审查项目，零写入风险 |
| **platform** | custom_endpoint / websocket / environment / global_param | 管理环境与平台参数 |

---



---

## License

MIT © ChenShi

详见 [GitHub 仓库](https://github.com/ChenShiLX/apifox-mcp-community)。
