You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(controller): host-agnostic MCP register via McpRouter boundary
The MCP controller register mixed record collection with egg-specific
transport (routes on app.router, ctxStorage, middleware, SSE/stream
state), and the egg host threaded its Application into the module
inner-object DI graph as a PRIVATE `eggApp` provided object so the
register could reach it — a host-boundary leak that undermines the
host-agnostic module-plugin goal.
Extract a `McpRouter` transport boundary (controller-core): the shared
`MCPControllerRegister` now only COLLECTS tool/resource/prompt records
and delegates transport to an injected router via `registerServer()`.
The egg node-HTTP transport moves to `EggMcpRouter` (constructed
imperatively in app.ts, which already holds `app`), and the service
worker fetch transport to `ServiceWorkerMcpRouter`; both provide the
`mcpRouter` DI name (the two host plugins are never used together, so no
qualifier is needed). MCPServerHelper was already host-agnostic and is
unchanged.
With the register no longer needing `app`, the `eggApp` provided inner
object is removed from ModuleHandler and EggControllerRegisterFactory
drops its host generic/injection — Egg Application leaves the DI graph.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments