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

@@ -1,17 +1,5 @@
import { McpClient, type McpClientConfig } from "jsonv-ts/mcp";
import { Draft2019 } from "json-schema-library";
const clients = new Map<string, McpClient>();
export function getClient(
{ url, ...opts }: McpClientConfig = { url: window.location.origin + "/mcp" },
) {
if (!clients.has(String(url))) {
clients.set(String(url), new McpClient({ url, ...opts }));
}
return clients.get(String(url))!;
}
export function getTemplate(schema: object) {
if (!schema || schema === undefined || schema === null) return undefined;