Skip to content

feat: add MCP server mode (--mcp)#7

Merged
krsh merged 5 commits intomainfrom
feat/mcp-server
Mar 30, 2026
Merged

feat: add MCP server mode (--mcp)#7
krsh merged 5 commits intomainfrom
feat/mcp-server

Conversation

@algorni
Copy link
Copy Markdown

@algorni algorni commented Feb 23, 2026

Summary

  • Add MCP (Model Context Protocol) server mode via analyzer --mcp, enabling AI assistants (Claude, etc.) to use all Analyzer operations as structured tools over stdio JSON-RPC
  • New src/mcp.rs with 20 tools: object management, scan creation/status/score, paginated analysis results browsing, compliance checks, SBOM/report downloads, and configuration
  • Add rmcp and schemars dependencies, bump version to 0.2.1
  • Update README with MCP Server mode documentation and Claude Code configuration examples

MCP Tools

Objects: list_objects, create_object, delete_object
Scans: create_scan, get_scan_status, get_scan_score, get_scan_types, get_scan_overview, cancel_scan, delete_scan
Results: get_analysis_results (paginated, with search), get_compliance
Downloads: download_sbom, download_report, download_compliance_report
Config: configure_profile, config_get, config_set, whoami

Test plan

  • cargo build --release compiles successfully
  • analyzer --help shows --mcp flag
  • analyzer --mcp starts MCP server on stdio (verify with MCP inspector)
  • CLI commands still work as before (no regressions)
  • Configure in Claude Code and test tools interactively

Base automatically changed from feat/analysis-results to main February 25, 2026 14:47
Alberto Gorni and others added 2 commits March 6, 2026 09:49
Add Model Context Protocol (MCP) server that exposes all Analyzer CLI
operations as structured tools over stdio JSON-RPC. This enables AI
assistants like Claude to manage objects, create scans, browse paginated
analysis results, check compliance, download reports/SBOMs, and more.

- New src/mcp.rs with 20 MCP tools (objects, scans, results, config)
- Add --mcp flag to main CLI, route to MCP server before subcommands
- Add rmcp and schemars dependencies
- Update README with MCP Server mode docs and Claude Code config
- Bump version to 0.2.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…g tools

- Extract shared AnalysisType::from_api_name() and ComplianceType::from_name()
  so MCP reuses enum parsing instead of duplicating match arms
- Make resolve_analysis_id public, reuse from MCP instead of reimplementing
- All scan tools now accept object_id as alternative to scan_id, matching
  the CLI's --object flag and aligning with ELI's natural interaction model
- Remove configure_profile/config_get/config_set (config mutation is out
  of scope for AI agents); keep whoami for diagnostics
- Add [Read]/[Write]/[Critical] classification to tool descriptions,
  preparing for ELI's Permission Gate
- Fix &PathBuf -> &Path (Clippy), trim instructions block

Net -145 lines from mcp.rs.
@giovannialberto giovannialberto requested a review from krsh March 6, 2026 09:32
@giovannialberto
Copy link
Copy Markdown
Member

I cleaned up a few things here and there and changed some things to make sure that it's maintainable and aligned with our future plans. It's all tested and good to go for me. Adding @krsh as final reviewer.

Alberto Gorni and others added 2 commits March 24, 2026 21:53
- bump rmcp to 1.2.0 and fix non-exhaustive ServerInfo construction
- enable schemars uuid1 feature, use Uuid directly in MCP param structs (removes parse_uuid helper)
- fix score color logic: lower is better (0=green, 60+=red)
- add --mcp-format flag (json|text) for token-efficient analysis results output
- update README: MCP tools table, --mcp-format docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@krsh krsh merged commit a33530e into main Mar 30, 2026
4 checks passed
@krsh krsh deleted the feat/mcp-server branch March 30, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants