Files
kompas-plugin/plugin/pi/kompas.ts
T

37 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// pi-расширение пакета kompas: регистрирует MCP-сервер КОМПАС-3D.
//
// Сервер и лаунчер ехат внутри одного пакета (plugin/bin + plugin/scripts),
// поэтому путь резолвится от этого файла. Регистрация не сохраняется, поэтому
// она повторяется при каждой загрузке расширения.
//
// Свой сервер подставляется переменной окружения KOMPAS_MCP_EXE — ей управляет
// лаунчер launch-kompas-mcp.ps1, а не это расширение.
import path from "node:path";
import { fileURLToPath } from "node:url";
import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
const launcher = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"..",
"scripts",
"launch-kompas-mcp.ps1",
);
export default function (pi: ExtensionAPI) {
pi.registerMcpServer("kompas", {
command: "powershell",
args: [
"-NoProfile",
"-NonInteractive",
"-ExecutionPolicy",
"Bypass",
"-File",
launcher,
],
exposure: "deferred",
description:
"Контроль КОМПАС-3D: детали, эскизы, формообразующие операции, сборки, 2D-чертежи, STEP/STL, осмотр модели — через MCP-сервер kompas-mcp.exe",
});
}