ADR-0003: Agentic MCP Server (vpp mcp) & SEP-1865 Workbench Seam
- Status: Accepted
- Date: 2026-11-30
- Deciders: Quashawn Ashley
- Tags: mcp|agentic|security|ui|remediation|schema
Context
VulnParse-Pin v2.0.x persists deduplicated findings, threat-intelligence snapshots, dual-track score_trace rationales, triage_decisions, and hash-chained ledger_events in .vpp.db (DuckDB), and interactively surfaces them via vpp ui and Decision Defense Dossiers. Engineering and SecOps teams increasingly triage vulnerabilities inside AI-assisted IDEs and agent workflows, where shell-scraping unstable CLI stdout or granting agents raw filesystem/SQL access introduces security and audit risks:
- Direct DuckDB write access or unverified deferral mutations bypass
DecisionsRegistryassumptions and corrupt tamper-evident audit chains. - Unbounded HTTP transports expose local scan workspaces to Cross-Site WebSocket Hijacking (CSWSH), DNS rebinding, or unauthenticated LAN access.
- Heavy runtime dependencies or external CDN assets in agentic UIs violate air-gapped enclave requirements and Apache-2.0 supply-chain hygiene.
A dedicated, fail-closed Model Context Protocol (MCP) seam is required so AI clients and humans can inspect findings, simulate minimum-patch remediations, verify RunManifest digests, and view interactive triage workbenches with zero external network calls.
Decision
Implement a zero-dependency-by-default stdlib JSON-RPC 2.0 MCP server (vpp mcp) in src/vulnparse_pin/mcp/ paired with a self-contained SEP-1865 MCP App UI (ui://vpp/workbench.html) and a turn-key IDE/assistant plugin bundle (plugins/vpp-mcp/):
- Read-Only Default (
src/vulnparse_pin/mcp/tools.py,src/vulnparse_pin/cli/commands.py):vpp mcpopens.vpp.dbwithVppDatabase(..., read_only=True)unless--allow-writeis explicitly passed.- Seven read-only inspection, explanation, simulation, diff, and verification tools are exposed by default:
vpp_run_overview: Run KPI counts, priority lane breakdown (P1,P1B,P2,P3,P4), KEV/Pre-KEV counts, shadow asset counts, and topRemediation@1.0actions.vpp_query_findings: Paged findings query parameterized byrun_id,priority,track,in_kev,pre_kev,unmatched_shadow,search,limit, andoffset.vpp_explain_finding: Detailedscore_trace(includingml_aciattributions and Pre-KEV signals), SSVC decision path, merged scanner evidence, and linked remediation actions.vpp_remediation_plan: RankedRemediation@1.0minimum-patch actions (upgrade_package,rebuild_image,remediate_service,fix_code_location).vpp_simulate_remediation: Read-only counterfactual risk-reduction simulator supporting selectors (action_ids,top_n,action_types,target_filter) and goal-seeking presets (goalinclear-kev/clear-p1/clear-3day/clear-pre-kev/risk-pctwithtarget_risk_pct), returningbefore/after/delta,by_sla,by_priority,by_asset,unresolved_kevs,unresolved_pre_kevs,burn_down_curve, andgoal_summary(preserving the exact 7 read-only / 10 write-enabled tool surface).vpp_diff_and_drift: Scan-over-scan comparison and--re-enrich/pre-kev/stale-assumptiondrift evaluation across DuckDB runs.vpp_verify_manifest: Read-onlyRunManifestschema, digest, ledger hash-chain, and confined artifact verification.
- Opt-In Write Tools (
--allow-write):- Three mutating tools remain disabled (returning
ToolDisabledError/ JSON-RPC-32601/ error response if called) unless--allow-writeis passed:vpp_scan_and_diff: Offline scan pipeline ingestion into.vpp.dbwithPermFileHandlerpath confinement (--workspace-root,--forbid-symlinks-read,--forbid-symlinks-write).vpp_propose_deferral: Enforces non-empty falsifiableassumptions,owner, and futureexpires_at, updatesdecisions.yaml/triage_decisions, and appends a hash-chainedMCP_DEFERRAL_PROPOSED(DecisionReasonCodes) event toledger_events.vpp_export_dossier: Exportsdossier-md,dossier-html,roadmap-md,roadmap-html,remediation-json,remediation-md,csv, orjsonconfined inside the workspace root.
- Three mutating tools remain disabled (returning
- Hardened Transports (
src/vulnparse_pin/mcp/server.py,src/vulnparse_pin/ui/gui_server.py):stdio(default): Pure JSON-RPC 2.0 over stdin/stdout (supporting protocol versions2025-11-25,2025-06-18,2025-03-26,2024-11-05) with4 MiB(MAX_MESSAGE_BYTES) frame cap,MAX_BATCH_ITEMS=64,MAX_JSON_DEPTH=64,allow_nan=Falseserialization, sanitized-32603internal error replies, and strict stdout isolation (all logs, banners, and diagnostics routed tostderr).streamable-http&vpp guiloopback HTTP:vpp mcp --transport streamable-httpbinds127.0.0.1:8765(VppMcpHttpServer) andvpp guibinds127.0.0.1:8787(VppGuiHttpServer), both backed byThreadingHTTPServer,MAX_HTTP_CONCURRENCY=32(BoundedSemaphore(32)returning503when saturated), andHTTP_SOCKET_TIMEOUT=15.0s.validate_http_security()refuses non-loopback--hostbindings unless--auth-token-envnames a set secret of at least 16 characters, verified per request via constant-timehmac.compare_digeston BearerAuthorization. Per-requestHttpSecurityPolicyvalidatesHostandOriginheaders to block DNS-rebinding and CSWSH attacks, enforces415(Content-Type: application/json),501(Transfer-Encodingrejected),400on duplicate headers (Host,Origin,Authorization,Content-Type,Content-Length,X-VPP-CSRF),413above4 MiB, andallow_nan=False.vpp guiadditionally enforces a per-process 256-bitX-VPP-CSRFtoken (secrets.token_urlsafe(32)verified viahmac.compare_digestonPOST /api/rpc),X-Frame-Options: DENY, andContent-Security-Policy: ... frame-ancestors 'none'.
- Unified 3-Mode, 6-Tab Workbench (
src/vulnparse_pin/mcp/ui_app.py):render_workbench_html()serves a zero-CDN, DOM-only (createElement/textContent) 7-tab interface (1. Overview,2. What-If Simulator,3. Findings & Trace,4. Assets & Shadow IT,5. Deferrals & Waivers,6. Diff & Drift,7. Exports & Proof) across three modes:mode="mcp": Exposesui://vpp/workbench.html(WORKBENCH_MIME_TYPE = "text/html;profile=mcp-app") wired via_meta.ui(workbench_entrypoint_metaonvpp_run_overview,workbench_inline_metaonvpp_explain_findingandvpp_remediation_plan, andvisibility: ["model", "app"]onvpp_simulate_remediation) withWORKBENCH_RESOURCE_META(connectDomains: [],resourceDomains: []),<meta>CSPconnect-src 'none', andinitRpcId-gatedhostOriginlatching.mode="loopback": Powersvpp gui(src/vulnparse_pin/ui/gui_server.py) withconnect-src 'self',X-VPP-CSRF, client-side in-memory exports (zero server disk writes), and write-gated modals (--allow-write) backed byMcpToolDispatcher.mode="static-simulator": Powers standalone offlinesimulator-htmlexports (vpp export --format simulator-html,vpp simulate --output-html, andvpp guiexports) with<meta>CSPconnect-src 'none'and<script id="vpp-sim-snapshot" type="application/json">escaped via_escape_json_for_script_tag().
- Plugin & Packaging (
plugins/vpp-mcp/,pyproject.toml):- Ships
plugins/vpp-mcp/{plugin.json,mcp_config.json,.mcp.json,README.md,skills/vpp-triage/SKILL.md}for instant integration overvpp mcp --transport stdio --db .vpp.db. - Declares optional
mcp = ["mcp>=1.6.0"]extra inpyproject.tomland defaults container builds (Dockerfile) toEXTRAS="ui,mcp", while keeping runtime operational with stdlib alone when optional extras are absent.
- Ships
Alternatives Considered
- Require official
mcpPython SDK (FastMCP) as a mandatory core dependency:- Pros: Built-in transport scaffolding.
- Cons: Increases core install footprint for CI pipelines that only run
vpp scan/vpp diffand blocks minimal headless or air-gapped environments lacking optional wheels.
- Expose DuckDB SQL queries directly to MCP clients (
vpp_sql):- Pros: Arbitrary ad-hoc querying.
- Cons: Weakens read-only guarantees, risks SQL injection or schema coupling across
v2.0.x/v2.1migrations, and bypassesPermFileHandlerconfinement andRunManifestaudit semantics.
Consequences
Positive:
- Core headless installs keep zero new mandatory dependencies while
vpp mcpworks out of the box. - Default read-only posture prevents unapproved agent mutations; opt-in deferrals require falsifiable assumptions and leave hash-chained
MCP_DEFERRAL_PROPOSEDaudit trails. - Air-gapped enclaves and enterprise hosts get deterministic DNS-rebinding protection, constant-time Bearer auth for non-loopback HTTP, and a zero-CDN SEP-1865 HTML workbench.
Negative:
- Protocol handler maintenance for JSON-RPC 2.0
stdioandstreamable-httplives in first-party code (src/vulnparse_pin/mcp/server.py) alongside unit tests tracking MCP protocol revisions. - Tool schema updates require keeping
plugins/vpp-mcp/skills/vpp-triage/SKILL.mdandui_app.pysynchronized.
Compatibility & Licensing Impact
- Classification:
additive - Affected contracts: New CLI subcommand
vpp mcp; new MCP JSON-RPC 2.0 tool/resource seam (ui://vpp/workbench.html); additiveMCP_DEFERRAL_PROPOSEDledger reason code; additive DuckDBremediation_actions/remediation_action_findingstables (all read-only MCP queries gracefully inspectinformation_schemaon legacyv2.0.x.vpp.dbfiles). - Clean-room Apache-2.0 dependency compliance verified:
yes(pure Python stdlib runtime; optionalmcp>=1.6.0is MIT). - Migration guidance: Existing
v2.0.x.vpp.dbworkspaces work read-only withvpp mcpwithout migration; re-runningvpp scanpopulatesRemediation@1.0tables automatically.
Test and Validation Plan
- Contract & schema tests: JSON-RPC
initialize,tools/list,resources/list,resources/read(ui://vpp/workbench.html), read-only 7-tool vs--allow-write10-tool filtering, and legacyv2.0.xDB read-only queries (tests/test_mcp_server.py). - Security / adversarial tests: Write tool rejection when
--allow-writeis off, non-loopback HTTP startup refusal without 16+ char--auth-token-env, Bearer timing check (401/403),Host/OriginDNS-rebinding rejection,PermFileHandlertraversal/symlink rejection,4 MiBoversized payload413handling,vpp_propose_deferralrejection of missingassumptionsor pastexpires_at, and zero-CDN CSP assertion (tests/test_mcp_server.py). - Runtime verification: Live
vpp mcp --db <demo.db>stdio round-trip (initialize->tools/callvpp_remediation_plan->resources/readui://vpp/workbench.html) ensuring zero stdout contamination.
Rollout and Rollback
- Rollout: Shipped enabled in
v2.1.0(read_only=True,stdiodefault); users opt in explicitly to--transport streamable-httpand--allow-write. - Rollback: Disable MCP integration by not invoking
vpp mcp; no corevpp scan,vpp diff, orvpp verifypaths depend on the MCP package.