added initial $record

This commit is contained in:
dswbx
2025-08-05 13:20:00 +02:00
parent 5e5f0ef70f
commit 3e2938f77d
13 changed files with 430 additions and 148 deletions

View File

@@ -26,6 +26,7 @@ import {
} from "modules/ModuleManager";
import * as SystemPermissions from "modules/permissions";
import { getVersion } from "core/env";
import type { Module } from "modules/Module";
export type ConfigUpdate<Key extends ModuleKey = ModuleKey> = {
success: true;
@@ -357,4 +358,46 @@ export class SystemController extends Controller {
return hono;
}
override registerMcp() {
const { mcp } = this.app.modules.ctx();
const { version, ...appConfig } = this.app.toJSON();
mcp.resource("system_config", "bknd://system/config", (c) =>
c.json(this.app.toJSON(), {
title: "System Config",
}),
)
.resource(
"system_config_module",
"bknd://system/config/{module}",
(c, { module }) => {
const m = this.app.modules.get(module as any) as Module;
return c.json(m.toJSON(), {
title: `Config for ${module}`,
});
},
{
list: Object.keys(appConfig),
},
)
.resource("system_schema", "bknd://system/schema", (c) =>
c.json(this.app.getSchema(), {
title: "System Schema",
}),
)
.resource(
"system_schema_module",
"bknd://system/schema/{module}",
(c, { module }) => {
const m = this.app.modules.get(module as any);
return c.json(m.getSchema().toJSON(), {
title: `Schema for ${module}`,
});
},
{
list: Object.keys(this.app.getSchema()),
},
);
}
}