skill-router-mcp

skill-router-mcp

Routes SKILL.md libraries to any MCP client, enabling task matching and skill loading with embedding-based scoring, keyword fallback, and context-window discipline.

Category
访问服务器

README

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.

skill-router-mcp demo

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.

Install & run

npm install
npm run build
SKILLS_ROOT=/path/to/skills node dist/index.js

Claude Code (.mcp.json in your project, or claude mcp add):

{
  "mcpServers": {
    "skill-router": {
      "command": "node",
      "args": ["/absolute/path/to/skill-router-mcp/dist/index.js"],
      "env": { "SKILLS_ROOT": "/absolute/path/to/your/skills" }
    }
  }
}

Tools

Tool Purpose
list_skills() All skills — name + description only (cheap, call first)
match_skill(query, top_k?) Top-k skills for a task, with 0–1 scores and requires
get_skill(name) Full SKILL.md, capped at MAX_TOKENS (default 8000); returns truncated + sections
get_skill_section(name, section) One H2 section — for skills too big for one fetch
rescan_skills() 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 a text/markdown resource, with requires/works_in frontmatter exposed under the io.modelcontextprotocol.skills/ _meta prefix
  • The io.modelcontextprotocol/skills extension 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
SKILLS_ROOT ./skills Directory scanned (recursively) for SKILL.md files
MAX_TOKENS 8000 Token cap on get_skill responses
WATCH_SKILLS true Set false to disable the file watcher (network drives, Docker volumes — use rescan_skills instead)
EMBEDDINGS auto auto = semantic if Ollama is reachable, else keyword; on / off to force
OLLAMA_URL http://127.0.0.1:11434 Ollama endpoint for embeddings
EMBEDDING_MODEL nomic-embed-text Embedding model (ollama pull nomic-embed-text first)

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 inside SKILLS_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_ROOT at 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 as lint_warnings in list_skills, and attached to get_skill responses before the content so a reviewing agent sees the warning first. The lint flags — it never blocks — and rules favor precision over recall.

Roadmap

  • [x] Embedding-based match_skill (local, Ollama nomic-embed-text) behind the Matcher interface, with content-hash caching + keyword fallback
  • [x] Routing benchmark: keyword vs. embeddings on a 48-query labeled set — see benchmark/RESULTS.md
  • [x] Index-time content lint for suspicious skill patterns (10 rules, surfaced in list_skills and get_skill)
  • [x] SEP-2640 alignment: skill:// resources, skill://index.json discovery 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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选