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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.