Skip to content

Commit 152ccf1

Browse files
committed
fix: controller
1 parent fb0f5c8 commit 152ccf1

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

plugin/controller/agent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export default class AppHook {
88
}
99

1010
async didLoad() {
11-
await (this.agent.mcpProxy as any)?.ready();
11+
if (this.agent.mcpProxy) {
12+
await (this.agent.mcpProxy as any)?.ready();
13+
}
1214
}
1315
}

plugin/controller/app.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default class ControllerAppBootHook {
4242
return new EggControllerLoader(unitPath);
4343
});
4444
this.controllerRegisterFactory.registerControllerRegister(ControllerType.HTTP, HTTPControllerRegister.create);
45-
this.controllerRegisterFactory.registerControllerRegister(ControllerType.MCP, MCPControllerRegister.create);
4645
this.app.loadUnitFactory.registerLoadUnitCreator(
4746
CONTROLLER_LOAD_UNIT,
4847
(ctx: LoadUnitLifecycleContext): ControllerLoadUnit => {
@@ -63,8 +62,11 @@ export default class ControllerAppBootHook {
6362

6463
// init http root proto middleware
6564
this.prepareMiddleware(this.app.config.coreMiddleware);
66-
// Don't let the mcp's body be consumed
67-
this.app.config.coreMiddleware.unshift('mcpBodyMiddleware');
65+
if (this.app.mcpProxy) {
66+
this.controllerRegisterFactory.registerControllerRegister(ControllerType.MCP, MCPControllerRegister.create);
67+
// Don't let the mcp's body be consumed
68+
this.app.config.coreMiddleware.unshift('mcpBodyMiddleware');
69+
}
6870
}
6971

7072
prepareMiddleware(middlewareNames: string[]) {
@@ -88,7 +90,9 @@ export default class ControllerAppBootHook {
8890
// and register methods after collect is done.
8991
HTTPControllerRegister.instance?.doRegister(this.app.rootProtoManager);
9092

91-
await (this.app.mcpProxy as any)?.ready();
93+
if (this.app.mcpProxy) {
94+
await (this.app.mcpProxy as any)?.ready();
95+
}
9296
}
9397

9498
async beforeClose() {

plugin/controller/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"name": "teggController",
55
"strict": false,
66
"dependencies": [
7-
"tegg",
8-
"mcpProxy"
7+
"tegg"
98
]
109
},
1110
"version": "3.53.0",

0 commit comments

Comments
 (0)