mcp: added path config, register at /api path by default to work with frameworks

This commit is contained in:
dswbx
2025-08-30 14:06:13 +02:00
parent d898018b49
commit 24eefa5357
10 changed files with 52 additions and 27 deletions

View File

@@ -24,6 +24,7 @@ export const serverConfigSchema = $object(
}),
mcp: s.strictObject({
enabled: s.boolean({ default: false }),
path: s.string({ default: "/api/system/mcp" }),
}),
},
{

View File

@@ -60,8 +60,9 @@ export class SystemController extends Controller {
register(app: App) {
app.server.route("/api/system", this.getController());
const config = app.modules.get("server").config;
if (!this.app.modules.get("server").config.mcp.enabled) {
if (!config.mcp.enabled) {
return;
}
@@ -97,7 +98,7 @@ export class SystemController extends Controller {
explainEndpoint: true,
},
endpoint: {
path: "/mcp",
path: config.mcp.path as any,
// @ts-ignore
_init: isNode() ? { duplex: "half" } : {},
},