feat(devframe): serve MCP by default when an agent surface exists - #332
Conversation
◈ PR Lens
Architecture 9 components touched across 4 lanes. Inside the changed components — 2 viewsComponent view — Single-Tool Agent Lifecycle Internal orchestration within Devframe Core Engine checking agent surface presence before lazily loading the MCP adapter and mounting the HTTP route. Component view — Hub Aggregate MCP Mounting Hub orchestration validating mounted devframe configurations and auto-mounting the aggregate MCP endpoint when any mounted frame or command exposes agent tools. Data flow
The other flows — 1 sequence
Drill down
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c4b5897 to
51623a2
Compare
51623a2 to
d31fa13
Compare
Intent
Make MCP a default feature of devframe — strengthening the "one tool, two views for the human and the coding agent" story — without taxing devframes that never expose an agent surface or users who explicitly disable MCP.
This PR carries both the plan (
plans/008-default-on-mcp.md, registered in the plans index) and its implementation, executed after plans 002 (MCP HTTP authentication) and 003 (state exposure policy) landed on main.The
'auto'defaultThe omitted
mcpsetting now resolves to'auto'ininitDevframe,initHub,createDevServer, and the framework kits: the Streamable-HTTP route mounts at<base>__mcpexactly whenagent-flagged RPC, or a tool/resource/provider-yielded tool onctx.agent(newDevframeAgentHost.hasSurface()), and@modelcontextprotocol/serverresolves.A devframe with nothing flagged mounts no route and loads zero MCP code (extended bundle guard proves it); a flagged surface with the peer missing warns once (new
DF0077) instead of mounting. Explicit values keep their meaning:trueforces on (missing peer stays theDF0017startup failure),false/--no-mcpforce off, an object customises — and'auto'mounts with exactlymcp: true's posture (loopback origin gate;authorizationremains the opt-in hardening from plan 002), so the default grants no extra reach.Reconciliation with plan 002 as landed
The plan as first drafted gated
'auto'onDEVFRAME_MCP_AUTH_TOKEN, written against plan 002's draft contract (mandatory bearer). Plan 002 landed with origin-only as the blessed same-machine default andauthorizationas opt-in hardening, so'auto'follows the landed contract; the plan document records the reconciliation.Product layer
agentfield,@modelcontextprotocol/serverships in its dependencies, and the README explains the two views.hub-nextdrops its explicitmcp: true(the default now covers it) andhub-vite's README documents the aggregate endpoint it now serves;files-inspectorrelies on the default too.DF0077page added,DF8005updated to the new hub semantics (warns only under explicitmcp: false).Verification
pnpm lint,pnpm knip,pnpm test(full suite, 124 files / 1419 tests),pnpm typecheck, andpnpm buildall pass; tsnapi snapshots refreshed with only the intended surface (McpSetting,hasSurface,DF0077,loadAutoMcpAdapter).Created with the help of an agent.