做完這篇,Claude(裝了連接器的 claude.ai 對話,或你終端機裡的 Claude Code)就能根據你的某個 osFoundry 知識庫回答客服與產品問題。回答中的每個說法都會指向一個文章 ID,以及該文章最後更新的時間。隔天,Claude 可以向 osFoundry 詢問從那之後有哪些變更,並告訴你昨天的哪些回答依據的文章已經被人改寫。如果文章本身有錯,Claude 也能修正,但只能從它讀到的那個確切版本出發,而且要等你允許這次呼叫之後才會執行。
誰負責什麼
| Claude 這邊 | osFoundry 這邊 | |
|---|---|---|
| 登入 | 你原本的 Claude 帳號或 Claude Code 安裝,不需更動 | 一個已核准、只連到單一 workspace 的連線 |
| 能搜尋什麼 | 伺服器回傳的內容 | 連線已加入的專案中,各知識庫裡已發布的文章 |
| 出處 | Claude 把它附在每個說法旁邊 | 每次讀取都會回傳文章 ID 與最後更新時間 |
| 新舊 | Claude 詢問某個序號之後的變更 | poll_resource_events 為每個知識庫保留一份有順序的紀錄 |
| 編輯 | 每次寫入前 Claude 的權限提示 | expected_version 必須相符,而且每次呼叫都會檢查你的編輯權限 |
| 紀錄 | Claude 自己的對話紀錄 | 每次呼叫都會列在連線的 Recent activity 中 |
設定
1. 連接 Claude
先在 osFoundry 建立連線:鑰匙圖示 → Connected → Assistant: Claude → Add assistant。複製畫面上顯示的伺服器位址:
https://api.osfoundry.io/api/v1/external-mcp 在 claude.ai 中,把這個 URL 加為自訂連接器。在 Claude Code 中,從 shell 加入,再於 session 內登入:
claude mcp add --transport http osfoundry https://api.osfoundry.io/api/v1/external-mcp # then, in Claude Code: /mcp # pick osfoundry → Authenticate 不論哪種方式,瀏覽器都會開啟 osFoundry 的「Connect an agent」頁面。選擇那一個 workspace,勾選核准方塊後連線。在 Claude Code 中,工具接著會以 mcp__osfoundry__search_knowledge_base 等名稱出現。
2. 把連線加入知識庫所在的專案
新的連線什麼都看不到。在鑰匙圖示 → Connected 中選取它,在 Projects 底下選擇專案,再按 Add to project。
範例:連線的 Projects 區塊,已加入一個專案
如果知識庫還不在那個專案裡,打開它,前往右側面板 → Settings,在 Project 欄位選擇專案。選好就會自動儲存。
範例:知識庫的 Settings 分頁,Project 欄位已設定
3. 發布 Claude 要拿來回答的文章
選取一篇文章,在右側面板開啟 Publishing 分頁。狀態會顯示 Published 或 Draft。對每一篇要讓 Claude 看到的文章按 Publish Article。面板上的說明寫得很清楚:"Published articles are used by this workspace's AI assistant and search. They are not visible outside the workspace." 也就是說,已發布的文章會供這個 workspace 的 AI 助理和搜尋使用,在 workspace 外是看不到的。草稿刻意不讓 Claude 讀到,這樣寫到一半的文章就不會被引用。
範例:文章的 Publishing 分頁,顯示 Status: Published 以及僅限 workspace 內可見的說明
4. 保持知識庫工具開啟
在連線的 Tools 中,這些工具和其他工具一樣預設都是開啟的:
read search_knowledge_base read_knowledge_article poll_resource_events write edit_knowledge_article 範例:Claude 連線的 Tools 勾選清單,知識庫工具已勾選
如果只要它回答、不要它改內容,取消勾選 edit knowledge article 再按 Save tools。搜尋、讀取和輪詢都會照常運作。
5. 在 prompt 裡要求附上出處
你先說清楚出處長什麼樣子,Claude 附出處就會穩定得多:
Answer from the "Support" knowledge base in osFoundry only. After each claim, add [article_id · updated_at] from read_knowledge_article. If no published article covers it, say so instead of guessing. 實際跑一次
以下的文章、ID 和日期都是範例內容。工具名稱和參數則是正式伺服器在 tools/list 中列出的,與 Claude Code 顯示的一致。
Example You: A customer on a monthly plan asks how long they have to request a refund, and whether SSO users get the same window. ● mcp__osfoundry__list_project_resources {"project_id": "…", "resource_type": "knowledge_base"} ← "Support" (knowledge base) ● mcp__osfoundry__search_knowledge_base {"knowledge_base_id": "…", "query": "refund window monthly plan", "limit": 5} ← 5 results, each with article_id and updated time "Refund policy" updated 2026-11-03 09:41 "SSO and billing owners" updated 2026-10-28 16:02 ● mcp__osfoundry__read_knowledge_article {"knowledge_base_id": "…", "article_id": "9c1e…"} ← "Refund policy", citation 9c1e… · 2026-11-03T09:41:12.408211Z ● mcp__osfoundry__read_knowledge_article {"knowledge_base_id": "…", "article_id": "4b70…"} ← "SSO and billing owners", citation 4b70… · 2026-10-28T16:02:55.019874Z Claude: Monthly plans can be refunded within 14 days of the charge [9c1e… · 2026-11-03T09:41:12Z]. SSO doesn't change that: refund requests go through the billing owner, not the SSO account [4b70… · 2026-10-28T16:02:55Z]. 隔天早上,在同一個對話裡:
You: Are any of the answers you gave yesterday out of date? ● mcp__osfoundry__poll_resource_events {"resource_type": "knowledge_base", "resource_id": "…", "after_sequence": 1182} ← 3 events; one touches 9c1e… ● mcp__osfoundry__read_knowledge_article {"knowledge_base_id": "…", "article_id": "9c1e…"} ← "Refund policy", citation 9c1e… · 2026-11-04T08:15:30.112054Z now says 30 days for monthly plans Claude: One answer changed. "Refund policy" was updated this morning and now gives 30 days, not 14 [9c1e… · 2026-11-04T08:15:30Z]. The SSO part still stands; that article hasn't changed. You: The FAQ article still says 14 days. Fix it to match. ● mcp__osfoundry__read_knowledge_article {"knowledge_base_id": "…", "article_id": "e27a…"} ← "Refund FAQ", version 2026-11-01T10:03:44.250911Z ● mcp__osfoundry__edit_knowledge_article {"knowledge_base_id": "…", "article_id": "e27a…", "content": "…30 days…", "expected_version": "2026-11-01T10:03:44.250911Z", "idempotency_key": "faq-refund-30d"} [Claude Code asks: allow this tool? → Yes] ← saved, version 2026-11-04T08:22:09.871530Z 這裡有三件事是一般對話不會發生的。
出處帶著時間,不只是 ID。光有 ID 只能知道 Claude 用了哪篇文章,更新時間則告訴你那篇文章當時是什麼狀態。正因如此,Claude 才能回答「這還正確嗎?」,而不必把曾經引用過的每篇文章都重讀一次。
輪詢很省,因為它是一份紀錄。Claude 只需要記住昨天的一個數字,也就是它看到的最後一個事件序號。一次 poll_resource_events 呼叫就回傳了之後的所有變更,Claude 只重讀了有變動的那篇文章。
編輯會指定版本。edit_knowledge_article 只有在文章仍是 expected_version 時,才會取代文章內容(如果你有傳標題,也會一併取代)。Claude 在寫入前幾秒才讀過 FAQ,所以版本相符。如果這中間有人存了 FAQ,osFoundry 就會拒絕這次寫入,Claude 會重新讀取。沿用昨天出處裡的版本,是最常被拒絕的原因,所以好的 prompt 會寫「編輯前先重讀」。
界線在哪裡
只有目前已發布的文章能被搜尋。搜尋和讀取都針對文章現在的樣子。取消發布一篇文章後,下一次呼叫它就會從 Claude 的結果中消失,引用過它的回答在檢查時也會找不到東西。把發布做成獨立步驟,重點就在這裡:什麼算是答案,由 workspace 決定,而不是模型。
只限已連線專案中的知識庫。沒有交給連線的知識庫,Claude 無法搜尋。把知識庫移到其他專案、把專案從連線移除,或按下 Revoke connection,下一次呼叫就會被擋下。先前取得的 token 也無法讓存取繼續有效。
編輯是整份取代,而且有兩道防護。這個工具接收的是完整內容,所以 osFoundry 不會把過期的副本合併進較新的版本,而是直接拒絕,讓 Claude 根據現在的內容重做修改。在 Claude 這邊,這個工具被標記為會改動共用內容的寫入(readOnlyHint: false、destructiveHint: true),所以 Claude Code 會停下來詢問。在 osFoundry 這邊,呼叫是以核准連線者的編輯權限執行。如果是從 osFoundry 自己的 Knowledge Base 畫面裡、透過已連結的 Claude 對話來編輯,osFoundry 會在每次 edit_knowledge_article 呼叫時要求核准,而且這個核准無法擴大到整個 session。
每次呼叫都看得到。連線的 Recent activity 會列出每個工具名稱、決定結果和時間,讓你能看到 Claude 回答前讀了哪些文章。
範例:Claude 連線的 Recent activity,列出知識庫工具的呼叫紀錄
下一步
挑十個你的團隊上週實際回答過的問題,請 Claude 根據知識庫回答並附上出處,然後保留這段對話。明天再問它哪些回答已經過時。它標出來的文章,就是你的團隊改過的那些,而出處會清楚顯示每個回答來自哪個版本。知識庫包含哪些內容、文章的版本如何管理,請看 Knowledge Base 頁面。





