fix(cli): MCP self-hosted discovery + config setup
- deploy.ts: discoverWorkerDirs 掃 mcp worker + 回傳 mcpUrl(對內 /mcp 端點) - init.ts: initSelfHosted 寫入 config.mcp_url + 重跑 cmdMcpSetup - config.ts: DEFAULT_MCP_URL 補 /mcp 後綴 Fixes mcp-account-source §3:self-hosted .mcp.json 必須指自己的 mcp worker,避免連官方失敗。 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,7 +65,8 @@ const ENV_MAP: Record<string, keyof ArcrunConfig> = {
|
||||
* 平台預設 MCP URL(mcp_url 未設時的 fallback,SaaS 用戶用)。
|
||||
* MCP 搬進 arcrun 主庫後改用 arcrun.dev zone(mcp/wrangler.toml route = mcp.arcrun.dev)。
|
||||
*/
|
||||
export const DEFAULT_MCP_URL = 'https://mcp.arcrun.dev';
|
||||
// MCP streamable-http 端點是 /mcp(根路徑 404)。少了 /mcp → client 連線 Failed。
|
||||
export const DEFAULT_MCP_URL = 'https://mcp.arcrun.dev/mcp';
|
||||
|
||||
/**
|
||||
* 公庫 URL(recipe pull/search/submit-p 的對象,kbdb-base §7.5)。
|
||||
|
||||
+11
-1
@@ -53,6 +53,7 @@ export interface DeployContext {
|
||||
export interface DeployResult {
|
||||
implemented: boolean;
|
||||
cypherExecutorUrl?: string;
|
||||
mcpUrl?: string; // self-hosted 自己的 MCP worker URL(mcp-account-source §3)
|
||||
message: string;
|
||||
}
|
||||
|
||||
@@ -132,11 +133,17 @@ export async function downloadAndDeploy(ctx: DeployContext, ref = 'main'): Promi
|
||||
const cypherExecutorUrl = ctx.workerSubdomain
|
||||
? `https://arcrun-cypher-executor.${ctx.workerSubdomain}.workers.dev`
|
||||
: undefined;
|
||||
// self-hosted 自己的 MCP worker URL(mcp-account-source §3:.mcp.json 指自己)。
|
||||
// 端點是 /mcp(streamable http;根路徑 404)。仿 cypher 用 WORKER_SUBDOMAIN 組。
|
||||
const mcpUrl = ctx.workerSubdomain
|
||||
? `https://arcrun-mcp.${ctx.workerSubdomain}.workers.dev/mcp`
|
||||
: undefined;
|
||||
|
||||
if (failures.length > 0) {
|
||||
return {
|
||||
implemented: true,
|
||||
cypherExecutorUrl,
|
||||
mcpUrl,
|
||||
message:
|
||||
`部署 ${deployed}/${tier1.length + tier2.length} 成功,${failures.length} 失敗(誠實回報,未假綠):\n` +
|
||||
failures.map(f => ` ✗ ${f}`).join('\n'),
|
||||
@@ -146,6 +153,7 @@ export async function downloadAndDeploy(ctx: DeployContext, ref = 'main'): Promi
|
||||
return {
|
||||
implemented: true,
|
||||
cypherExecutorUrl,
|
||||
mcpUrl,
|
||||
message: `部署完成:${deployed} 個 Worker 全部成功。`,
|
||||
};
|
||||
}
|
||||
@@ -211,7 +219,9 @@ function discoverWorkerDirs(root: string): { tier1: string[]; tier2: string[] }
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const name of ['cypher-executor', 'registry']) {
|
||||
// self-hosted 也部署自己的 MCP worker(mcp-account-source §5c:codeload 主庫即得 MCP,
|
||||
// .mcp.json 指自己的 mcp 而非官方 mcp.arcrun.dev)。
|
||||
for (const name of ['cypher-executor', 'registry', 'mcp']) {
|
||||
const dir = join(root, name);
|
||||
if (existsSync(join(dir, 'wrangler.toml'))) tier2.push(dir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user