feat!: move the MCP implementation into the optional @devframes/agentic peer (0.10) - #391
Conversation
◈ PR Lens
Architecture 11 components touched across 5 lanes. Inside the changed components — 2 viewsComponent view — MCP Server & Route Subsystem Lazy-loading MCP adapter and shared schema converters extracted into @devframes/agentic/mcp Component view — CLI Discovery Gateway Subsystem Dynamic loading of the MCP discovery gateway by devframe connect Data flow
The other flows — 1 sequence
View
Tip The CLI's 🪧 More tips
Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c1d10f5 to
aa52aaa
Compare
…ic peer The MCP implementation, the connect gateway, and the MCP SDK behind them move out of devframe into the new @devframes/agentic package, an optional peer of devframe and @devframes/hub. devframe stays slim; installing the peer is what turns the agent surface on. Users never import agentic: devframe/adapters/mcp stays the user-facing API and loads the peer lazily. - @devframes/agentic ships /mcp and /connect entries consumed by devframe's loaders; the bare root throws. Signatures are typed against devframe's own contract, so no SDK type leaks and the SDK stays swappable. - The mcp enable matrix: 'auto' mounts iff the agent surface is non-empty AND the peer resolves (missing peer: one DF0078 warning per process); an explicit setting - or importing devframe/adapters/mcp - throws DF0079 without the peer; false stays silent. - devframe/adapters/mcp keeps its exports unchanged, built in its own graph so its top-level await cannot reshape the server chunking. - The peer probe routes through resolveServicePackage (an opaque-parameter createRequire), not a literal createRequire(import.meta.url).resolve, which turbopack rewrites into a throwing stub inside a bundled Next hub. - Pure agent projections (to-json-schema, stringify) stay in devframe under src/agent/, shared by browser WebMCP and agentic via devframe/internal. - devframe drops @modelcontextprotocol/server (dep) and /client (optional peer); DF0046 now points at @devframes/agentic. The reference hubs install the peer, as any consumer wanting MCP now does.
aa52aaa to
d85cd90
Compare
Replaces the alias's top-level await with a per-function lazy import: importing the entry is now side-effect-free (DF0079 moves to call time), and without TLA the entry rejoins the main server build graph, dropping the isolated tsdown config. createMcpFetchHandler and mountMcpHttp become async through this entry; the migration guide covers the added await.
…c peer Replaces the per-function lazy import with a plain re-export of @devframes/agentic/mcp, keeping the implementation's synchronous signatures. Importing the entry without the peer now throws module-not-found, matching the devframe/adapters/cac precedent for optional peers; first-party adapters keep the coded DF0078/DF0079 lazy-load path.
What
Targets v0.10. Introduces
@devframes/agentic, a new package that owns the agent-surface implementation (the MCP adapter, thedevframe connectgateway, and the MCP SDK behind them) as an optional peer ofdevframeand@devframes/hub.devframe/adapters/mcpstays the user-facing API. Users install@devframes/agenticto enable the agent surface but never import it: devframe probes for the peer and lazy-loads it (importRuntimeModule), so neither agentic nor the SDK ever enters a consumer bundle graph. The agentic bare root throws with a pointer at the user-facing API; its/mcpand/connectsubpaths exist for devframe's loaders.The exported signatures are typed against devframe's own contract (
types/mcp.ts+internal), so no SDK type leaks and the SDK can be swapped inside agentic later without a breaking change.The enable matrix
mcpsetting'auto'agent.hasSurface()true/ route objectfalseImporting
devframe/adapters/mcpitself without the peer also throws DF0079.devframe connectthrows DF0046 (retargeted from the former@modelcontextprotocol/clientpeer).Migration guide
Ships with a new
migration-0.10upgrade guide (newest-first, existing guides renumbered): install@devframes/agentic, imports unchanged, the missing-peer matrix, thedevframe connectpeer swap, and dropping a direct@modelcontextprotocol/clientinstall.Notable implementation points
resolveServicePackage(opaque-parametercreateRequire), not a literalcreateRequire(import.meta.url).resolve(...)— turbopack rewrites the latter into a throwing stub inside a bundled Next hub, which broke the aggregate MCP endpoint incustom-hub-next.devframe/adapters/mcpis a plain static re-export of@devframes/agentic/mcp— synchronous signatures preserved; importing it without the peer throws module-not-found, matching thedevframe/adapters/cacprecedent for optional peers.to-json-schema,stringify) stay in devframe undersrc/agent/, shared by browser WebMCP (still zero-install) and agentic viadevframe/internal.McpConnectionInfojoining the shared contract indevframe/types.Breaking (0.10)
@devframes/agentic(see matrix above); imports are unchanged.devframeno longer depends on@modelcontextprotocol/servernor peer-depends on@modelcontextprotocol/client.All gates pass:
lint,knip,test,typecheck,build, and the full e2e suite locally; CI green.Created with the help of an agent.