Semantic Tool Discovery Middleware for MCP
Project description
ToolSearch: Semantic Discovery Middleware for MCP 🦞
Stop Bloating Your Agent's Context. Start Scaling Your Toolsets.
ToolSearch is an open-source, local-first middleware for the Model Context Protocol (MCP). It solves the "Too Many Tools" problem by semantically filtering your tool registry, prompts, and skills on-the-fly, ensuring your LLM stays focused, accurate, and cost-efficient.
🚀 Part 1: Quick Start
What is it?
If you have 30+ MCP tools, your agent's context window is saturated with JSON definitions before it even starts thinking. This leads to hallucinations, high token costs, and declining accuracy. ToolSearch sits as a proxy between your client (Claude Code, Cursor) and your servers, serving only the tools relevant to your current task.
Installation
# Clone the repository
gh repo clone codeninja/tool-search
cd tool-search
# Install dependencies and initialize
uv sync
uv run tool-search init
1. Configure Your Sources
Add your MCP servers or OpenAPI specs to ~/.toolsearch/config.toml:
[servers.github]
type = "mcp"
command = "npx"
args = ["@modelcontextprotocol/server-github"]
[servers.weather-api]
type = "openapi"
url = "https://api.weather.gov/openapi.json"
2. Build the Semantic Index
ToolSearch embeds your tool descriptions locally using all-MiniLM-L6-v2.
uv run tool-search index
3. Connect Your Agent
Point your client to the ToolSearch Proxy. For Claude Desktop:
"mcpServers": {
"toolsearch": {
"command": "uv",
"args": ["--directory", "/path/to/tool-search", "run", "tool-search", "proxy"]
}
}
4. Use It
Simply tell your agent what you're doing. The agent will call toolsearch_context("debugging kubernetes logs"), and ToolSearch will instantly activate the relevant tools in the agent's registry.
🧠 Part 2: Technical Architecture
ToolSearch operates as a Statistical Filtering Proxy. It doesn't just forward requests; it transforms the environment based on intent.
How it Works:
- Ingestion: The
Collectorharvests tools from native MCP servers, "forges" new tools from OpenAPI/Swagger docs, and indexes local Agent Skills (SKILL.md). - Semantic Index: A local SQLite + hnswlib vector store maintains embeddings for every tool, prompt, and skill.
- The Discovery Loop:
- The Agent sets a context via
toolsearch_context. - ToolSearch intercepts the next
tools/listorprompts/listrequest. - It performs a sub-millisecond k-NN search and returns only the top-k matches.
tools/callrequests are transparently routed back to the correct upstream server.
- The Agent sets a context via
Deep Dive: For a full breakdown of the layered architecture, domain models, and state machines, see our Full Technical Specification.
🤝 Part 3: Contributing
We are building the "Garbage Collector for the Context Window," and we want your help!
How to Contribute
- Create a Bridge: Have a niche API? Add an example to
/examplesshowing how to bridge it. - Improve the Forge: Help us refine the OpenAPI-to-MCP transformation logic.
- New Backends: We want to support more vector stores (Chroma, pgvector) and remote embedding providers.
- Feedback: Open an issue if you find a tool-selection hallucination we can't solve.
Development Workflow
- Fork the repo.
- Create a feature branch:
feat/issue-number-description. - Run the E2E suite:
uv run pytest tests/test_e2e.py. - Submit a PR!
Community
Join Dallas and the team in the OpenClaw Discord to discuss the future of agentic infrastructure.
Built by codeninja and the OpenClaw Agentic Dev Team.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openclaw_toolsearch-0.1.0.tar.gz.
File metadata
- Download URL: openclaw_toolsearch-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cad863e8c8d1c788575cbeea7dfd836211d97f7dfc06d0c707b88537ac877987
|
|
| MD5 |
de89499f846c1191fc10cafa547670e8
|
|
| BLAKE2b-256 |
6ccf6cf37a31d6584674939c3aa23bd17e057cd36198533c084bbe4f6baacd1e
|
File details
Details for the file openclaw_toolsearch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openclaw_toolsearch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87173f3436017d103e5377ad9ee7dbe0cebd92013dd7ba1655878a9f234b0c43
|
|
| MD5 |
379c6958892e3dd00bb7fed324b903d5
|
|
| BLAKE2b-256 |
c6b951c1af0927e5928e88ee5f512ec113fe05582d2fc0f1d808fb14103de51f
|