Compare commits
4 Commits
main
...
73fe9ecf04
| Author | SHA1 | Date | |
|---|---|---|---|
| 73fe9ecf04 | |||
| 45f1c09a39 | |||
| 55e00381db | |||
| 5b231e6366 |
@@ -14,6 +14,24 @@ const _app = new Hono<{ Bindings: Env; Variables: { org_namespace: string; partn
|
|||||||
// 安全模型見 mcp/OAUTH.md。註冊在 basePath 之前,落在同一份共享 router。
|
// 安全模型見 mcp/OAUTH.md。註冊在 basePath 之前,落在同一份共享 router。
|
||||||
registerOAuthRoutes(_app);
|
registerOAuthRoutes(_app);
|
||||||
|
|
||||||
|
// ── GET /health — 讓「這台跑的是哪一版 MCP」用一條 curl 看得到 ─────────────────────
|
||||||
|
// 為什麼要有:cypher-executor 早就有 /health(bundle_version + auth_store 探針),
|
||||||
|
// arcrun-mcp 沒有 ⇒ 要判斷某台實例的 MCP 是哪一代認證,只能打 /authorize 剖 HTML 數欄位
|
||||||
|
// (ops-facts 2026-08-10 的土法)。那個判準脆弱又難教。
|
||||||
|
//
|
||||||
|
// ⚠️ 誠實界定(別把它當世代判準用過頭):本端點是**這個 commit 之後才有的**,所以
|
||||||
|
// 「/health 回 404」只代表「比本版舊」,**不代表就是 owner_secret 世代**——
|
||||||
|
// 現階段判世代仍要看 /authorize 的欄位(一個 owner_secret =舊;email+password =新)。
|
||||||
|
// 等這版推到各實例之後,`auth` 欄位才會變成一眼可讀的世代判準。
|
||||||
|
// 不需認證、不吐任何機密;MCP_BUILD 是部署標記,由各實例 toml [vars] 帶入。
|
||||||
|
_app.get("/health", (c) => c.json({
|
||||||
|
ok: true,
|
||||||
|
service: "arcrun-mcp",
|
||||||
|
auth: "portal-login",
|
||||||
|
build: c.env.MCP_BUILD ?? "unknown",
|
||||||
|
oauth_kv: c.env.OAUTH_KV ? "present" : "missing",
|
||||||
|
}));
|
||||||
|
|
||||||
const app = _app.basePath('/mcp');
|
const app = _app.basePath('/mcp');
|
||||||
|
|
||||||
app.use("*", cors({
|
app.use("*", cors({
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ export interface Env {
|
|||||||
// 允許的 redirect_uri host 白名單(逗號分隔)。DCR 無狀態故靠此擋 open-redirect/釣魚。
|
// 允許的 redirect_uri host 白名單(逗號分隔)。DCR 無狀態故靠此擋 open-redirect/釣魚。
|
||||||
// 未設 → 預設只允許 claude.ai / claude.com / anthropic.com(含子網域)+ localhost。
|
// 未設 → 預設只允許 claude.ai / claude.com / anthropic.com(含子網域)+ localhost。
|
||||||
MCP_ALLOWED_REDIRECT_HOSTS?: string;
|
MCP_ALLOWED_REDIRECT_HOSTS?: string;
|
||||||
|
// 部署標記(非機密):GET /health 原樣回報,讓「這台跑的是哪一版」用一條 curl 看得到。
|
||||||
|
// 由各實例的 wrangler toml [vars] 帶入;沒帶 → /health 回 build:"unknown"(誠實,不假裝)。
|
||||||
|
MCP_BUILD?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ToolContext {
|
export interface ToolContext {
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# ── arcrun-mcp STAGE(youlin 帳號)────────────────────────────────────────────────
|
||||||
|
#
|
||||||
|
# 這支存在的理由(2026-08-10,Leo/mira#4):
|
||||||
|
# `arcrun-mcp` 不在安裝器出貨的那批裡,所以「升級某台的 arcrun-mcp」一直沒有測試場,
|
||||||
|
# 要驗只能拿 leo21c(唯一一份 47.9 萬筆知識的真身)去冒險。這支把 stage 補上:
|
||||||
|
# youlin = stage(agent-memory「兩台分工」:AI 測 youlin、leo 核實 prod)。
|
||||||
|
#
|
||||||
|
# 用法(在 mcp/ 目錄下跑,-c 必須與 main="src/index.ts" 同目錄,否則找不到入口):
|
||||||
|
# cd mcp
|
||||||
|
# CLOUDFLARE_ACCOUNT_ID=1129efd7df2e8899d537e9c8fbabb6cb \
|
||||||
|
# CLOUDFLARE_API_TOKEN="$CLOUDFLARE_API_TOKEN_YOULIN_CC_USE" \
|
||||||
|
# npx wrangler deploy -c wrangler.stage.toml
|
||||||
|
#
|
||||||
|
# 與出貨用的 wrangler.toml 的差別,就是「手動直推 arcrun-mcp 到自架帳號」的兩個坑
|
||||||
|
# (agent-memory 已記,這裡是把它變成檔案而不是靠人記得):
|
||||||
|
# ① 拿掉 [[routes]] —— `mcp.arcrun.dev` 那個 zone 在 uncle6,自架帳號沒有,帶著會部署失敗
|
||||||
|
# ② OAUTH_KV 填真 id —— 出貨 toml 是佔位符 REPLACE_WITH_REAL_KV_ID,只有走 acr init/update
|
||||||
|
# 才會被自動注入;直推必須自己填(沒填 → /authorize 回 503,OAuth 整條死)
|
||||||
|
#
|
||||||
|
# 🔴 [vars] 必須列**全**:wrangler deploy 會用本檔的 vars 整組取代線上的,漏一個就是靜默清掉。
|
||||||
|
# 下方七個 var 是 2026-08-10 從線上 arcrun-mcp 抓下來的原樣值。
|
||||||
|
# Secrets(KBDB_INTERNAL_TOKEN / MCP_OWNER_SECRET)不進本檔也不會被 deploy 洗掉。
|
||||||
|
|
||||||
|
name = "arcrun-mcp"
|
||||||
|
main = "src/index.ts"
|
||||||
|
compatibility_date = "2024-11-27"
|
||||||
|
compatibility_flags = [ "nodejs_compat" ]
|
||||||
|
workers_dev = true
|
||||||
|
|
||||||
|
[vars]
|
||||||
|
MULTI_TENANT = "false"
|
||||||
|
CF_ACCOUNT_ID = "1129efd7df2e8899d537e9c8fbabb6cb"
|
||||||
|
WORKER_SUBDOMAIN = "youlin-hsieh-dev"
|
||||||
|
CONSOLE_TENANT = "yuga3bse"
|
||||||
|
MCP_OWNER_NAMESPACE = "yuga3bse"
|
||||||
|
KBDB_BASE_URL = "https://arcrun-kbdb.youlin-hsieh-dev.workers.dev"
|
||||||
|
UI_ORIGINS = "https://arcrun-rag-ui.youlin-hsieh-dev.workers.dev"
|
||||||
|
# 部署標記,GET /health 原樣回報。每次重推 stage 就換一個,別讓它跟線上脫節。
|
||||||
|
MCP_BUILD = "stage-2026-08-10+45f1c09"
|
||||||
|
|
||||||
|
[[services]]
|
||||||
|
binding = "COMPONENT_REGISTRY"
|
||||||
|
service = "arcrun-registry"
|
||||||
|
|
||||||
|
[[services]]
|
||||||
|
binding = "CYPHER_EXECUTOR"
|
||||||
|
service = "arcrun-cypher-executor"
|
||||||
|
|
||||||
|
[[services]]
|
||||||
|
binding = "KBDB"
|
||||||
|
service = "arcrun-kbdb"
|
||||||
|
|
||||||
|
# youlin 的 OAuth KV(安裝器建的 arcrun-rag-yuga3bse-kv-oauth_kv)。
|
||||||
|
[[kv_namespaces]]
|
||||||
|
binding = "OAUTH_KV"
|
||||||
|
id = "6a8d4dd621994607b3998ade4c7e9944"
|
||||||
Reference in New Issue
Block a user