agentbridge
A unified gateway for AI agent tools that provides a single MCP stdio endpoint for executing tool calls with unified auth, rate limiting, and observability. Enables agents to interact with multiple external APIs through a standardized interface.
README
AgentBridge
One endpoint for all your AI agent tools. Unified auth, rate limiting, and observability. Dual protocol: HTTP REST + MCP stdio.
AI agents fail not because they can't reason — they fail because tool integration is chaos: 5 APIs, 5 auth methods, 5 formats. AgentBridge unifies this into a single proxy, so your agent focuses on reasoning while the gateway handles the plumbing.
Quick Start
npm install
cp .env.example .env # fill in your API keys
# HTTP mode (dashboard at http://localhost:3100)
npm run dev
# MCP mode (for Codex, Hermes, Claude Desktop)
npm run mcp
Dual Protocol
| Mode | Command | Protocol | Use Case |
|---|---|---|---|
| HTTP | npm run dev |
REST API | Standalone proxy; dashboard at :3100 |
| MCP | npm run mcp |
MCP stdio | Native integration with Codex, Hermes, Claude |
Both modes share the same tool registry and gateway logic. Define tools once, use them everywhere.
Using with Codex
Already configured. If you need to re-add:
# ~/.codex/config.toml
[mcp_servers.agentbridge]
command = "/Users/lybang/Documents/赚钱/agentbridge/node_modules/.bin/tsx"
args = ["/Users/lybang/Documents/赚钱/agentbridge/src/mcp.ts"]
startup_timeout_sec = 30
Restart Codex, then ask: "Search GitHub for 'mcp gateway'" — the agent will discover and use the github-search tool through the gateway.
See config-snippets.md for Hermes and Claude Desktop config.
How It Works
AI Agent → tools/call (MCP) → AgentBridge → Upstream API
or
AI Agent → POST /gateway/:toolName (HTTP) → Gateway Server → Upstream API
↓
unified auth / rate limit / logging
Registering Tools
Tools are defined as JSON files in /tools/. Example:
{
"name": "github-search",
"label": "GitHub Code Search",
"description": "Search GitHub repositories",
"base_url": "https://api.github.com",
"endpoint": "/search/repositories?q=:query",
"method": "GET",
"auth": {
"type": "bearer",
"header_name": "Authorization",
"prefix": "Bearer ",
"source": "passthrough"
},
"rate_limit_rpm": 30,
"enabled": true,
"category": "Developer Tools"
}
Auth Modes
- env — Credentials stored server-side in
.env. Best for shared API keys. - passthrough — Caller provides the credential with each request. Best for user-specific tokens.
API Reference
| Endpoint | Description |
|---|---|
POST /gateway/:toolName |
HTTP: proxy a tool call |
GET /health |
Health check |
GET /api/tools |
List all registered tools with metrics |
GET /api/stats |
Aggregate stats (success rate, P99, etc.) |
GET /api/logs |
Recent call logs |
Monetization Leverage
Once agents route through the gateway, you own the control plane:
- Usage-based billing — charge per call ($0.001–0.01), revenue scales with customer growth
- Tiered plans — Free (3 tools, 100 calls/day) → Pro ($29/mo, unlimited) → Enterprise ($499/mo)
- Observability upsell — Basic logging free; advanced tracing, alerting, and dashboards are paid
- Managed auth — Store credentials server-side as a premium security feature
- Tool marketplace — Curated tool packs for verticals, 30% revenue share
Architecture
src/
index.ts — Fastify HTTP server entry
mcp.ts — MCP stdio server entry (for Codex/Hermes/Claude)
gateway-core.ts — Shared tool execution logic (used by both protocols)
gateway.ts — HTTP route handlers (thin wrapper around core)
registry.ts — Tool registry + metrics + rate limiting
auth.ts — Auth resolver (env / passthrough / custom)
logger.ts — Ring buffer logger + stats
api.ts — Dashboard data API routes
tools/ — Tool definition JSON files
public/ — Admin dashboard (single-page HTML, real-time)
Next Steps (Post-MVP)
- [ ] Persistent storage (SQLite) for tool configs and logs
- [ ] OAuth 2.0 flow support
- [ ] Webhook callbacks for async tool results
- [ ] Usage-based billing integration (Stripe)
- [ ] Tool marketplace with one-click install
- [ ] Custom
input_schemavalidation per tool
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。