ToolGate
Provides integration with Git as an upstream MCP server, allowing ToolGate to fetch Git-related tools such as git_status and expose them to AI agents through semantic filtering.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ToolGatefind tools for file operations"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ToolGate
MCP proxy for dynamic tool gating with semantic search
ToolGate is a Model Context Protocol (MCP) proxy that intelligently filters tools based on semantic relevance, reducing token bloat and improving AI agent performance. Instead of sending all available tools to your AI agent, ToolGate uses semantic search to return only the most relevant tools for each query.
Features
šÆ Semantic Tool Filtering: Uses sentence-transformers and FAISS to find relevant tools
š Lazy Two-Phase Loading: Returns truncated descriptions first, full schemas only when called
š Session Continuity: Boosts recently-used tools for better context awareness
š”ļø Rule-Based Gating: Always-include/always-exclude patterns for fine-grained control
š Metrics & Benchmarking: Built-in SQLite metrics tracking and comprehensive benchmark suite
š Production Ready: Full test coverage, type hints, and robust error handling
Related MCP server: Bifrost-MCP Gateway
Installation
# Clone the repository
git clone https://github.com/yourusername/toolgate.git
cd toolgate
# Install with pip
pip install -e .
# Or install with dev dependencies
pip install -e ".[dev]"Quick Start
1. Create a configuration file
# config.yaml
upstream_servers:
- name: filesystem
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/files"]
- name: git
command: npx
args: ["-y", "@modelcontextprotocol/server-git", "--repository", "/path/to/repo"]
gating:
top_k: 10
always_include:
- "read_*"
- "git_status"
always_exclude:
- "delete_*"
session_boost: 0.15
session_window: 5
index:
model_name: "sentence-transformers/all-MiniLM-L6-v2"
similarity_metric: "cosine"
metrics:
enabled: true
db_path: "~/.toolgate/metrics.db"2. Run the proxy
toolgate serve --config config.yamlThe proxy will:
Connect to all upstream MCP servers
Fetch and index their tools
Start listening on stdio for MCP requests
Filter tools based on semantic relevance
3. Use with your AI agent
Point your AI agent (Claude Desktop, Continue, etc.) to use ToolGate as an MCP server:
{
"mcpServers": {
"toolgate": {
"command": "toolgate",
"args": ["serve", "--config", "/path/to/config.yaml"]
}
}
}CLI Commands
Serve
Start the ToolGate proxy server:
toolgate serve --config config.yamlIndex
Display index configuration (dry-run):
toolgate index --config config.yamlStatus
View metrics and statistics:
toolgate status --config config.yaml --limit 20Benchmark
Run the benchmark suite:
toolgate benchmark --benchmark-dir ./benchmarkHow It Works
Architecture
āāāāāāāāāāāāāāā
ā AI Agent ā
āāāāāāāā¬āāāāāāā
ā MCP (stdio)
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ToolGate Proxy ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Semantic Search Engine ā ā
ā ā ⢠sentence-transformers ā ā
ā ā ⢠FAISS cosine similarity ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Gating Rules ā ā
ā ā ⢠always_include/exclude ā ā
ā ā ⢠session boost ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Metrics (SQLite) ā ā
ā ā ⢠Token counting ā ā
ā ā ⢠Latency tracking ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāā¬āāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāā
ā ā
ā¼ ā¼
āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā
ā MCP Server ā ā MCP Server ā
ā (filesystem)ā ā (git) ā
āāāāāāāāāāāāāāā āāāāāāāāāāāāāāāTool Filtering Flow
Query Extraction: ToolGate captures the user's message as a query
Embedding: Query is embedded using sentence-transformers (all-MiniLM-L6-v2)
Search: FAISS finds top-K most similar tools using cosine similarity
Gating: Apply rules (always_include, always_exclude, session boost)
Truncation: Return only tool names + truncated descriptions (phase 1)
JIT Schema Loading: Full schema loaded only when tool is called (phase 2)
Token Reduction
ToolGate achieves significant token savings through:
Relevance filtering: Only top-K tools returned (default: 10)
Description truncation: Descriptions limited to 200 chars in listTools
Lazy schema loading: Full inputSchema loaded only on callTool
Benchmark Results (50 tools, 20 queries):
Precision@10: 85%+ (finds relevant tools)
Token Reduction: 60%+ average savings
Latency: <100ms per query
Configuration Reference
Upstream Servers
upstream_servers:
- name: server_name # Unique identifier
command: executable # Command to run
args: [...] # Command arguments
env: # Optional environment variables
VAR: valueGating Rules
gating:
top_k: 10 # Max tools to return (default: 10)
always_include: # Patterns to always include
- "git_*"
- "read_file"
always_exclude: # Patterns to always exclude
- "dangerous_*"
session_boost: 0.15 # Score boost for recent tools (0-1)
session_window: 5 # Number of recent turns to track
description_max_length: 200 # Truncation lengthPattern matching supports wildcards:
tool_name- exact matchprefix_*- prefix match*_suffix- suffix match
Index Configuration
index:
model_name: "sentence-transformers/all-MiniLM-L6-v2"
cache_dir: "~/.cache/toolgate" # Optional model cache
similarity_metric: "cosine" # cosine, euclidean, or dotMetrics
metrics:
enabled: true
db_path: "~/.toolgate/metrics.db"
token_model: "cl100k_base" # tiktoken encodingDevelopment
Running Tests
# Install dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=toolgate --cov-report=htmlRunning Benchmark
# Run benchmark suite
python benchmark/run.py
# Or via CLI
toolgate benchmarkExpected results:
ā Precision@10 ā„ 80%
ā Token reduction ā„ 60%
ā Query latency < 100ms
License
MIT License - see LICENSE file for details.
Contributing
Contributions welcome! Please:
Fork the repository
Create a feature branch
Add tests for new functionality
Ensure all tests pass
Submit a pull request
References
Acknowledgments
Built for the CABAL project - making AI agents smarter through better tool management.
This server cannot be deployed
Maintenance
Related MCP Connectors
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
Single-connection meta-router indexing 500+ MCP servers & A2A tools with 85% token compression and
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA universal gateway that aggregates multiple MCP servers into a single interface while providing advanced token optimization, result filtering, and automated summarization. It enables efficient management of large tool catalogs and reduces context usage by up to 95% for major AI clients.33 npm17MIT
- AlicenseNot gradedqualityDmaintenanceEnterprise-grade dynamic MCP proxy that eliminates token bloat by lazy-loading tool schemas based on semantic intent, enabling efficient orchestration of multiple backend tools from a single endpoint.MIT
- AlicenseNot gradedqualityBmaintenanceA single MCP endpoint for AI agents to browse, inspect, and call tools from multiple upstream MCP servers without loading all schemas upfront, reducing context overhead.1 npmISC
- FlicenseNot gradedqualityDmaintenanceEnables efficient tool routing and context budgeting for AI agents handling hundreds of MCP tools, with circuit breaker, RBAC, and federation for reliable serving.-