skill-router-mcp
This server routes and manages agent skills (SKILL.md files) over the Model Context Protocol (MCP), enabling discovery, intelligent matching, and secure retrieval of skill instructions.
list_skills()— Get a lightweight overview of all available skills (name + one-line description), useful as a cheap first step.match_skill(query, top_k?)— Rank skills by relevance to a task, returning 0–1 confidence scores and arequiresfield listing needed tools. Uses semantic (Ollama embedding) matching with automatic keyword fallback; engine is reported in results.get_skill(name)— Load full SKILL.md instructions for a skill, capped at 8,000 tokens. Returns atruncatedflag andsectionslist if content was cut off.get_skill_section(name, section)— Fetch a single H2 section of a large skill by heading name, enabling incremental loading whenget_skillreturnstruncated: true.rescan_skills()— Force an immediate re-index of the skills directory after adding or modifying skill files (a file watcher also handles this automatically).MCP resources — Skills are also exposed as MCP resources (
skill://index.json,skill://<name>/SKILL.md) for spec-aware hosts.Security — Path allowlist, skill-name sanitization, and index-time content linting for prompt injection, credential exfiltration, and similar suspicious patterns.
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., "@skill-router-mcp match skill for compressing images"
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.
skill-router-mcp
Skill routing for SKILL.md libraries, served over MCP to any agent.
Point it at a directory of Agent Skills
(SKILL.md files with YAML frontmatter) and any MCP client — Claude Code,
Cursor, Windsurf, Codex, or your own agent — can discover skills, match a task
to the best one, and load instructions on demand without blowing its context
window.
match_skill("create a word document")
→ [{ name: "docx", score: 0.85, requires: ["filesystem", "python"] }, ...]
get_skill("docx")
→ full SKILL.md instructions (token-capped, section-aware)Why this exists (honest version)
Claude Code and Codex now load Agent Skills natively, and several MCP skill
servers already exist (skillz,
mcp-skill-hub,
skillserver,
Skills Over MCP). What none of them do is
rank skills against a task query — they rely on the host LLM picking from
descriptions, which degrades as skill libraries grow. This project's focus is
the routing layer: a scored match_skill backed by local embeddings (Ollama +
nomic-embed-text, with automatic keyword fallback), plus strict path
security and context-window discipline.
Measured on a 48-query labeled benchmark over 16 skills (queries written before measuring, not tuned):
Engine | Top-1 | Top-3 | MRR | ms/query |
keyword | 77.1% | 85.4% | 0.813 | ~1 |
semantic (nomic-embed-text) | 93.8% | 97.9% | 0.958 | ~69 |
Both engines score 100% on queries that share words with the skill
description — the gap is entirely on paraphrased (62.5% → 93.8%) and
indirect (68.8% → 87.5%) queries like "combine several invoices into a
single file for printing" → pdf. Reproduce with npm run benchmark.
Every match_skill response reports which engine produced the ranking
(semantic or keyword), so fallback is never silent.
Related MCP server: SkillMCP
Quick start
Run it straight from npm — no clone, no build:
SKILLS_ROOT=/path/to/skills npx skill-router-mcpWire it into Claude Code (.mcp.json in your project):
{
"mcpServers": {
"skill-router": {
"command": "npx",
"args": ["skill-router-mcp"],
"env": { "SKILLS_ROOT": "/absolute/path/to/your/skills" }
}
}
}Semantic matching is optional — install Ollama and
ollama pull nomic-embed-text to enable it; otherwise it falls back to
keyword matching automatically.
From source
git clone https://github.com/anujkumar8076/skill-router-mcp
cd skill-router-mcp
npm install && npm run build
SKILLS_ROOT=/path/to/skills node dist/index.jsTools
Tool | Purpose |
| All skills — name + description only (cheap, call first) |
| Top-k skills for a task, with 0–1 scores and |
| Full SKILL.md, capped at |
| One H2 section — for skills too big for one fetch |
| Force re-index (a chokidar watcher also auto-reindexes) |
SEP-2640 resources
Skills are also served through the MCP Resources primitive per the Skills Over MCP Working Group draft (SEP-2640), so any spec-aware host can consume them without knowing this server's tools:
skill://index.json— enumerable discovery index (Agent Skills discovery schema 0.2.0)skill://<name>/SKILL.md— each skill as atext/markdownresource, withrequires/works_infrontmatter exposed under theio.modelcontextprotocol.skills/_metaprefixThe
io.modelcontextprotocol/skillsextension capability is declared at initialization
Resource reads pass through the same allowlist validation as the tools.
Skill format
Standard Agent Skills format, with two optional routing fields:
---
name: docx
description: "Use when the user wants to create or edit Word documents."
requires: [filesystem, python] # tools the agent needs to execute this skill
works_in: [claude_code] # environments the skill is known to work in
---
# Instructions...Agents should check requires against their own toolset before loading a
skill — this server delivers instructions; your agent supplies execution.
Configuration
Env var | Default | Meaning |
|
| Directory scanned (recursively) for |
|
| Token cap on |
|
| Set |
|
|
|
|
| Ollama endpoint for embeddings |
|
| Embedding model ( |
Skill vectors are cached by content hash in
~/.cache/skill-router-mcp/embeddings.json, so restarts and re-indexes only
embed skills whose text changed. If Ollama goes down mid-session, matching
degrades to keyword automatically — routing never hard-fails.
Security model
Allowlist, not paths. Skill names are sanitized to
[a-z0-9_-], looked up in an index built at startup, and the resolved file is canonicalized and verified to live insideSKILLS_ROOT. User input never constructs a path.Rejected lookups are logged to stderr.
Trust boundary: skill content is injected into your agent's context. Only point
SKILLS_ROOTat skills you trust — a 2026 study of 31k marketplace skills found ~26% contained prompt-injection or exfiltration patterns.Index-time content lint. Every skill is scanned for suspicious patterns: prompt injection ("ignore previous instructions"), concealment ("don't tell the user"), exfiltration (send-to-URL, known exfil endpoints), credential access (
~/.ssh,.env, API-key harvesting), pipe-to-shell, decode-and-execute, destructive commands, and opaque base64 blobs. Findings are logged at index time, shown aslint_warningsinlist_skills, and attached toget_skillresponses before the content so a reviewing agent sees the warning first. The lint flags — it never blocks — and rules favor precision over recall.
Roadmap
Embedding-based
match_skill(local, Ollamanomic-embed-text) behind theMatcherinterface, with content-hash caching + keyword fallbackRouting benchmark: keyword vs. embeddings on a 48-query labeled set — see benchmark/RESULTS.md
Index-time content lint for suspicious skill patterns (10 rules, surfaced in
list_skillsandget_skill)SEP-2640 alignment:
skill://resources,skill://index.jsondiscovery index, and the skills extension capability
Development
npm test # vitest: security, indexer, matchers, content
npm run build # tsc → dist/
node scripts/smoke.mjs # drive the built server over stdio with real queries
npm run benchmark # keyword vs semantic routing accuracy (needs Ollama)MIT
Available Tools
5 toolsget_skillA
Load a skill's full SKILL.md instructions (capped at 8000 tokens). If truncated is true, fetch the remaining parts one at a time with get_skill_section using the returned sections list.
Inputs: name (required).
get_skill_sectionA
Fetch a single H2 section of a skill by heading name. Use for large skills where get_skill returned truncated: true.
Inputs: name (required), section (required).
list_skillsA
List all available skills (name + one-line description only). Cheap to call; use before match_skill or get_skill.
Inputs: no named parameters.
match_skillA
Find the best skills for a task. Returns top matches with a 0-1 confidence score and the tools each skill requires. Check requires against your own available tools before loading a skill.
Inputs: query (required), top_k.
rescan_skillsA
Force an immediate re-index of the skills directory. Use if skills were added or changed and the index looks stale.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: listing skills, fetching full skill content, fetching sections, matching skills to tasks, and re-indexing. No overlap or ambiguity.
All tool names follow a consistent verb_noun pattern with snake_case (get_skill, get_skill_section, list_skills, match_skill, rescan_skills), making them predictable.
5 tools is well-scoped for a skill router: listing, fetching, section retrieval, matching, and re-indexing. Each tool earns its place without redundancy.
Covers all essential operations for skill management: discovery (list_skills), retrieval (get_skill, get_skill_section), intelligent selection (match_skill), and maintenance (rescan_skills). No obvious gaps.
Maintenance
Related MCP Connectors
Governed AI agent skills — one library, distributed to devs and exposed to remote agents over MCP.
Sharebench — search & pull AI skills, agents, prompts & playbooks (SKILL.md) into any MCP client
Hosted MCP server for live public-data APIs and Skills for AI agents.
Hosted MCP server and Agent Skills for specs, engineering threads, and project memory.
Related MCP Servers
- AlicenseAqualityCmaintenanceA Model Context Protocol (MCP) server that provides intelligent search capabilities for discovering relevant Claude Agent Skills using vector embeddings and semantic similarity. This server implements the same progressive disclosure architecture that Anthropic describes in their Agent Skills enginee3411Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables centralized, versioned management and distribution of AI agent skills through a horizontally scalable MCP server, allowing agents to dynamically discover, search, and retrieve skills over HTTP/SSE.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to discover, search, and load agent skills from many sources, including other agents' skill directories, Claude Code plugin marketplaces, and remote git repositories, with no copying or syncing required.762 npm7MIT
- AlicenseNot gradedqualityBmaintenanceProvides a searchable routing layer for MCP tools, skills, and plugins, enabling natural-language discovery and invocation while reducing context overhead.95 npmMIT