OpenSkillMapper
README.md
# OpenSkillMapper
**Universal, local-first, MCP-first engine for discovering, verifying, ranking, composing, and loading Agent Skills (`SKILL.md`).**
[](LICENSE)
[](pyproject.toml)
Any MCP-compatible model or agent can connect to OpenSkillMapper over standard **MCP `stdio`** or optional **Streamable HTTP** (`2025-03-26`) — with **zero host-specific adapters, zero background services, zero mandatory LLM/API calls, and zero runtime dependencies in the core library.**
---
## Core Capabilities
| Capability | OpenSkillMapper |
| --- | --- |
| **Single-call MCP retrieval** | `get_skills` discovers, ranks, abstains cleanly when no skill applies, suppresses duplicates/redundancy, re-verifies SHA-256 digests, and selectively loads relevant `SKILL.md` sections plus compact matching supporting files in one MCP call |
| **Standard protocols only** | Agent Skills (`SKILL.md`) + MCP `stdio` and Streamable HTTP (`2025-03-26` / `2024-11-05`), plus shared CLI (`openskillmapper` / `osm`) and Python API |
| **Trusted-source ingestion & on-demand updates** | Explicit allowlist (`local_dir` or full-SHA pinned `git_repo` with required `allowed_hosts`), `openskillmapper.lock/v1`, staged updates with automatic rollback, and on-demand discovery of newly released skills |
| **Mandatory license & security gates** | Deterministic SPDX license policy enforcement and static scanning (`OSM-SEC-*`: prompt injection, obfuscation, malicious scripts, supply-chain hooks, symlink/binary checks) |
| **Local-first hybrid search & composition** | Absolute-calibrated BM25 + TF-IDF n-grams + optional local embeddings; no-skill abstention, duplicate-name & marginal-coverage suppression, and section-aware token-budget loading |
---
## Installation
Requires **Python 3.10+** (zero mandatory runtime dependencies).
```bash
# Isolated CLI install with uv or pipx
uv tool install git+https://github.com/YucelPeynirci/OpenSkillMapper.git
# or
pipx install git+https://github.com/YucelPeynirci/OpenSkillMapper.git
# Local editable install for development
git clone https://github.com/YucelPeynirci/OpenSkillMapper.git
cd OpenSkillMapper
pip install -e .
# Optional extras
pip install -e ".[yaml]" # PyYAML frontmatter parser (pure-Python fallback included)
pip install -e ".[embeddings]" # Optional local FastEmbed dense vectors
pip install -e ".[dev]" # pytest test suite
```
Both `openskillmapper` and `osm` are installed as CLI entry points.
### Pinned Releases & Rollback
Downstream consumers should install a tested, pinned wheel (`uv build` / `python -m build --wheel`), verify its SHA-256 digest, and install it into an isolated environment (`pip install --no-deps dist/openskillmapper-<version>-py3-none-any.whl`). Keep prior verified wheels for one-command rollback.
---
## Quickstart
### 1. Ingest or Sync Trusted Skill Sources
```bash
# Ingest one or more local Agent Skills directories
openskillmapper ingest --dir ./skills --default-license Apache-2.0 --db .openskillmapper/catalog.db
# Sync pinned remote Git sources (full commit SHA + explicit allowed_hosts required)
openskillmapper sync --config examples/trusted-sources.json --db .openskillmapper/catalog.db
# On-demand check for newly released skills or upstream updates (no background services)
openskillmapper check-updates --config examples/trusted-sources.json --db .openskillmapper/catalog.db
openskillmapper update --config examples/trusted-sources.json --db .openskillmapper/catalog.db
# Verify on-disk SHA-256 tree integrity, lockfile alignment, and re-audit gates
openskillmapper verify --db .openskillmapper/catalog.db --lockfile .openskillmapper/openskillmapper.lock.json --reaudit
```
### 2. Serve Over Standard MCP (`stdio` or Streamable HTTP)
```bash
# Standard stdio MCP server (default)
openskillmapper mcp --db .openskillmapper/catalog.db
# Optional local Streamable HTTP MCP server (loopback-only by default)
openskillmapper mcp --db .openskillmapper/catalog.db --transport http --http-host 127.0.0.1 --http-port 8765
# Optional flags: enable on-demand source refresh and/or local audit_skill inside --allow-dir
openskillmapper mcp --db .openskillmapper/catalog.db --sources-config examples/trusted-sources.json --allow-dir ./skills-to-audit
```
**MCP tools exposed by default:**
- `get_skills`: Single-call discovery, relevance filtering, SHA-256 verification, and on-demand loading of matching `SKILL.md` bodies and supporting files within `token_budget`.
- `load_skill_file`: Paginated, SHA-256 verified reader for additional supporting files.
- `list_skills`: Lightweight catalog search/browse metadata (without loading bodies).
- Optional (enabled only when configured): `refresh_skills` (`--sources-config`) and `audit_skill` (`--allow-dir`).
- Standard MCP resources (`skill://<skill_id>` and `skill://<skill_id>/<path>`) are also exposed.
Connect any MCP-compatible client using standard MCP configuration (stdio command `openskillmapper mcp --db /path/to/catalog.db`, or HTTP endpoint `http://127.0.0.1:8765/mcp`).
For a client that accepts the common MCP server JSON format (use absolute paths):
```json
{
"mcpServers": {
"openskillmapper": {
"command": "openskillmapper",
"args": ["mcp", "--db", "/path/to/catalog.db"]
}
}
}
```
If the client does not inherit your shell PATH, use the absolute path of the installed executable. The agent must be configured to call get_skills when specialist guidance is useful; connecting the server does not guarantee autonomous retrieval.
#### Opt in to public discovery on catalog misses
```bash
openskillmapper mcp --db .openskillmapper/catalog.db \
--discovery-config examples/discovery.json --cache-dir .openskillmapper/sources
```
The same flags work with `openskillmapper load`. Omit `--discovery-config` to
disable online discovery. Review the example before use: `repositories` lists
GitHub `owner/repo` names whose public HEAD revisions you authorize for automated
verification. Use `providers` to enable `skills.sh`, `github`, or both. Neither
provider's search results constitute a trust or license decision.
Only a query-only load with insufficient verified local coverage can start an
online lookup. It shares the **first matching configured `public_topics` token**
from the first 8,192 characters, not the full query, local catalog, or credentials.
Providers can observe that public topic, client IP, and timing; only allow topics
you are willing to disclose. No topic match means no lookup. Searches and package
fetches use direct HTTPS without redirects or proxies.
The lookup examines at most 24 results per provider, three approved repositories,
and four candidate packages per attempt. It resolves GitHub HEAD to a commit and
tree and fetches only the selected package files and license evidence as Git blobs.
The package must pass blob integrity, license, provenance, and strict static audit
checks before it becomes available locally. For query matching, discovered skills
must also match at least two distinct normalized terms in their name or description
(one for a single-term query). Normal ranking and token limits still apply. Nothing
from upstream is executed. See [the discovery benchmark](benchmarks/DISCOVERY.md)
for fixture results and the limitations observed with live providers.
The attempt targets a 12-second network deadline, with at most 28 requests and
5 MiB of response bodies (plus one overflow-detection byte). OS DNS and individual
socket operations can overrun the deadline. `discovery` reports a status, request
count, response-body bytes, and reason codes when applicable. For example,
`no_approved_match` means the bounded search did not find a configured repository;
`github:rate_limited` means retry later; `package:license_rejected` means the
package did not satisfy the catalog's license policy. Providers can change their
results, availability, and limits, so discovery can abstain even for valid topics.
Verified packages and metadata are cached under `discovery/` in `--cache-dir`;
attempts are suppressed for five minutes on misses or errors and one hour on clean
success. Complete warm hits do not depend on provider availability. Use a cache
writable only by the server account. To reset it or recover `package_cache_full_or_damaged`,
stop all users of that cache and remove its `discovery/` directory. The base
catalog and lockfile are unchanged.
#### Legacy pinned-source discovery
Use this separately from `--discovery-config` when you want to scan preselected
Git sources rather than query public indexes.
```bash
openskillmapper mcp --db .openskillmapper/catalog.db \
--demand-sources-config examples/demand-sources.json \
--cache-dir .openskillmapper/sources
```
Use a separate, administrator-controlled registry of up to eight explicitly reviewed,
public open-source HTTPS Git repositories. Each entry needs an allowed host and full
initial commit SHA. Use a cache writable only by the server's account; servers sharing
the same registry and cache also share discoveries. To disable discovery, omit the flag;
to remove its cached data, stop the servers and delete the `demand/` directory in that cache.
The base catalog and its lockfile are never changed by this feature.
Query-only `get_skills` searches locally first. If nothing loads or query facets are
not fully covered, it tries at most one due source (least recently due first), then
reranks in the same call if the local catalog changed. Concurrent requests can use
the last published catalog without waiting for a network scan. Cached results are
also available by ID and via MCP resources. Other tools do not initiate discovery.
The query, local skills and credentials are not sent upstream. No repository code
is executed and there is no polling, web-wide search, or automatic trust of new sources.
An initial scan fetches the configured pin. After a successful scan, later misses
can check that same repository's public HEAD once per 24 hours; only a newly fetched,
full commit can replace the snapshot. Failed scans retry no sooner than 15 minutes.
Git commands share a five-second deadline per scan (local auditing and ranking are
separate). Checkout limits are 4,096 files, 16 MiB total, 512 KiB per file and 64 skill
directories per source; these are not limits on compressed Git transfer size.
Symlinks and submodules anywhere in the fetched tree are rejected. Skills must pass
provenance and integrity checks, have allowed license evidence in the fetched tree,
and have no static security findings. A registry license default is not evidence.
These gates are not a security guarantee. Discovery caches verified candidates from
a scanned source, not just matches for one query, but the response still uses normal
relevance filtering and the existing content budget. An eligible miss may return
nothing if the source is unavailable, over quota, or has no relevant verified skill.
### 3. CLI & Python API (Shared Core)
```bash
# Single-call discover + verified load from CLI
openskillmapper load "3p status update and brand guidelines" --db .openskillmapper/catalog.db --json
# Search, compose, audit, or uninstall verified skill directories
openskillmapper search "optimize slow postgresql queries" --db .openskillmapper/catalog.db --top-k 5
openskillmapper compose "audit security and tune sql" --db .openskillmapper/catalog.db --token-budget 4000
openskillmapper audit ./path/to/my-skill --json
openskillmapper uninstall <skill-dir-name> --dir ./installed-skills
```
```python
from openskillmapper import SkillCatalog, TrustedSource, RuntimeEnvironment
from openskillmapper.models import TrustTier
catalog = SkillCatalog()
catalog.ingest_source(
TrustedSource(
source_id="local-verified",
kind="local_dir",
location="./skills",
trust_tier=TrustTier.VERIFIED_LOCAL,
)
)
catalog.save_sqlite(".openskillmapper/catalog.db")
pack = catalog.discover_and_load("3p status update and brand guidelines", max_skills=3, token_budget=3000)
for skill in pack["loaded_skills"]:
print(skill["skill_id"], list(skill.get("loaded_files", {}).keys()))
```
---
## Benchmarks
Four benchmark groups cover retrieval, security/license gates, and end-to-end MCP agent runs:
1. **Real skill collection** ([`benchmarks/REAL_CORPUS.md`](benchmarks/REAL_CORPUS.md)): 63 verified skills from pinned `anthropics/skills` and `openclaw/openclaw` commits, 42 queries. Hybrid index reaches **0.905 Recall@1 / 1.000 Recall@3 / 0.952 MRR@5 / 0.965 NDCG@5** at **0.216 ms p50** (2.539 ms with live on-disk SHA-256 verification).
2. **Synthetic gate/retrieval suite** ([`benchmarks/RESULTS.md`](benchmarks/RESULTS.md)): 48 generated skills (16 malicious or non-compliant) testing security, license, tamper, and typo robustness.
3. **175-Skill Retrieval & Abstention Suite** ([`benchmarks/eval_retrieval.py`](benchmarks/eval_retrieval.py), [`benchmarks/AB_BENCHMARK.md`](benchmarks/AB_BENCHMARK.md)): 175 verified skills from 10 pinned open-source repositories, 40 queries (28 positive + 12 no-skill negative controls) compared against `simple_bm25`, `simple_tfidf`, and `sqlite_fts5` baselines. v0.5.0 improves selection F1 from **0.689 → 0.885** (beating the best simple baseline at 0.787), raises negative abstention from **0.000 → 1.000 (0 false positives, 0 spurious tokens)**, and cuts average loaded tokens on positive queries by **20.7%** (2,419 → 1,918).
4. **End-to-End Agent A/B Benchmark** ([`benchmarks/AB_BENCHMARK.md`](benchmarks/AB_BENCHMARK.md)): Controlled paired A/B comparisons separating **autonomous** MCP usage from **instructed** (neutral workflow hint) usage, recording actual skill retrieval (`skill_assisted`, `mcp_queried_no_load`, `unused_mcp`, `infra_failure`), and preserving all results including failures.
- On `claude-sonnet-5-5` (medium, 2 paired rounds): Arm B improved quality from **80/100 → 100/100** in both rounds while Round 2 optimizations cut MCP response bytes by **58.9%** and tokens by **33.1%**.
- On `claude-haiku-5-5` (medium, 22 paired runs across Rounds 1–5): in Round 5 against the **175-skill catalog** (9 paired runs across 3 tasks including a pure-Python no-skill negative control), Arm B scored **100/100 in 9/9 runs (0 MCP errors)**, improved `launch-pack-brand-comms-v1` from **80/100 → 100/100** across all 3 trials (10–41% faster, 0 irrelevant/duplicate skills), and abstained cleanly (`loaded_skills: []`) on 3/3 negative-control runs.
---
## Documentation & Security
- Architecture overview: [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)
- Security policy & threat model: [`SECURITY.md`](SECURITY.md)
- Trusted source manifest example: [`examples/trusted-sources.json`](examples/trusted-sources.json)
- Benchmarks: [`benchmarks/AB_BENCHMARK.md`](benchmarks/AB_BENCHMARK.md), [`benchmarks/REAL_CORPUS.md`](benchmarks/REAL_CORPUS.md), [`benchmarks/RESULTS.md`](benchmarks/RESULTS.md)
- Attribution & third-party notices: [`NOTICE`](NOTICE)
## Development & Testing
```bash
pip install -e ".[dev]"
pytest -q
```
## License
Licensed under the **Apache License, Version 2.0**. See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues