Skip to main content

Semantic MCP tool discovery gateway - find tools by intent, not memory

Project description

日本語 | 中文 | Español | Français | हिन्दी | Italiano | Português (BR)

Tool Compass Logo

Tool Compass

Semantic navigator for MCP tools - Find the right tool by intent, not memory

CI Codecov Python 3.10+ License Docker Landing Page

95% fewer tokens. Find tools by describing what you want to do.

InstallationUsageDockerPerformanceContributing


The Problem

MCP servers expose dozens or hundreds of tools. Loading all tool definitions into context wastes tokens and slows down responses.

Before: 77 tools × ~500 tokens = 38,500 tokens per request
After:  1 compass tool + 3 results = ~2,000 tokens per request

Savings: 95%

The Solution

Tool Compass uses semantic search to find relevant tools from a natural language description. Instead of loading all tools, Claude calls compass() with an intent and gets back only the relevant tools.

Quick Start

Option 1: Local Installation

# Prerequisites: Ollama with nomic-embed-text
ollama pull nomic-embed-text

# Clone and setup
git clone https://github.com/mcp-tool-shop-org/tool-compass.git
cd tool-compass/tool_compass

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Build the search index
python gateway.py --sync

# Run the MCP server
python gateway.py

# Or launch the Gradio UI
python ui.py

Option 2: Docker

# Clone the repo
git clone https://github.com/mcp-tool-shop-org/tool-compass.git
cd tool-compass/tool_compass

# Start with Docker Compose (requires Ollama running locally)
docker-compose up

# Or include Ollama in the stack
docker-compose --profile with-ollama up

# Access the UI at http://localhost:7860

Features

  • Semantic Search - Find tools by describing what you want to do
  • Progressive Disclosure - compass()describe()execute()
  • Hot Cache - Frequently used tools are pre-loaded
  • Chain Detection - Automatically discovers common tool workflows
  • Analytics - Track usage patterns and tool performance
  • Cross-Platform - Windows, macOS, Linux
  • Docker Ready - One-command deployment

Architecture

┌─────────────────────────────────────────────────────────────┐
│                     TOOL COMPASS                            │
│                                                             │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐  │
│  │   Ollama     │    │   hnswlib    │    │   SQLite     │  │
│  │   Embedder   │───▶│    HNSW      │◀───│   Metadata   │  │
│  │  (nomic)     │    │   Index      │    │   Store      │  │
│  └──────────────┘    └──────────────┘    └──────────────┘  │
│                              │                              │
│                              ▼                              │
│                    ┌──────────────────┐                    │
│                    │  Gateway (9 tools)│                   │
│                    │  compass, describe│                   │
│                    │  execute, etc.    │                   │
│                    └──────────────────┘                    │
└─────────────────────────────────────────────────────────────┘

Usage

The compass() Tool

compass(
    intent="I need to generate an AI image from a text description",
    top_k=3,
    category=None,  # Optional: "file", "git", "database", "ai", etc.
    min_confidence=0.3
)

Returns:

{
  "matches": [
    {
      "tool": "comfy:comfy_generate",
      "description": "Generate image from text prompt using AI",
      "category": "ai",
      "confidence": 0.912
    }
  ],
  "total_indexed": 44,
  "tokens_saved": 20500,
  "hint": "Found: comfy:comfy_generate. Use describe() for full schema."
}

Available Tools

Tool Description
compass(intent) Semantic search for tools
describe(tool_name) Get full schema for a tool
execute(tool_name, args) Run a tool on its backend
compass_categories() List categories and servers
compass_status() System health and config
compass_analytics(timeframe) Usage statistics
compass_chains(action) Manage tool workflows
compass_sync(force) Rebuild index from backends
compass_audit() Full system report

Configuration

Variable Description Default
TOOL_COMPASS_BASE_PATH Project root Auto-detected
TOOL_COMPASS_PYTHON Python executable Auto-detected
TOOL_COMPASS_CONFIG Config file path ./compass_config.json
OLLAMA_URL Ollama server URL http://localhost:11434
COMFYUI_URL ComfyUI server http://localhost:8188

See .env.example for all options.

Performance

Metric Value
Index build time ~5s for 44 tools
Query latency ~15ms (including embedding)
Token savings ~95% (38K → 2K)
Accuracy@3 ~95% (correct tool in top 3)

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=. --cov-report=html

# Skip integration tests (no Ollama required)
pytest -m "not integration"

Troubleshooting

MCP Server Not Connecting

If Claude Desktop logs show JSON parse errors:

Unexpected token 'S', "Starting T"... is not valid JSON

Cause: print() statements corrupt JSON-RPC protocol.

Fix: Use logging or file=sys.stderr:

import sys
print("Debug message", file=sys.stderr)

Ollama Connection Failed

# Check Ollama is running
curl http://localhost:11434/api/tags

# Pull the embedding model
ollama pull nomic-embed-text

Index Not Found

python gateway.py --sync

Related Projects

Part of the Compass Suite for AI-powered development:

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Security

For security vulnerabilities, please see SECURITY.md. Do not open public issues for security bugs.

Support

License

MIT - see LICENSE file for details.

Credits

  • HNSW: Malkov & Yashunin, "Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs" (2016)
  • nomic-embed-text: Nomic AI's open embedding model
  • FastMCP: Anthropic's MCP framework
  • Gradio: Hugging Face's ML web framework

"Syntropy above all else."

Tool Compass reduces entropy in the MCP ecosystem by organizing tools by semantic meaning.

DocumentationIssuesDiscussions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tool_compass-2.0.6.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tool_compass-2.0.6-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

Details for the file tool_compass-2.0.6.tar.gz.

File metadata

  • Download URL: tool_compass-2.0.6.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tool_compass-2.0.6.tar.gz
Algorithm Hash digest
SHA256 5b20b375b0de6164f3948439e6078f4f27ded764004fe993c12a89180284a71d
MD5 3889d273e818df6899289bb7c3e1ac7b
BLAKE2b-256 60b493081d213cd81b4891e7a77fe16a6ba56b2f61a4822ac29483c875b69b25

See more details on using hashes here.

Provenance

The following attestation bundles were made for tool_compass-2.0.6.tar.gz:

Publisher: publish.yml on mcp-tool-shop-org/tool-compass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tool_compass-2.0.6-py3-none-any.whl.

File metadata

  • Download URL: tool_compass-2.0.6-py3-none-any.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tool_compass-2.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 83fe29852ad5139ae732bde88d82466e10a022b58dac1269990ba98a05bc8b6e
MD5 8a7ed3bec74827c5cf7154044d9d43b4
BLAKE2b-256 12a85579dccd48370d7060f58ccecaaf03c04a5ac8f902a35cc4236ebce08700

See more details on using hashes here.

Provenance

The following attestation bundles were made for tool_compass-2.0.6-py3-none-any.whl:

Publisher: publish.yml on mcp-tool-shop-org/tool-compass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page