SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

feat(mcp): expose SkillSpector as an MCP server with a scan_skill tool

Open CharmingGroot opened this issue 5 months ago • 2 comments

Adds an MCP server (skillspector mcp) that wraps the existing graph and exposes one tool, scan_skill, over stdio and HTTP. Lets an agent — Claude Code, Codex, Gemini, or a remote A2A runtime — scan a skill and gate the install on the result.

Opened #35 first per CONTRIBUTING; sending this alongside so there's something concrete to look at. Glad to change the naming or packaging based on what you decide there.

What's here:

  • mcp_server.py — run_scan() does the actual work and doesn't import the mcp SDK, so it's testable without the extra. build_server() wraps it in FastMCP; run() serves stdio or streamable HTTP.
  • cli.py — skillspector mcp --transport stdio|http.
  • pyproject.toml — mcp as an optional extra so the core deps don't grow, plus it's in dev so CI exercises it. uv.lock updated (additions only).

The verdict includes llm_used / scan_mode, so a static-only scan (e.g. no credentials) doesn't get mistaken for a clean full scan — related to #3 / #4 / #9.

I also noticed the TODO(SADD A.5.1) for a FastAPI skillspector serve. This is deliberately a separate surface (mcp, not serve) so the two don't collide; happy to fold it into serve later if you'd prefer.

Tested: unit tests for the verdict shape and the llm-accounting cases, plus a stdio client round-trip and the HTTP server run locally. ruff clean, unit suite passes.

pip install "skillspector[mcp]"
skillspector mcp                                # stdio
skillspector mcp --transport http --port 8000   # remote / A2A

Commits are DCO signed-off.

CharmingGroot avatar Jun 13 '26 05:06 CharmingGroot

Please resolve. merge conflicts

rng1995 avatar Jun 23 '26 12:06 rng1995

Rebased onto current main — conflicts in cli.py resolved by preserving both the upstream multi-skill scanning functions (_build_trace_config, _scan_multi_skill) and the mcp command added in this PR. uv.lock regenerated. Ready to merge.

CharmingGroot avatar Jun 24 '26 01:06 CharmingGroot

Seeing another conflict to resolve

rng1995 avatar Jun 24 '26 06:06 rng1995

Resolved merge conflict with upstream/main (baseline command, #106).

One file had a conflict:

  • src/skillspector/cli.py: both sides added a new @app.command() function after the same anchor point. Resolution: kept both — mcp() (this branch) and baseline() (upstream), each with its own @app.command() decorator.

No logic changes. Full unit test suite: 935 passed, 2 pre-existing failures in test_meta_analyzer.py that exist on upstream/main itself (unrelated to this branch).

CharmingGroot avatar Jun 24 '26 07:06 CharmingGroot