How jaycheng113/skill-retrieval-mcp works
Purpose and Entry Points
skill-retrieval-mcp is a local Python MCP server and CLI for semantic retrieval over a licence-vetted skill corpus. Agents search short descriptions first, then explicitly fetch full skill instructions. Primary entry points are the CLI in src/skill_mcp/cli.py and MCP service in src/skill_mcp/server.py.
Runtime and Local Data Boundary
The package runs locally under Python. Its persistent data directory contains configuration, a SQLite/FTS5 skill store, and a FAISS vector index. Configuration and data-directory resolution are centralized in src/skill_mcp/config.py; persistence is managed by src/skill_mcp/store.py; index artifacts and incremental indexing are managed by src/skill_mcp/index.py.
MCP Serving Layer
src/skill_mcp/server.py exposes the MCP tools: semantic search, keyword search, full-skill retrieval, and category listing. It supports stdio for coding-agent subprocess integration and SSE as an alternate transport. This layer is intentionally thin: it translates tool requests into retrieval/store operations and returns summaries rather than automatically injecting full instructions.
Retrieval Pipeline
src/skill_mcp/retriever.py combines semantic vector retrieval with exact/keyword retrieval behavior from the SQLite store. src/skill_mcp/embeddings.py defines embedding backends: local sentence-transformers by default, with optional OpenAI and Ollama integrations. src/skill_mcp/index.py owns FAISS index build/load/update behavior and enforces the boundary that an index is model-specific.
Skill Domain Model and Storage
src/skill_mcp/schema.py defines the normalized skill representation, including content, description, categories/tags, source repository, upstream URL, and SPDX licence metadata. src/skill_mcp/store.py persists this model and supports FTS5-backed lookup. The important data contract is that search returns compact metadata/summaries, while get_skill retrieves the complete guide.
Ingestion, Corpus Distribution, and Deduplication
Skills enter through importer implementations under src/skill_mcp/importers/, including directory and frontmatter parsing (src/skill_mcp/importers/directory.py, src/skill_mcp/importers/frontmatter.py), curated upstream definitions (src/skill_mcp/importers/curated.py), and Anthropic-format support (src/skill_mcp/importers/anthropic.py). Downloaded corpus/index handling is in src/skill_mcp/hub.py. src/skill_mcp/dedup.py removes cross-source duplicates before or after merging local and curated material.
Control Flow
Typical setup is: CLI initializes data/config, pulls corpus and optionally a prebuilt index, or imports local skills; import writes records, deduplicates, and incrementally embeds/indexes new entries. At serving time, an MCP client invokes a tool; the server delegates to the retriever/store; semantic ranking uses FAISS embeddings and keyword lookup uses SQLite FTS; the client selects a result and separately requests full content. External services are optional: Hugging Face distributes corpus assets, OpenAI provides hosted embeddings when selected, and Ollama supplies local-model embeddings when selected.
Main entry points: store.py SQLite skill store · retriever.py Hybrid retriever · embeddings.py Embedding backends · index.py FAISS index manager
Components 15
Entry & MCP
- CLI · Initializes data and manages corpus, imports, and indexing.
src/skill_mcp/cli.py - MCP server · Exposes search, get-skill, and category tools over stdio or SSE.
src/skill_mcp/server.py - MCP client
Retrieval
- Hybrid retriever · Combines vector ranking with SQLite keyword behavior.
src/skill_mcp/retriever.py - Embedding backends · Uses local sentence-transformers by default, with optional hosted backends.
src/skill_mcp/embeddings.py
Local data
- Config & data paths
src/skill_mcp/config.py - Skill model · Normalized skill content, metadata, source, and SPDX licence contract.
src/skill_mcp/schema.py - SQLite skill store · Stores skills and serves keyword lookup plus full-content retrieval.
src/skill_mcp/store.py - FAISS index manager · Builds, loads, and incrementally updates model-specific index artifacts.
src/skill_mcp/index.py
Corpus ingestion
- Importers · Directory, frontmatter, curated, and Anthropic-format ingestion.
- Deduplication · Removes cross-source duplicate skills.
src/skill_mcp/dedup.py - Corpus hub · Downloads corpus assets and optional prebuilt indexes.
src/skill_mcp/hub.py
Other components
- Hugging Face · Optional corpus and index asset source.
- OpenAI · Optional hosted embedding provider.
- Ollama · Optional local-model embedding provider.
Connections 19
- MCP client → MCP server: stdio or SSE tool calls
- CLI → Config & data paths: resolves
- CLI → Corpus hub: pulls corpus/index
- CLI → Importers: imports local skills
- Corpus hub → Hugging Face: downloads from
- Importers → Skill model: parses skills
- Skill model → Deduplication: merged records
- Deduplication → SQLite skill store: persists unique skills
- SQLite skill store → FAISS index manager: new skill records
- FAISS index manager → Embedding backends: embeds for build/update
- MCP server → Hybrid retriever: semantic and keyword search
- MCP server → SQLite skill store: get full skill and categories
- Hybrid retriever → SQLite skill store: FTS and skill metadata
- Hybrid retriever → FAISS index manager: vector search
- Hybrid retriever → Embedding backends: embeds query
- Embedding backends → OpenAI: optional backend
- Embedding backends → Ollama: optional backend
- Config & data paths → SQLite skill store: data directory
- Config & data paths → FAISS index manager: artifact directory