From ba5e1cb6fd0cfdda1d6d9a26e3337f7c13bb2455 Mon Sep 17 00:00:00 2001 From: Claude Lin & Lay Date: Sun, 26 Apr 2026 11:00:11 +0900 Subject: [PATCH] hotfix(poller, mcp): drop spurious /master/ branch segment from wiki raw URL (#132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #131 deploy 後の :45 cron 実機観測で発覚: Liplus-Project/github-rag-mcp wiki: 6 pages, 0 embedded, 6 failed No content fetched for ... (all extensions 404) raw.githubusercontent.com/wiki/{repo}/master/{page}.md → 404 raw.githubusercontent.com/wiki/{repo}/{page}.md → 200 GitHub Wiki raw URL は branch segment を取らない仕様。W4 (#129) 実装で git ls-remote が `master` ref を返すことから類推して `/master/` を URL に 入れていたが、これは git protocol 内部の話で raw routing は branch を 含まない。 修正は URL string 1 行を 2 ファイルで: - src/poller.ts fetchWikiContent (cron-side ingestion) - src/mcp.ts inlineDocContent (search-time include_content) コメント 1 箇所も branch-less URL pattern に更新。 Closes #132 --- src/mcp.ts | 2 +- src/poller.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mcp.ts b/src/mcp.ts index c1de334..2cfead1 100644 --- a/src/mcp.ts +++ b/src/mcp.ts @@ -1283,7 +1283,7 @@ export class RagMcpAgentV2 extends McpAgent { const itemRepo = row.repo ?? fallbackRepo ?? ""; const ext = row.wiki_extension || "md"; if (!pageName || !itemRepo) return; - const url = `https://raw.githubusercontent.com/wiki/${itemRepo}/master/${encodeURIComponent(pageName)}.${ext}`; + const url = `https://raw.githubusercontent.com/wiki/${itemRepo}/${encodeURIComponent(pageName)}.${ext}`; try { const res = await fetch(url, { headers: { "User-Agent": "github-rag-mcp/0.1.0" }, diff --git a/src/poller.ts b/src/poller.ts index 86b9d3c..5498a93 100644 --- a/src/poller.ts +++ b/src/poller.ts @@ -901,7 +901,8 @@ async function listWikiPages(repo: string): Promise { /** * Fetch a wiki page's raw markup content. * - * GitHub serves wiki content from `raw.githubusercontent.com/wiki/{repo}/master/{page}.{ext}`. + * GitHub serves wiki content from `raw.githubusercontent.com/wiki/{repo}/{page}.{ext}` + * (no branch segment — wiki raw URLs route directly without referencing master/main). * If `preferredExtension` is provided (i.e. the page is already known from a * previous poll), try it first to skip the multi-extension probe. Otherwise * iterate through every supported extension until one returns 200. @@ -919,7 +920,7 @@ async function fetchWikiContent( : Array.from(WIKI_EXTENSIONS); for (const ext of probes) { - const url = `https://raw.githubusercontent.com/wiki/${repo}/master/${encodeURIComponent(pageName)}.${ext}`; + const url = `https://raw.githubusercontent.com/wiki/${repo}/${encodeURIComponent(pageName)}.${ext}`; try { const resp = await fetch(url, { headers: { "User-Agent": "github-rag-mcp/0.1.0" },