MCP: у каждого коннектора KH Build своя иконка и название (serverInfo.icons/title)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { HttpError, type TodoCore } from "./core.js";
|
||||
|
||||
/** Иконка коннектора (MCP serverInfo.icons): у каждого MCP KH Build свой цвет и знак, чтобы не путать их в списке коннекторов. */
|
||||
const MCP_ICON = "data:image/svg+xml," + encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#1d5fd1"/><path d="M18 33l9 9 19-21" fill="none" stroke="#fff" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/></svg>');
|
||||
const MCP_ICONS = [{ src: MCP_ICON, mimeType: "image/svg+xml", sizes: ["any"] }];
|
||||
import type { Caller } from "./access.js";
|
||||
|
||||
/** MCP (Streamable HTTP, без сессий): тонкий адаптер над тем же ядром, что и REST. Реализация JSON-RPC 2.0 вручную. */
|
||||
@@ -89,7 +93,7 @@ export async function handleMcpMessage(core: TodoCore, caller: Caller, msg: Json
|
||||
switch (method) {
|
||||
case "initialize": {
|
||||
const asked = (msg.params as Json | undefined)?.protocolVersion;
|
||||
return { jsonrpc: "2.0", id, result: { protocolVersion: typeof asked === "string" ? asked : "2025-03-26", capabilities: { tools: {} }, serverInfo: { name: "khb-todo", version: "0.1.0" } } };
|
||||
return { jsonrpc: "2.0", id, result: { protocolVersion: typeof asked === "string" ? asked : "2025-03-26", capabilities: { tools: {} }, serverInfo: { name: "khb-todo", title: "KH Build: задачи (To-do)", version: "0.1.0", icons: MCP_ICONS } } };
|
||||
}
|
||||
case "ping":
|
||||
return { jsonrpc: "2.0", id, result: {} };
|
||||
|
||||
Reference in New Issue
Block a user