经 AI Skill Hub 精选评估,mcp-context-forge MCP工具 获评「强烈推荐」。已获得 3.7k 颗 GitHub Star,这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 8.2 分,适合有一定技术背景的用户使用。
mcp-context-forge MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
mcp-context-forge MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/IBM/mcp-context-forge
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"mcp-context-forge-mcp--": {
"command": "npx",
"args": ["-y", "mcp-context-forge"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 mcp-context-forge MCP工具 执行以下任务... Claude: [自动调用 mcp-context-forge MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"mcp-context-forge_mcp__": {
"command": "npx",
"args": ["-y", "mcp-context-forge"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
An open source registry and proxy that federates MCP, A2A, and REST/gRPC APIs with centralized governance, discovery, and observability. Optimizes Agent & Tool calling, and supports plugins.

ContextForge is an open source registry and proxy that federates tools, agents, and APIs into one clean endpoint for your AI clients. It provides centralized governance, discovery, and observability across your AI infrastructure:
It runs as a fully compliant MCP server, deployable via PyPI or Docker, and scales to multi-cluster environments on Kubernetes with Redis-backed federation and caching.
ContextForge is an open source registry and proxy that federates any Model Context Protocol (MCP) server, A2A server, or REST/gRPC API, providing centralized governance, discovery, and observability. It optimizes agent and tool calling, and supports plugins. See the project roadmap for more details.
It currently supports:
For a list of upcoming features, check out the ContextForge Roadmap
---
<details> <summary><strong>🔌 Gateway Layer with Protocol Flexibility</strong></summary>
2025-11-25)</details>
<details> <summary><strong>🧩 Virtualization of REST/gRPC Services</strong></summary>
</details>
<details> <summary><strong>🔁 REST-to-MCP Tool Adapter</strong></summary>
</details>
<details> <summary><strong>🧠 Unified Registries</strong></summary>
</details>
<details> <summary><strong>📈 Admin UI, Observability & Dev Experience</strong></summary>
</details>
<details> <summary><strong>🔍 OpenTelemetry Observability</strong></summary>
See Observability Documentation for setup guides with Phoenix, Jaeger, and other backends.
</details>
---
Connection URL format:bash DATABASE_URL=postgresql+psycopg://user:password@localhost:5432/mcp
Quick Postgres container:bash docker run --name mcp-postgres \ -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=mysecretpassword \ -e POSTGRES_DB=mcp -p 5432:5432 -d postgres ```
</details>
---
```bash
mkdir mcpgateway && cd mcpgateway python3 -m venv .venv && source .venv/bin/activate pip install --upgrade pip pip install mcp-contextforge-gateway
mkdir mcpgateway ; cd mcpgateway python3 -m venv .venv ; .\.venv\Scripts\Activate.ps1 pip install --upgrade pip pip install mcp-contextforge-gateway
mkdir mcpgateway ; cd mcpgateway uv venv .\.venv\Scripts\activate uv pip install mcp-contextforge-gateway
python3 -m mcpgateway.translate \ --stdio "docker run --rm -i ghcr.io/ibm/fast-time-server:latest -transport=stdio" \ --expose-sse \ --port 8003
Important:docker compose up -ddoes not build the gateway image locally by default — it uses the pre-built image from GHCR. The compose file includes abuild:block as a fallback, but local builds require a hermetic wheel closure that is only produced by the CI pipeline. If you see acryptographyor dependency resolution error during build, you are hitting this — just pull the image instead (step 2 below handles this automatically). You also must have a.envfile with real secrets before runningdocker compose up -d. The gateway will not start with placeholder values.
Get a full stack running with PostgreSQL and Redis:
```bash
docker pull ghcr.io/ibm/mcp-context-forge:latest echo 'IMAGE_LOCAL=ghcr.io/ibm/mcp-context-forge:latest' >> .env
docker compose build nginx
kubectl get pods -l app.kubernetes.io/name=mcp-context-forge
```bash
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token \ --username admin@example.com --exp 10080 --secret "${JWT_SECRET_KEY}") export MCP_AUTH="Bearer ${MCPGATEWAY_BEARER_TOKEN}" export MCP_SERVER_URL='http://localhost:4444/servers/UUID_OF_SERVER_1/mcp' export MCP_TOOL_CALL_TIMEOUT=120 export MCP_WRAPPER_LOG_LEVEL=DEBUG # or OFF to disable logging
docker run --rm -i \ -e MCP_AUTH="${MCP_AUTH}" \ -e MCP_SERVER_URL=http://host.docker.internal:4444/servers/UUID_OF_SERVER_1/mcp \ -e MCP_TOOL_CALL_TIMEOUT=120 \ -e MCP_WRAPPER_LOG_LEVEL=DEBUG \ ghcr.io/ibm/mcp-context-forge:latest \ python3 -m mcpgateway.wrapper ```
</details>
---
make venv install-dev # create .venv + install deps + build Admin UI
make serve # gunicorn on :4444
Rust workspace note: - Workspace-owned Rust crates live under crates/ and are picked up by the root Cargo.toml via crates/*. - Run cargo build, cargo test, and cargo check from the repo root to cover the shared workspace. - make venv install-dev creates the root .venv, which is also reused by the workspace's PyO3/maturin builds.
<details> <summary><strong>Alternative: UV or pip</strong></summary>
```bash
uv pip install 'psycopg[binary]' # dev (pre-built wheels)
These values differ from code defaults to provide a working local/dev setup:
| Variable | Description | Default |
|---|---|---|
HOST | Bind address | 0.0.0.0 |
MCPGATEWAY_UI_ENABLED | Enable Admin UI dashboard | true |
MCPGATEWAY_ADMIN_API_ENABLED | Enable Admin API endpoints | true |
DATABASE_URL | SQLAlchemy connection URL | sqlite:///./mcp.db |
SECURE_COOKIES | Set false for HTTP (non-HTTPS) dev | false |
make compose-up # Start full stack: PostgreSQL, Redis, 3 gateway replicas, Nginx on :8080
make compose-sso # Start SSO stack with Keycloak on :8180
make sso-test-login # Run SSO smoke checks (providers + login URL + test users)
make compose-logs # Tail logs from all services
make compose-down # Stop the stack
ContextForge can be deployed to any major cloud platform:
| Platform | Guide |
|---|---|
| **AWS** | [ECS/EKS Deployment](https://ibm.github.io/mcp-context-forge/deployment/aws/) |
| **Azure** | [AKS Deployment](https://ibm.github.io/mcp-context-forge/deployment/azure/) |
| **Google Cloud** | [Cloud Run](https://ibm.github.io/mcp-context-forge/deployment/google-cloud-run/) |
| **IBM Cloud** | [Code Engine](https://ibm.github.io/mcp-context-forge/deployment/ibm-code-engine/) |
| **Kubernetes** | [Helm Charts](https://ibm.github.io/mcp-context-forge/deployment/minikube/) |
| **OpenShift** | [OpenShift Deployment](https://ibm.github.io/mcp-context-forge/deployment/openshift/) |
For comprehensive deployment guides, see Deployment Documentation.
---
ContextForge is published on PyPI as mcp-contextforge-gateway.
---
⚠️JWT_SECRET_KEYandAUTH_ENCRYPTION_SECRETare required in every environment — including local development. The gateway will not start without them. Generate real secrets withpython3 -m mcpgateway.scripts.init_secretsbefore first run.
TLDR — single command using uv:
```bash
curl -O https://raw.githubusercontent.com/IBM/mcp-context-forge/main/.env.example cp .env.example .env
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/IBM/mcp-context-forge/main/.env.example" -OutFile ".env.example" Copy-Item .env.example .env
curl -s -X POST -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \ -H "Content-Type: application/json" \ -d '{"server":{"name":"time_server","description":"Fast time tools","associated_tools":["6018ca46d32a4ac6b4c054c13a1726a2"]}}' \ http://localhost:4444/servers | jq
Use the official OCI image from GHCR with Docker or Podman. Please note: Currently, arm64 is not supported on production. If you are e.g. running on MacOS with Apple Silicon chips (M1, M2, etc), you can run the containers using Rosetta or install via PyPi instead.
Deploy to Kubernetes with enterprise-grade features:
```bash
python3 -m mcpgateway.scripts.init_secrets
python3 -m mcpgateway.scripts.init_secrets
python3 -m mcpgateway.scripts.init_secrets --patch-env .env
python3 -m mcpgateway.scripts.init_secrets
python3 -m mcpgateway.scripts.init_secrets --patch-env .env
cp .env.example .env python3 -m mcpgateway.scripts.init_secrets --patch-env .env
kubectl exec deployment/mcp-gateway-mcp-context-forge -- \ python3 -m mcpgateway.utils.create_jwt_token \ --username admin@yourcompany.com --exp 10080 --secret "${JWT_SECRET}" ```
SSRF note: Helm defaults to strict SSRF settings (SSRF_ALLOW_PRIVATE_NETWORKS=false). If you register in-cluster tool URLs, allow only your cluster CIDRs viamcpContextForge.config.SSRF_ALLOWED_NETWORKSor, for local-only benchmark setups, temporarily setSSRF_ALLOW_PRIVATE_NETWORKS=true. Seedocs/docs/manage/configuration.md#ssrf-protectionanddocs/docs/deployment/helm.md.
Enterprise Features: - 🔄 Auto-scaling - HPA with CPU/memory targets - 🗄️ Database Choice - PostgreSQL (prod), SQLite (dev) - 📊 Observability - Prometheus metrics, OpenTelemetry tracing - 🔒 Security - RBAC, network policies, secret management - 🚀 High Availability - Multi-replica deployments with Redis clustering - 📈 Monitoring - Built-in Grafana dashboards and alerting
---
python3 -m mcpgateway.scripts.init_secrets export JWT_SECRET_KEY="$(grep '^JWT_SECRET_KEY=' .env.secrets | cut -d= -f2)" export AUTH_ENCRYPTION_SECRET="$(grep '^AUTH_ENCRYPTION_SECRET=' .env.secrets | cut -d= -f2)"
docker run -d --name mcpgateway \ -p 4444:4444 \ -e MCPGATEWAY_UI_ENABLED=true \ -e MCPGATEWAY_ADMIN_API_ENABLED=true \ -e HOST=0.0.0.0 \ -e JWT_SECRET_KEY="${JWT_SECRET_KEY}" \ -e AUTH_ENCRYPTION_SECRET="${AUTH_ENCRYPTION_SECRET}" \ -e AUTH_REQUIRED=true \ -e PLATFORM_ADMIN_EMAIL=admin@example.com \ -e PLATFORM_ADMIN_PASSWORD=<strong-password> \ -e PLATFORM_ADMIN_FULL_NAME="Platform Administrator" \ -e DATABASE_URL=sqlite:///./mcp.db \ -e SECURE_COOKIES=false \ ghcr.io/ibm/mcp-context-forge:latest
⚠️ If any required .env variable is missing or invalid, the gateway will fail fast at startup with a validation error via Pydantic.
Copy the provided .env.example to .env and update the security-sensitive values below.
For the complete list of 300+ environment variables organized by category (authentication, caching, SSO, observability, etc.), see the Configuration Reference.
---
export JWT_SECRET_KEY=$(grep '^JWT_SECRET_KEY=' .env | cut -d= -f2)
npx -y @modelcontextprotocol/inspector
export JWT_SECRET_KEY=$(grep '^JWT_SECRET_KEY=' .env | cut -d= -f2) docker compose exec gateway python3 -m mcpgateway.utils.create_jwt_token \ --username admin@example.com --exp 10080 --secret "$JWT_SECRET_KEY"
**What you get:**
- 🗄️ **PostgreSQL** - Production-ready database with 55+ tables
- 🚀 **ContextForge** - Full-featured gateway with Admin UI
- 📊 **Redis** - High-performance caching and session storage
- 🔧 **Admin Tools** - pgAdmin, Redis Insight for database management
- 🌐 **Nginx Proxy** - Caching reverse proxy on port 8080
**Enable HTTPS (optional):**bash
docker run --rm -it \ -e JWT_SECRET_KEY="${JWT_SECRET_KEY}" \ ghcr.io/ibm/mcp-context-forge:latest \ python3 -m mcpgateway.utils.create_jwt_token \ --username admin@example.com --exp 10080 --secret "${JWT_SECRET_KEY}"
Browse to **[http://localhost:4444/admin](http://localhost:4444/admin)** and login with `PLATFORM_ADMIN_EMAIL` / `PLATFORM_ADMIN_PASSWORD`.
<details>
<summary><strong>Advanced: Persistent storage, host networking, airgapped</strong></summary>
**Persist SQLite database:**bash mkdir -p $(pwd)/data && touch $(pwd)/data/mcp.db && chmod 777 $(pwd)/data docker run -d --name mcpgateway --restart unless-stopped \ -p 4444:4444 -v $(pwd)/data:/data \ -e DATABASE_URL=sqlite:////data/mcp.db \ -e MCPGATEWAY_UI_ENABLED=true -e MCPGATEWAY_ADMIN_API_ENABLED=true \ -e HOST=0.0.0.0 -e JWT_SECRET_KEY="${JWT_SECRET_KEY}" \ -e AUTH_ENCRYPTION_SECRET="${AUTH_ENCRYPTION_SECRET}" \ -e PLATFORM_ADMIN_EMAIL=admin@example.com -e PLATFORM_ADMIN_PASSWORD=<strong-password> \ ghcr.io/ibm/mcp-context-forge:latest
**Host networking** (access local MCP servers):bash docker run -d --name mcpgateway --network=host \ -v $(pwd)/data:/data -e DATABASE_URL=sqlite:////data/mcp.db \ -e MCPGATEWAY_UI_ENABLED=true -e HOST=0.0.0.0 -e PORT=4444 \ -e JWT_SECRET_KEY="${JWT_SECRET_KEY}" -e AUTH_ENCRYPTION_SECRET="${AUTH_ENCRYPTION_SECRET}" \ ghcr.io/ibm/mcp-context-forge:latest
**Airgapped deployment** (no internet):bash docker build -f Containerfile -t mcpgateway:airgapped . docker run -d --name mcpgateway -p 4444:4444 \ -e MCPGATEWAY_UI_AIRGAPPED=true -e MCPGATEWAY_UI_ENABLED=true \ -e HOST=0.0.0.0 -e JWT_SECRET_KEY="${JWT_SECRET_KEY}" \ -e AUTH_ENCRYPTION_SECRET="${AUTH_ENCRYPTION_SECRET}" \ mcpgateway:airgapped ```
</details>
---
| Command | Server | Port | Database | Use Case |
|---|---|---|---|---|
make dev | Uvicorn | **8000** | SQLite | Development (single instance, auto-reload) |
make serve | Gunicorn | **4444** | SQLite | Production single-node (multi-worker) |
make serve-ssl | Gunicorn | **4444** | SQLite | Production single-node with HTTPS |
make compose-up | Docker Compose + Nginx | **8080** | PostgreSQL + Redis | Full stack (3 replicas, load-balanced) |
make compose-sso | Docker Compose + Keycloak | **8080 / 8180** | PostgreSQL + Redis | Local SSO testing (Keycloak profile) |
make testing-up | Docker Compose + Nginx | **8080** | PostgreSQL + Redis | Testing environment |
Interactive API documentation is available when the server is running:
Quick Authentication: ```bash
curl -H "Authorization: Bearer $TOKEN" http://localhost:4444/health ```
For comprehensive curl examples covering all endpoints, see the API Usage Guide.
---
Clone the repo and open in VS Code—it will detect .devcontainer and prompt to "Reopen in Container". The container includes Python 3.11, Docker CLI, and all project dependencies.
For detailed setup, workflows, and GitHub Codespaces instructions, see Developer Onboarding.
---
Common issues and solutions:
| Issue | Quick Fix |
|---|---|
docker compose up fails with cryptography or dependency resolution error | The local build requires a CI-produced wheel closure. Run docker pull ghcr.io/ibm/mcp-context-forge:latest && echo 'IMAGE_LOCAL=ghcr.io/ibm/mcp-context-forge:latest' >> .env then retry |
docker compose up fails with SecurityConfigurationError: jwt_secret_key | .env is missing or has __REPLACE_ME__ placeholders. Run cp .env.example .env && python3 -m mcpgateway.scripts.init_secrets --patch-env .env |
docker compose up fails — mcpgateway/nginx-cache pull access denied | nginx image must be built locally: docker compose build nginx |
make dev — nothing on port 8000 | Check terminal for SecurityConfigurationError — run make ensure-secrets then retry. On WSL2 use http://127.0.0.1:8000 not localhost |
| SQLite "disk I/O error" on macOS | Avoid iCloud-synced directories; use ~/mcp-context-forge/data |
| Port 4444 not accessible on WSL2 | Configure WSL integration in Docker Desktop |
| Gateway exits immediately | Run cp .env.example .env && python3 -m mcpgateway.scripts.init_secrets --patch-env .env |
ModuleNotFoundError | Run make install-dev |
For detailed troubleshooting guides, see Troubleshooting Documentation.
---
ContextForge 是一个开源的注册表和代理,通过中央治理、发现和可观察性来联合 MCP 服务器、A2A 服务器或 REST/gRPC API。它优化了代理和工具的调用,并支持插件。
首先安装系统依赖项
安装和运行(copy-paste 友好的)
快速入门 - PyPI
编辑 .env 来自定义您的设置
3️⃣ 生成一个令牌并测试 API
功能完整的MCP生态工具,解决多协议聚合和网关问题,社区活跃(3.7k星),Python生态友好,是构建AI基础设施的重要选择。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
AI Skill Hub 点评:mcp-context-forge MCP工具 的核心功能完整,质量优秀。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | mcp-context-forge |
| 原始描述 | 开源MCP工具:An AI Gateway, registry, and proxy that sits in front of any MCP, A2A, or REST/g。⭐3.7k · Python |
| Topics | MCP网关API代理AI基础设施异步处理认证中间件 |
| GitHub | https://github.com/IBM/mcp-context-forge |
| License | Apache-2.0 |
| 语言 | Python |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端