portal 設定頁補顯示 MCP 連接網址(arcrun-rag#7)
封測者原話:「說明叫我把 MCP 加進 claude.ai connector,但我找不到網址」。文件一直寫 「登入 portal → 設定頁,那裡可以直接複製」,但畫面上從沒真的顯示過(grep 0 命中), 用戶照文件走一定撲空。 設定頁新增「接上你的 AI(MCP)」面板:純前端把 apiBase 的 worker 名字從 arcrun-cypher-executor 換成 arcrun-mcp(同一顆自架帳號 workers.dev 子網域,對齊 cli/src/lib/deploy.ts:386-392 部署時的組法),不符形狀就誠實顯示「尚未偵測到」, 不亂猜連不到的網址。複製按鈕從既有 copyOriginUrl 拆出共用 copyText(btn, url)。 端到端本機瀏覽器實測:真 wrangler dev(kbdb+cypher-executor local D1)+ 真登入流程 (console setup → bootstrap admin → portal login)走到設定頁,面板正確顯示/隱藏; 用貼近真實自架形狀的假網址驗算,結果與 deploy.ts 的組法逐字相同;複製鈕點擊行為與 既有、未改動的 st-copy-url 按鈕在同一自動化環境下一致(clipboard-write 是瀏覽器自動化 環境限制,非本次改動的迴歸)。詳細記錄見 system-dev/docs/3-specs/portal-auth/tasks.md t218。 未部署(紅線:只 commit+push,未動任何 Cloudflare 實例)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -401,6 +401,21 @@ if (!window.ARCRUN_API_BASE) {
|
||||
<div style="margin-top:8px;font-size:13px;line-height:1.7;color:rgba(var(--ink-rgb),.5)">封測版未簽章,第一次請右鍵→打開。裝好第一次開啟時,貼上這個網址+你的帳號密碼就連上了。</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 08-09(arcrun-rag#7,封測者原話「說明叫我把 MCP 加進 claude.ai connector,但我找不到網址」):
|
||||
文件一直寫「登入 portal 設定頁直接複製」,但畫面上從沒真的顯示過這串網址——用戶照著文件的
|
||||
指示走到這裡,只會撲空。這裡補上:MCP 網址跟知識庫網址(apiBase)是同一顆自架帳號的
|
||||
workers.dev 子網域,只是 worker 名字從 arcrun-cypher-executor 換成 arcrun-mcp
|
||||
(CLI 部署當時就是這樣組出這兩個網址的,見 cli/src/lib/deploy.ts:386-392)——
|
||||
純前端字串轉換,不需要後端新端點、不需要安裝器多寫一份設定。 -->
|
||||
<div class="panel">
|
||||
<div style="display:flex;align-items:center;gap:8px;margin-bottom:14px;font-size:13.5px">
|
||||
<span style="color:rgba(var(--ink-rgb),.6);white-space:nowrap">你的 MCP 網址(給你的 AI 連線用)</span>
|
||||
<code id="st-mcp-url" style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--ink)">—</code>
|
||||
<button class="btn3" id="st-copy-mcp-url" style="padding:5px 12px;font-size:13px;white-space:nowrap;flex:none">複製</button>
|
||||
</div>
|
||||
<div style="font-size:17px;font-weight:600">接上你的 AI(MCP)</div>
|
||||
<div style="margin-top:4px;font-size:14px;line-height:1.65;color:rgba(var(--ink-rgb),.55)">把上面這串網址貼到 Claude、ChatGPT 等 AI 的「新增自訂連接器」欄位,就能讓你的 AI 直接查這個知識庫。</div>
|
||||
</div>
|
||||
<!-- t176(leo 08-03):AI 設定整塊移除。
|
||||
雲端聊天問答走 Workers AI(用戶自己 CF 帳號內建,**免金鑰、裝好就能用**);
|
||||
地端萃取用哪把金鑰改由「同步小幫手」自己設定(托盤選單「AI 設定…」)。
|
||||
@@ -977,9 +992,9 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return {
|
||||
// 「版本與更新」頁本機端做。GET /portal/data/diagnostics 端點本身未刪(無害、
|
||||
// 已無任何 UI 呼叫),只是這裡不再掛按鈕去打它。
|
||||
|
||||
// t87 07-28 leo:知識庫網址 helper(只有 origin,不含 /portal/# 後綴),兩處 UI 共用
|
||||
function copyOriginUrl(btn) {
|
||||
var url = location.origin;
|
||||
// t87 07-28 leo:複製任意網址到剪貼簿的共用 helper(08-09 從 copyOriginUrl 拆出
|
||||
// copyText,讓 MCP 網址這種「不是 location.origin」的字串也能共用同一套按鈕行為)。
|
||||
function copyText(btn, url) {
|
||||
var orig = btn.textContent;
|
||||
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
||||
alert('請手動選取並複製:' + url);
|
||||
@@ -992,6 +1007,7 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return {
|
||||
alert('請手動選取並複製:' + url);
|
||||
});
|
||||
}
|
||||
function copyOriginUrl(btn) { copyText(btn, location.origin); }
|
||||
(function () {
|
||||
['st-origin-url', 'ad-origin-url'].forEach(function (id) {
|
||||
var el = $(id); if (el) el.textContent = location.origin;
|
||||
@@ -1001,6 +1017,33 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return {
|
||||
});
|
||||
})();
|
||||
|
||||
// 08-09(arcrun-rag#7):MCP 網址=apiBase 換一個 worker 名字(arcrun-cypher-executor →
|
||||
// arcrun-mcp),同一顆自架帳號的 workers.dev 子網域(deploy.ts:386-392 部署時就是這樣組的)。
|
||||
// 不是這個形狀(例如官方多租戶自訂網域)就誠實留空,不亂猜一個貼上去會連錯的網址。
|
||||
function mcpUrlFromApiBase() {
|
||||
try {
|
||||
var u = new URL(window.ARCRUN_API_BASE);
|
||||
if (u.hostname.indexOf('arcrun-cypher-executor.') === 0) {
|
||||
u.hostname = u.hostname.replace('arcrun-cypher-executor.', 'arcrun-mcp.');
|
||||
return u.origin + '/mcp';
|
||||
}
|
||||
} catch (e) { /* apiBase 空值或格式不符時不猜 */ }
|
||||
return '';
|
||||
}
|
||||
(function () {
|
||||
var mcpUrl = mcpUrlFromApiBase();
|
||||
var el = $('st-mcp-url');
|
||||
var btn = $('st-copy-mcp-url');
|
||||
if (el) el.textContent = mcpUrl || '(尚未偵測到,請確認安裝已完成)';
|
||||
if (btn) {
|
||||
if (mcpUrl) {
|
||||
btn.addEventListener('click', function () { copyText(this, mcpUrl); });
|
||||
} else {
|
||||
btn.disabled = true;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
// ── t53 完成安裝清單(進站必見,三件做完才消失)─────────────────────────────
|
||||
function setupSteps() {
|
||||
try { return JSON.parse(localStorage.getItem('arcrun_setup_steps') || '{}'); } catch (e) { return {}; }
|
||||
|
||||
Reference in New Issue
Block a user