feat(asm/mhp): wire MCP into Claude CLI subprocess + bootstrap mcp-host-side-proposals#431
Open
Luis85 wants to merge 21 commits into
Open
feat(asm/mhp): wire MCP into Claude CLI subprocess + bootstrap mcp-host-side-proposals#431Luis85 wants to merge 21 commits into
Luis85 wants to merge 21 commits into
Conversation
…irror to .mcp.json Previously the in-process MCP server (ADR-013/ADR-018) ran on a loopback port but the Claude CLI subprocess was never told about it. The embedded agent reported no available MCP servers, and a `claude` session launched from a terminal inside the vault saw nothing either. This change: - Adds INV-7 to `buildSubprocessArgs`: when a non-empty `mcpConfigJson` payload is supplied, the assembler emits `--mcp-config <json>` so the Claude CLI loads it as a per-invocation MCP server map. - Threads `getMcpConfigJson` through `ClaudeSubprocessAdapter` and `runSubprocessStructured`. Adapter reads it on every spawn so toggling `mcpServerEnabled` or restarting the loopback server takes effect on the next turn without reinstantiating the transport. - Adds optional `onMcpServerStarted` / `onMcpServerStopped` hooks to `PluginCore` so the host plugin can react to MCP lifecycle changes without leaking the adapter reference. - Plugin wires the hooks to mirror the loopback URL into `.mcp.json` at the vault root (opt-out via the new `writeProjectMcpConfig` setting + UI toggle). Uses the low-level vault adapter so dotfiles overwrite cleanly across restarts. The result is terminal-CLI parity: a `claude` session launched inside the vault picks up the same MCP server as the embedded Specorator sidepanel, automatically.
…facts Closes the gap between the orphaned MCP `ProposalStore` and any client (Specorator sidepanel, Claude Desktop, terminal `claude`, Cursor): - Adds `specs/mcp-host-side-proposals/workflow-state.md` (stage: idea, area: MHP) tracking GitHub issue #430. - Adds `issues/430-mcp-host-side-proposals.md` as the local PRD shadow of the GitHub issue. - Lands `discovery/obsidian-cli-mcp-expansion/` — 7 cross-perspective research artifacts (analyst, critic, divergent-thinker, ux-designer, product-strategist, game-designer, user-researcher) plus SYNTHESIS.md with the phased recommendation that drives this feature's scope. The feature itself (proposal_list/get/accept/reject tools, Tier-A read expansion, DevTools opt-in surface, ADR-019 tier policy) follows the standard /spec:idea → /spec:research → … pipeline starting from this commit.
…opt-in) - Part A (ux-designer): 7 flows F1-F7, IA, states, accessibility - Part B (ui-designer): 3 new components + 1 modification; 7 NFR-MHP-011 contrast assertions; ~40 microcopy strings authored - Part C (architect): 12 components, 8 data types, 4 MCP tool contracts, 8 key decisions, 9 rejected alternatives, 15 risks (5 new) - Cross-cutting requirements coverage: 60 rows, no orphan REQs - requirements.md amended: 7 reworded (REQ-MHP-013/-027/-030/-031/-034/-038 + NFR-MHP-003) + 6 new (REQ-MHP-041..046) - ADR-019 authored (Proposed, ~3150 words): tier policy, permanent deny-list, DevTools opt-in matrix, per-tool threat paragraphs verbatim Gate: PASS. Handoff to architect for /spec:specify.
…009/-030/-070/-110/-122/-131/-141/-142)
…-111/-123/-130/-132)
…, surfacing, audit triggers); 3000+ tests
…ton/SpDropdownPanel callers
…lient) Uses @modelcontextprotocol/sdk Client + StreamableHTTPClientTransport to drive the real ObsidianMcpServerAdapter — same wire protocol any external client (Claude Desktop, Cline, Cursor, MCP Inspector) uses. Exercises full proposal lifecycle: tools/list, write→pending, list, get, accept→vault mutation, double-accept→already_decided, reject, unknown id→proposal_not_found. Validates the user-facing goal: "you can use the mcp in whatever client I use".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bundled changes (per
/spec:startdirection to bundle code + spec scaffold):1. MCP wiring fix (ASM)
The in-process MCP server (ADR-013/ADR-018) ran on a loopback port but the Claude CLI subprocess was never told about it. The embedded sidepanel agent reported "no MCP servers" and a terminal
claudelaunched inside the vault saw nothing either.buildSubprocessArgsgains INV-7: emit--mcp-config <json>when caller supplies a non-empty payload.ClaudeSubprocessAdapter+runSubprocessStructuredaccept agetMcpConfigJsondep, read on every spawn so togglingmcpServerEnabledtakes effect on the next turn.PluginCoregains optionalonMcpServerStarted/onMcpServerStoppedlifecycle hooks (mirrorsisMcpServerEnabled)..mcp.jsonat the vault root via the low-level vault adapter (so dotfiles overwrite cleanly across restarts). Opt-out via newwriteProjectMcpConfigsetting + UI toggle.claudesession launched inside the vault picks up the same MCP server as the embedded Specorator sidepanel.2. mcp-host-side-proposals feature bootstrap (MHP)
Closes #430 (eventually). The MCP
ProposalStoreis currently orphaned — no UI callsacceptProposal/rejectProposal, so writes from any client (sidepanel, Claude Desktop, terminalclaude, Cursor) queue and never commit. This PR lays the scaffolding:specs/mcp-host-side-proposals/workflow-state.md(stage: idea, area: MHP)issues/430-mcp-host-side-proposals.md(local PRD shadow)discovery/obsidian-cli-mcp-expansion/— 7 cross-perspective research artifacts +SYNTHESIS.mdwith the phased recommendation that drives the feature's scopeThe feature itself follows the standard
/spec:idea → /spec:research → …pipeline starting from this commit.Test plan
npm run typecheckcleannpm run lint0 errors (warnings unchanged)npm run test2613/2613 pass (+13 new)D:\TestVaultviabuild:deployspecoratorMCPclaudeinside vault picks up.mcp.json.mcp.jsoncleanly overwrites on restart (dotfile-adapter path)--mcp-configonly when payload non-emptyonMcpServerStoppedremoves.mcp.jsonwhen toggle flipped offRelated
discovery/obsidian-cli-mcp-expansion/SYNTHESIS.md