auto generated tools docs, added stdio transport, added additional mcp config and permissions

This commit is contained in:
dswbx
2025-08-09 14:14:51 +02:00
parent 170ea2c45b
commit cb873381f1
25 changed files with 3770 additions and 87 deletions

View File

@@ -14,6 +14,7 @@ import {
InvalidSchemaError,
openAPISpecs,
mcpTool,
mcp as mcpMiddleware,
} from "bknd/utils";
import type { Context, Hono } from "hono";
import { Controller } from "modules/Controller";
@@ -27,6 +28,7 @@ import {
import * as SystemPermissions from "modules/permissions";
import { getVersion } from "core/env";
import type { Module } from "modules/Module";
import { getSystemMcp } from "./system-mcp";
export type ConfigUpdate<Key extends ModuleKey = ModuleKey> = {
success: true;
@@ -52,6 +54,32 @@ export class SystemController extends Controller {
return this.app.modules.ctx();
}
register(app: App) {
app.server.route("/api/system", this.getController());
if (!this.app.modules.get("server").config.mcp.enabled) {
return;
}
this.registerMcp();
const mcpServer = getSystemMcp(app);
app.server.use(
mcpMiddleware({
server: mcpServer,
sessionsEnabled: true,
debug: {
logLevel: "debug",
explainEndpoint: true,
},
endpoint: {
path: "/mcp",
},
}),
);
}
private registerConfigController(client: Hono<any>): void {
const { permission } = this.middlewares;
// don't add auth again, it's already added in getController