npm @toolroute/sdkstdioMITupdated 2mo ago
Routing layer for AI agents. One call returns the best MCP server and LLM for any task โ scored on 132 real benchmark executions.
What can you do with toolroute?
ToolRoute
Routing layer for AI agents. One call returns the best MCP server and LLM for any task โ scored on 132 real benchmark executions.
Quick start
Add to any MCP client (Claude Code, Cursor, Windsurf, Cline):
{
"mcpServers": {
"toolroute": {
"url": "https://toolroute.io/api/mcp"
}
}
}
Or via HTTP:
curl -X POST https://toolroute.io/api/route \
-H "Content-Type: application/json" \
-d '{"task": "search the web for recent AI papers"}'
{
"approach": "mcp_server",
"recommended_skill": "exa-mcp-server",
"recommended_skill_name": "Exa MCP Server",
"recommended_model": {
"slug": "claude-haiku-4-5-20251001",
"display_name": "Claude Haiku 4.5",
"provider": "anthropic",
"tier": "cheap_chat",
"provider_model_id": "anthropic/claude-haiku-4-5-20251001",
"input_cost_per_mtok": 1.00,
"output_cost_per_mtok": 5.00
},
"confidence": 0.91,
"alternatives": ["brave-search-mcp", "tavily-mcp"],
"fallback": "brave-search-mcp"
}
recommended_modelis always an object, not a bare string โ the innerslugis the canonical model identifier.
How it works
Every task falls into one of three approaches:
| Approach | When | Returns |
|---|---|---|
direct_llm |
Task needs only an LLM (code, writing, analysis) | Best model + cost estimate |
mcp_server |
Task needs an external tool (search, email, calendar) | Best tool + best model |
multi_tool |
Compound task ("send Slack AND update Jira AND email") | Ordered orchestration chain |
Routing uses an LLM classifier (~$0.00001/call) for task understanding, then ranks candidates on a 5-dimension score:
Value Score = 0.35 ร Output Quality
+ 0.25 ร Reliability
+ 0.15 ร Efficiency
+ 0.15 ร Cost
+ 0.10 ร Trust
Every reported outcome updates the scores. The routing gets more accurate as more agents use it.
Benchmark results
132 blind A/B executions across code, writing, analysis, structured output, and translation.
| ToolRoute | Fixed GPT-4o | |
|---|---|---|
| Quality wins | 6 | 0 |
| Ties | 9 | 9 |
| Losses | 0 | โ |
| Avg cost | $0.001โ0.01 | $0.03โ0.10 |
API
| Endpoint | Method | Description |
|---|---|---|
/api/route |
POST | Route a task to best MCP server + LLM (unified) |
/api/route/model |
POST | Route to best LLM model only (no MCP server) |
/api/mcp |
POST (JSON-RPC) | MCP server โ 16 tools |
/api/mcp |
GET (SSE) | SSE transport for MCP clients |
/api/report |
POST | Report MCP server outcome (lightweight) |
/api/contributions |
POST | Advanced MCP skill telemetry (requires skill_id or skill_slug in payload) |
/api/report/model |
POST | Report LLM model outcome โ use this for model telemetry, not /api/contributions |
/api/verify/model |
POST | Verify model output quality |
/api/skills |
GET | Search MCP server catalog |
/api/agents/register |
POST | Register agent identity |
/api/agents/preferences |
POST | Set routing preferences (Strategy D Phase 2 โ allow_china, regulated_industries) |
/api/health |
GET | Service health check (DB + uptime) |
/api/metrics |
GET | Public aggregate platform metrics (no auth) |
Full reference at toolroute.io/api-docs
SDK
npm install @toolroute/sdk
import { ToolRoute } from '@toolroute/sdk'
const tr = new ToolRoute()
const rec = await tr.route({ task: 'parse this CSV and summarize it' })
// execute with rec.recommended_model ...
await tr.report({ skill: rec.recommended_skill, outcome: 'success', latency_ms: 1400 })
Self-hosting
git clone https://github.com/grossiweb/ToolRoute.git
cd ToolRoute
cp .env.local.example .env.local
npm install
npm run dev
Requires: NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY
How routing works
ToolRoute classifies each task using an LLM classifier (Gemini Flash Lite,
~$0.00001/call) with a keyword fallback. The resulting tier maps to a specific
model via src/lib/routing/tiers.ts. Live pricing and capability data come
from the models table. See docs/architecture.md
for the full picture.
Stack
Next.js 14 (App Router) ยท Supabase (Postgres) ยท Vercel
License
MIT
Install
Add toolroute to your client. Pick the one you use.
claude mcp add sdk -- npx -y @toolroute/sdkcodex mcp add sdk -- npx -y @toolroute/sdkamp mcp add sdk -- npx -y @toolroute/sdk{
"mcpServers": {
"sdk": {
"command": "npx",
"args": [
"-y",
"@toolroute/sdk"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"sdk": {
"command": "npx",
"args": [
"-y",
"@toolroute/sdk"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
code --add-mcp '{"name":"sdk","command":"npx","args":["-y","@toolroute/sdk"]}'Or add the block manually to `.vscode/mcp.json` under `servers`.
{
"mcpServers": {
"sdk": {
"command": "npx",
"args": [
"-y",
"@toolroute/sdk"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"sdk": {
"command": "npx",
"args": [
"-y",
"@toolroute/sdk"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"sdk": {
"command": "npx",
"args": [
"-y",
"@toolroute/sdk"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"sdk": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@toolroute/sdk"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"sdk": {
"command": {
"path": "npx",
"args": [
"-y",
"@toolroute/sdk"
]
}
}
}
}Add to your Zed `settings.json`.
npx -y @toolroute/sdkRun `goose configure`, choose **Add Extension โ Command-line Extension**, and paste this command.
Score
39 / 100
Incomplete
- Documentation25/25
- Maintenance16/25
- Trust13/20
- Capability0/15
- Install experience12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 61 days ago
- Has a release history
- Repository is not archived
- Licensed MIT
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 12 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint โ no local install
Version history
| Versions | Published |
|---|---|
| 0.2.2Latest | Mar 28, 2026 |
| 0.2.1 | Mar 28, 2026 |