Complete self-hosted MCP (Model Context Protocol) infrastructure for Claude.ai integration with 95% token reduction.
This repository documents the complete MCP tool flow architecture that enables Claude.ai to access 350+ tools while consuming only ~800 tokens (instead of ~40,000).
Claude.ai β mcp-front (OAuth) β mcp-tool-filter (semantic) β mcp-name-bridge β Context Forge β [22 MCP servers]
Connecting Claude.ai directly to 350+ tools would consume ~40,000 tokens before any conversation starts, severely limiting conversation length.
- OAuth Gateway - Secure authentication via Google OAuth
- Semantic Tool Filter - Exposes only 3 meta-tools, finds relevant tools on-demand
- Name Bridge - Translates naming conventions between systems
- Context Forge - Aggregates all MCP servers into unified endpoint
| Metric | Before | After | Savings |
|---|---|---|---|
| Token Usage | ~40,000 | ~800 | 98% |
| Tools Visible | 350+ | 3 | Semantic search |
| Security | None | OAuth 2.0 | Enterprise-ready |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLAUDE.AI β
β Sees only 3 tools (~800 tokens): β
β search_tools, execute_tool, list_all_tools β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTPS
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β mcp.millyweb.com β
β Traefik (SSL Termination) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β mcp-front (Port 8088) β
β β
β β’ Google OAuth 2.0 authentication β
β β’ JWT token validation β
β β’ Routes to tool-filter β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β mcp-tool-filter-cf (Port 8098) β
β TOKEN OPTIMIZATION LAYER β
β β
β β’ Exposes only 3 meta-tools to Claude β
β β’ search_tools(query) - Semantic search with embeddings β
β β’ execute_tool(name, args) - Execute any tool by name β
β β’ list_all_tools() - Browse all available tools β
β β’ Uses local MiniLM embeddings (no API key needed) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β mcp-name-bridge (Port 8080) β
β CONVENTION CONVERTER β
β β
β β’ Translates tool names between systems β
β β’ gateway__ssh_execute β gateway-ssh-execute β
β β’ Handles Context Forge slug conventions β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Context Forge (Port 4444/8099) β
β MCP GATEWAY AGGREGATOR β
β β
β β’ IBM's open-source MCP gateway β
β β’ Aggregates 22 MCP servers β
β β’ 350+ tools available β
β β’ Admin UI at :4444 β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β Filesystem β β GitHub β β mcp-gateway β
β Git β β Slack β β (SSH/VPS) β
β PostgreSQL β β LinkedIn β β β
β Fetch β β Puppeteer β β β’ ssh_execute β
β BraveSearch β β Browserless β β β’ ssh_read β
β ... β β ... β β β’ ssh_write β
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
- Docker & Docker Compose
- Domain with DNS pointing to your server
- Google OAuth credentials (for authentication)
- Traefik reverse proxy (or similar)
git clone https://github.com/rdmilly/mcp-tool-flow.git
cd mcp-tool-flowcd contextforge
cp .env.example .env
# Edit .env with your credentials
docker-compose up -dcd ../mcp-name-bridge
docker-compose up -dcd ../mcp-tool-filter
cp .env.example .env
# Edit .env
docker-compose up -dcd ../mcp-front
cp .env.example .env
# Edit .env with Google OAuth credentials
docker-compose up -d- Go to Claude.ai Settings β Connectors
- Add custom connector:
https://your-domain.com/mcp/sse - Complete OAuth flow
- Start using 350+ tools!
| Component | Port | Purpose | Documentation |
|---|---|---|---|
| mcp-front | 8088 | OAuth gateway | mcp-front/README.md |
| mcp-tool-filter | 8098 | Semantic filtering | mcp-tool-filter/README.md |
| mcp-name-bridge | 8080 | Name translation | mcp-name-bridge/README.md |
| contextforge | 4444, 8099 | MCP aggregation | contextforge/README.md |
| mcp-gateway | 8086 | SSH/VPS tools | mcp-gateway/README.md |
| Server | Tools | Description |
|---|---|---|
| Filesystem | 15+ | File operations |
| Git | 10+ | Git operations |
| PostgreSQL | 10+ | Database queries |
| GitHub | 30+ | Repository management |
| Slack | 15+ | Messaging |
| Docker | 20+ | Container management |
| Puppeteer | 10+ | Browser automation |
| Browserless | 5+ | Headless browsing |
| 5+ | Social posting | |
| Gateway (SSH) | 9 | SSH/VPS management |
| ...and 12 more |
# Health check
curl http://localhost:8098/health
# List all tools (paginated)
curl -X POST http://localhost:8098/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'# List gateways
curl -u admin:PASSWORD http://localhost:4444/gateways
# Register new gateway
curl -X POST http://localhost:4444/gateways \
-u admin:PASSWORD \
-H "Content-Type: application/json" \
-d '{"name":"MyServer","url":"http://server:8080/mcp","transport":"STREAMABLEHTTP"}'
# List all tools
curl -u admin:PASSWORD "http://localhost:4444/tools?limit=500"All components communicate over a shared Docker network:
networks:
mcp-network:
external: trueCreate it once:
docker network create mcp-network- Check Context Forge has gateways registered:
curl -u admin:PASS http://localhost:4444/gateways - Check tool-filter can reach name-bridge:
docker logs mcp-tool-filter-cf - Verify name-bridge health:
curl http://localhost:8080/health
- Verify Google OAuth credentials in mcp-front .env
- Check redirect URI matches your domain
- Review mcp-front logs:
docker logs mcp-front
- Verify mcp-gateway is registered with Context Forge
- Check SSH keys are mounted:
docker exec mcp-gateway ls /ssh - Test SSH connection:
docker exec mcp-gateway cat /app/src/index.js
Contributions welcome! Please read CONTRIBUTING.md first.
MIT License - see LICENSE for details.
- IBM Context Forge - MCP gateway aggregator
- Portkey MCP Tool Filter - Semantic filtering library
- mcp-front - OAuth gateway
Built by Ryan Milly as part of the Millyweb AI infrastructure project.