Skip to content

Commit 27cb9ef

Browse files
gxklclaude
andcommitted
docs(wiki): record host-agnostic MCP McpRouter boundary
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 91b8614 commit 27cb9ef

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

wiki/log.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Dates use the workspace-local Asia/Shanghai calendar date.
44

5+
## [2026-07-10] package | host-agnostic MCP register via McpRouter boundary
6+
7+
- sources touched: `tegg/plugin/controller/src/lib/impl/mcp/{McpRouter,EggMcpRouter,MCPControllerRegister}.ts`, `tegg/plugin/controller/src/{app.ts,lib/ControllerModule.ts}`, `tegg/plugin/tegg/src/lib/ModuleHandler.ts`, `tegg/standalone/service-worker/src/mcp/{ServiceWorkerMcpRouter,MCPRegisterProvider}.ts`, `tegg/plugin/mcp-proxy/src/{app,index}.ts`
8+
- pages updated: `wiki/packages/service-worker.md`, `wiki/log.md`
9+
- note: Fixed the C4 host-boundary leak — the MCP controller register mixed record collection with egg-specific transport and the egg host threaded its `Application` into the module inner-object DI graph as a PRIVATE `eggApp` provided object. Extracted a `McpRouter` transport boundary: the shared `MCPControllerRegister` now only collects tool/resource/prompt records and calls `mcpRouter.registerServer(reg)`; egg node-HTTP transport moved to `EggMcpRouter` (built in `app.ts` with `app`), SW fetch transport to `ServiceWorkerMcpRouter`. Both provide the `mcpRouter` DI name (host plugins never coexist). `eggApp` provided object removed from `ModuleHandler`; `EggControllerRegisterFactory` dropped its host generic/injection. `MCPServerHelper` was already host-agnostic and is unchanged. Regression green (controller/service-worker/mcp-proxy/example/MultiApp) modulo a pre-existing controller boot-error test that only times out under the 5000ms suite-default and dal tests that need MySQL.
10+
511
## [2026-06-28] workflow | record egg-bin Windows shell probe hotspot
612

713
- sources touched: `tools/egg-bin/bin/run.js`, `tools/egg-bin/test/fixtures/my-egg-bin/bin/run.js`, PR #6014 CI logs

wiki/packages/service-worker.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ module-plugin mechanism (declarative `@InnerObjectProto` /
2626
Key mechanics and constraints:
2727

2828
- **Controller reuse**: metadata from `@eggjs/controller-decorator`,
29-
registration runtime from `@eggjs/controller-plugin` (shared with
30-
`@eggjs/controller-plugin`); only param binding and transports are
31-
fetch-specific.
29+
registration runtime from `@eggjs/controller-plugin` (shared); only param
30+
binding and transports are fetch-specific.
31+
- **Host-agnostic MCP register + `McpRouter` boundary**: the shared
32+
`MCPControllerRegister` (controller-plugin) only COLLECTS tool/resource/prompt
33+
records and delegates transport to an injected `McpRouter`
34+
(`registerServer(reg)`); it no longer touches `app`. The egg host's node-HTTP
35+
transport is `EggMcpRouter` (built imperatively in the controller plugin's
36+
`app.ts`, which holds `app`), the service worker's fetch transport is
37+
`ServiceWorkerMcpRouter`. Both provide the `mcpRouter` DI object; the two host
38+
plugins are never used together, so the shared name does not collide. Because
39+
the register needs no `app`, the egg host no longer provides `eggApp` as a
40+
module inner object — the Egg `Application` is out of the module DI graph.
3241
- **MCP SDK >= 1.29 stateless transports are single-shot** (reuse throws), so
3342
each MCP request builds a fresh `MCPServerHelper` + web-standard transport
34-
from register records collected at boot. The service worker uses
35-
`WebStandardStreamableHTTPServerTransport` (Request in, Response out) — no
36-
node req/res bridging. Auth is an `mcpAuthHandler` extension point
37-
(default: allow).
43+
from register records collected at boot. The service worker's
44+
`ServiceWorkerMcpRouter` uses `WebStandardStreamableHTTPServerTransport`
45+
(Request in, Response out) — no node req/res bridging. Auth is an
46+
`mcpAuthHandler` extension point (default: allow).
3847
- **Streaming lifecycle**: `FetchEventHandler` routes every response body
3948
through a passthrough and registers the drain as a background task, so ctx
4049
destroy waits (bounded by `config.backgroundTask.timeout`) until the client

0 commit comments

Comments
 (0)