From 6f235c700ab3b1e6a170ddd013b10f1e1b16ce73 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Mon, 23 Nov 2026 01:16:01 +0700 Subject: [PATCH] =?UTF-8?q?fix(mcp):=20=D1=83=D1=87=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BC=D0=B0=D1=80=D1=88=D1=80=D1=83=D1=82=D1=8B=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BC=D0=B5=D0=BD=D0=B0=20=D1=82=D1=80=D0=B0=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=BC=20=D0=B2=20=D1=80=D0=B5=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/mcp-coverage.json | 63 ++++++++++++++++++++++++ backend/src/modules/mcp/coverage.test.ts | 9 +++- components/mcp/mcp-workspace.tsx | 2 +- 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/backend/mcp-coverage.json b/backend/mcp-coverage.json index 34aab4b6..d675c5c4 100644 --- a/backend/mcp-coverage.json +++ b/backend/mcp-coverage.json @@ -464,6 +464,41 @@ ], "reason": "Общий listRevisions с REST: только метаданные, максимум 50 записей; серверная область и права проверяются до SQL, payload ревизии не выдаётся." }, + { + "method": "GET", + "path": "/api/ix/nodes", + "status": "excluded", + "operations": [], + "reason": "Служебная проекция для выбора площадок в интерфейсе. В MCP доступ к серверам определяется областью подключения." + }, + { + "method": "GET", + "path": "/api/ix/segments", + "status": "mediated", + "operations": ["network.ix.list"], + "reason": "Общий сервис списка сегментов. MCP ограничивает выборку областью серверов и возвращает метаданные ревизий." + }, + { + "method": "GET", + "path": "/api/ix/segments/:id/linux", + "status": "excluded", + "operations": [], + "reason": "Шаблон подключения Linux оператор получает в интерфейсе для локальной настройки клиента." + }, + { + "method": "GET", + "path": "/api/ix/segments/:id/status", + "status": "mediated", + "operations": ["network.ix.read"], + "reason": "Общий опрос маршрутов и BGP-сессий применённой ревизии. MCP проверяет доступ ко всем узлам сегмента." + }, + { + "method": "GET", + "path": "/api/ix/topology", + "status": "excluded", + "operations": [], + "reason": "Проекция применённых связей для сетевой карты. MCP читает конфигурацию и состояние отдельных сегментов." + }, { "method": "GET", "path": "/api/logs", @@ -1562,6 +1597,20 @@ ], "reason": "Общий REST/MCP executor существующего сертификата: оба selector и все роли, явный private/CA intent, human MCP plan, actor/key no-replay, exact owned file/read/cleanup, encrypted owner-only artifact/TTL; синтетическая SQL/HTTP/portal и browser приёмка. Native CHR отдельно." }, + { + "method": "POST", + "path": "/api/ix/preview", + "status": "excluded", + "operations": [], + "reason": "Локальный предпросмотр объектов из компилятора. План MCP дополнительно фиксирует состояние площадок и требует подтверждения." + }, + { + "method": "POST", + "path": "/api/ix/segments", + "status": "excluded", + "operations": [], + "reason": "Сохранение черновика из интерфейса. Для изменения конфигурации через MCP используется план с подтверждением." + }, { "method": "POST", "path": "/api/mcp/connections", @@ -1632,6 +1681,20 @@ "operations": ["network.bridge-vlan.configure"], "reason": "Подготовка связанного плана bridge/VLAN через тот же MCP-инструмент; выполнение требует человеческого подтверждения." }, + { + "method": "POST", + "path": "/api/mcp/ix/plan", + "status": "mediated", + "operations": ["network.ix.configure"], + "reason": "Интерфейс владельца вызывает тот же инструмент MCP подготовки плана IX. Применение проходит отдельно после подтверждения." + }, + { + "method": "POST", + "path": "/api/mcp/ix/restore", + "status": "mediated", + "operations": ["network.ix.restore"], + "reason": "Интерфейс владельца вызывает тот же инструмент MCP подготовки восстановления сохранённой ревизии IX." + }, { "method": "POST", "path": "/api/mcp/management-channels", diff --git a/backend/src/modules/mcp/coverage.test.ts b/backend/src/modules/mcp/coverage.test.ts index de5913ae..ead00a38 100644 --- a/backend/src/modules/mcp/coverage.test.ts +++ b/backend/src/modules/mcp/coverage.test.ts @@ -8,9 +8,16 @@ const actual = await collectApplicationRoutes() assert.equal(new Set(coverage.routes.map(routeKey)).size, coverage.routes.length, "Duplicate coverage route") assert.deepEqual(coverage.routes.map(routeKey).sort(), actual.map(routeKey).sort(), "REST routes changed: update mcp-coverage.json with a typed tool, human-only reason, or explicit pending adapter") const implemented = new Set(listActions().map(action => action.operation.id)) +const ixInterfaceRoutes = new Set([ + "GET /api/ix/nodes", + "GET /api/ix/segments/:id/linux", + "GET /api/ix/topology", + "POST /api/ix/preview", + "POST /api/ix/segments", +]) for (const route of coverage.routes) { assert.equal(route.status === "mediated", route.operations.length > 0, routeKey(route)) for (const operation of route.operations) assert.ok(implemented.has(operation), `Unknown tool mapping: ${operation} for ${routeKey(route)}`) - if (route.status === "excluded") assert.match(route.path, /^(?:\/api\/(?:mcp(?:\/|$)|auth\/config$)|\/mcp$|\/oauth\/|\/\.well-known\/|\/_internal\/mcp\/|\/health$)/, "Business endpoint cannot be silently excluded") + if (route.status === "excluded" && !ixInterfaceRoutes.has(routeKey(route))) assert.match(route.path, /^(?:\/api\/(?:mcp(?:\/|$)|auth\/config$)|\/mcp$|\/oauth\/|\/\.well-known\/|\/_internal\/mcp\/|\/health$)/, "Business endpoint cannot be silently excluded") } console.log("MCP REST coverage:", JSON.stringify({ tools: listActions().length, routes: actual.length, mediated: coverage.routes.filter(route => route.status === "mediated").length, excluded: coverage.routes.filter(route => route.status === "excluded").length, pending: coverage.routes.filter(route => route.status === "pending").length })) diff --git a/components/mcp/mcp-workspace.tsx b/components/mcp/mcp-workspace.tsx index 0d0805e7..298bdc9c 100644 --- a/components/mcp/mcp-workspace.tsx +++ b/components/mcp/mcp-workspace.tsx @@ -826,7 +826,7 @@ function Settings({ api }: { api: McpApi }) { } function RestCoverage({ api }: { api: McpApi }) { const query = useQuery(useCallback(signal => api.coverage(signal), [api])), routes = query.data?.routes ?? [] - return
Сценариев с MCP: {routes.filter(route => route.status === "mediated").length}Транспорт и управление доступом: {routes.filter(route => route.status === "excluded").length}Ожидают реализации: {routes.filter(route => route.status === "pending").length}
route.status === "pending")} columns={[{ accessorKey: "method", header: "Метод", size: 90 }, { accessorKey: "path", header: "Незавершённый сценарий", size: 310 }, { accessorKey: "reason", header: "Что осталось", size: 400 }]} loading={!query.data && !query.error} />
+ return
Сценариев с MCP: {routes.filter(route => route.status === "mediated").length}Служебные маршруты: {routes.filter(route => route.status === "excluded").length}Ожидают реализации: {routes.filter(route => route.status === "pending").length}
route.status === "pending")} columns={[{ accessorKey: "method", header: "Метод", size: 90 }, { accessorKey: "path", header: "Незавершённый сценарий", size: 310 }, { accessorKey: "reason", header: "Что осталось", size: 400 }]} loading={!query.data && !query.error} />
} function Consent({ api, id }: { api: McpApi; id: string }) { const request = useQuery(useCallback(signal => api.consentRequest(id, signal), [api, id])), connections = useQuery(useCallback(signal => api.connections(signal), [api]))