5fc7277c3c
零 u6u 洩漏(leo 要求 1):connector tool 清單只剩 arcrun_*,並移除壞掉/
重複的 u6u_ workflow tool(deploy/execute/get/list_workflows 由 arcrun_
push/run/get/list_workflows 取代);MCP server name 也由 u6u-mcp-server
改 arcrun-mcp-server。
前綴單一真相源(leo 要求 2):新增 mcp/src/brand.ts(TOOL_PREFIX + toolName()
helper),所有 server.tool() 註冊一律走 toolName("suffix"),前綴不再明碼散寫。
未來 rebrand 只改 brand.ts 一行。
- 12 個獨有能力 tool rename(component/tag/gui/search_workflows)
- 4 個重複/壞掉 tool 移除
- inter-tool hint、描述字串、註解內 u6u_ 名字全數更新
- tsc exit 0;vitest 19/19 綠
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015d5jDbuqT5Htwv3Q88XXKk
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
import { toolName } from "../brand.js";
|
|
import { Env } from "../types.js";
|
|
|
|
/**
|
|
* arcrun_get_component_guide — 取得零件開發指引
|
|
* 呼叫 Component Registry GET /components/guide
|
|
* AI 在開發新零件前應先讀取此指引
|
|
*/
|
|
export function registerGetComponentGuide(server: McpServer, env: Env, orgNamespace: string) {
|
|
server.tool(
|
|
toolName("get_component_guide"),
|
|
"取得 arcrun 零件開發指引(Markdown 格式)。包含 TinyGo 白名單 import、禁止行為、component.contract.yaml 完整範例、本地測試指令。開發新零件前必須先讀取此指引。",
|
|
{},
|
|
async () => {
|
|
try {
|
|
if (!env.COMPONENT_REGISTRY) {
|
|
return {
|
|
content: [{ type: "text", text: "Error: COMPONENT_REGISTRY service binding is not configured." }],
|
|
isError: true,
|
|
};
|
|
}
|
|
|
|
const response = await env.COMPONENT_REGISTRY.fetch(
|
|
"http://component-registry/components/guide",
|
|
{ method: "GET" },
|
|
);
|
|
|
|
if (!response.ok) {
|
|
return {
|
|
content: [{ type: "text", text: `Error fetching guide: ${await response.text()}` }],
|
|
isError: true,
|
|
};
|
|
}
|
|
|
|
const guide = await response.text();
|
|
return {
|
|
content: [{ type: "text", text: guide }],
|
|
};
|
|
} catch (error) {
|
|
return {
|
|
content: [{ type: "text", text: `Internal Error: ${error instanceof Error ? error.message : String(error)}` }],
|
|
isError: true,
|
|
};
|
|
}
|
|
}
|
|
);
|
|
}
|