From e236c22db03b36389113334e704c043d36e2f03e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 8 Jan 2026 00:00:52 +0000 Subject: [PATCH 1/5] fix(mcp): Use fileName.text as fallback when webUrl is undefined for local repos For local repositories, the webUrl field is undefined since there's no web hosting URL. This fix makes both search_code and list_repos tools fallback to the fileName.text and repoCloneUrl respectively when webUrl is not available. --- packages/mcp/src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts index c704540f4..43c08f248 100644 --- a/packages/mcp/src/index.ts +++ b/packages/mcp/src/index.ts @@ -106,7 +106,8 @@ server.tool( (acc, chunk) => acc + chunk.matchRanges.length, 0, ); - let text = `file: ${file.webUrl}\nnum_matches: ${numMatches}\nrepository: ${file.repository}\nlanguage: ${file.language}`; + const fileIdentifier = file.webUrl ?? file.fileName.text; + let text = `file: ${fileIdentifier}\nnum_matches: ${numMatches}\nrepository: ${file.repository}\nlanguage: ${file.language}`; if (includeCodeSnippets) { const snippets = file.chunks.map(chunk => { @@ -200,9 +201,10 @@ server.tool( // Format output const content: TextContent[] = paginated.map(repo => { + const repoUrl = repo.webUrl ?? repo.repoCloneUrl; return { type: "text", - text: `id: ${repo.repoName}\nurl: ${repo.webUrl}`, + text: `id: ${repo.repoName}\nurl: ${repoUrl}`, } }); From 07010634c10edc3bea2039451a4e8005a2781440 Mon Sep 17 00:00:00 2001 From: msukkari Date: Tue, 13 Jan 2026 17:37:31 -0800 Subject: [PATCH 2/5] fix fields and changelog --- CHANGELOG.md | 1 + packages/mcp/src/index.ts | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea946cd8..eba4ddecb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed issue where 403 errors were being raised during a user driven permission sync against a self-hosted code host. [#729](https://github.com/sourcebot-dev/sourcebot/pull/729) - Fixed "ambiguous argument 'HEAD^{commit}': unknown revision or path not in the working tree" error for blank repositories. [#733](https://github.com/sourcebot-dev/sourcebot/pull/733) - Fixed issue where folders containing files with non-ASCII characters in their paths would appear duplicated in the file tree. [#726](https://github.com/sourcebot-dev/sourcebot/pull/726) +- Fixed invalid file and url MCP results for local indexed repos [#718](https://github.com/sourcebot-dev/sourcebot/pull/718) ## [4.10.8] - 2026-01-13 diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts index 43c08f248..9b92b729f 100644 --- a/packages/mcp/src/index.ts +++ b/packages/mcp/src/index.ts @@ -106,8 +106,8 @@ server.tool( (acc, chunk) => acc + chunk.matchRanges.length, 0, ); - const fileIdentifier = file.webUrl ?? file.fileName.text; - let text = `file: ${fileIdentifier}\nnum_matches: ${numMatches}\nrepository: ${file.repository}\nlanguage: ${file.language}`; + + let text = `file: ${file.fileName.text}\nnum_matches: ${numMatches}\nrepository: ${file.repository}\nlanguage: ${file.language}`; if (includeCodeSnippets) { const snippets = file.chunks.map(chunk => { @@ -201,10 +201,9 @@ server.tool( // Format output const content: TextContent[] = paginated.map(repo => { - const repoUrl = repo.webUrl ?? repo.repoCloneUrl; return { type: "text", - text: `id: ${repo.repoName}\nurl: ${repoUrl}`, + text: `id: ${repo.repoName}\nurl: ${repo.repoCloneUrl}`, } }); From 5cb851214a6d832781772939e2d4eb345155a34c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 14 Jan 2026 01:41:51 +0000 Subject: [PATCH 3/5] Move MCP changelog entry to MCP package changelog Moved the changelog entry for PR #718 from the main CHANGELOG.md to packages/mcp/CHANGELOG.md as requested. Co-authored-by: brendan --- CHANGELOG.md | 1 - packages/mcp/CHANGELOG.md | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eba4ddecb..6ea946cd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed issue where 403 errors were being raised during a user driven permission sync against a self-hosted code host. [#729](https://github.com/sourcebot-dev/sourcebot/pull/729) - Fixed "ambiguous argument 'HEAD^{commit}': unknown revision or path not in the working tree" error for blank repositories. [#733](https://github.com/sourcebot-dev/sourcebot/pull/733) - Fixed issue where folders containing files with non-ASCII characters in their paths would appear duplicated in the file tree. [#726](https://github.com/sourcebot-dev/sourcebot/pull/726) -- Fixed invalid file and url MCP results for local indexed repos [#718](https://github.com/sourcebot-dev/sourcebot/pull/718) ## [4.10.8] - 2026-01-13 diff --git a/packages/mcp/CHANGELOG.md b/packages/mcp/CHANGELOG.md index e79ae2840..c9410f80c 100644 --- a/packages/mcp/CHANGELOG.md +++ b/packages/mcp/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Fixed invalid file and url MCP results for local indexed repos [#718](https://github.com/sourcebot-dev/sourcebot/pull/718) + ## [1.0.11] - 2025-12-03 ### Changed From 5cd01ec9f1cae7eeb082870c651792f800410996 Mon Sep 17 00:00:00 2001 From: msukkari Date: Tue, 13 Jan 2026 17:51:22 -0800 Subject: [PATCH 4/5] revert back to original changes --- packages/mcp/CHANGELOG.md | 3 +++ packages/mcp/src/index.ts | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/mcp/CHANGELOG.md b/packages/mcp/CHANGELOG.md index c9410f80c..2fe71ca59 100644 --- a/packages/mcp/CHANGELOG.md +++ b/packages/mcp/CHANGELOG.md @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated API client to match the latest Sourcebot release. [#652](https://github.com/sourcebot-dev/sourcebot/pull/652) +### Fixed +- Fixed invalid file and url MCP results for local indexed repos [#718](https://github.com/sourcebot-dev/sourcebot/pull/718) + ## [1.0.10] - 2025-11-24 ### Changed diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts index 9b92b729f..43c08f248 100644 --- a/packages/mcp/src/index.ts +++ b/packages/mcp/src/index.ts @@ -106,8 +106,8 @@ server.tool( (acc, chunk) => acc + chunk.matchRanges.length, 0, ); - - let text = `file: ${file.fileName.text}\nnum_matches: ${numMatches}\nrepository: ${file.repository}\nlanguage: ${file.language}`; + const fileIdentifier = file.webUrl ?? file.fileName.text; + let text = `file: ${fileIdentifier}\nnum_matches: ${numMatches}\nrepository: ${file.repository}\nlanguage: ${file.language}`; if (includeCodeSnippets) { const snippets = file.chunks.map(chunk => { @@ -201,9 +201,10 @@ server.tool( // Format output const content: TextContent[] = paginated.map(repo => { + const repoUrl = repo.webUrl ?? repo.repoCloneUrl; return { type: "text", - text: `id: ${repo.repoName}\nurl: ${repo.repoCloneUrl}`, + text: `id: ${repo.repoName}\nurl: ${repoUrl}`, } }); From 653df1dc2441098ec47dc6e6fbe169740d949f41 Mon Sep 17 00:00:00 2001 From: msukkari Date: Tue, 13 Jan 2026 17:53:15 -0800 Subject: [PATCH 5/5] fix changelog entry --- packages/mcp/CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/mcp/CHANGELOG.md b/packages/mcp/CHANGELOG.md index 2fe71ca59..c9410f80c 100644 --- a/packages/mcp/CHANGELOG.md +++ b/packages/mcp/CHANGELOG.md @@ -15,9 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Updated API client to match the latest Sourcebot release. [#652](https://github.com/sourcebot-dev/sourcebot/pull/652) -### Fixed -- Fixed invalid file and url MCP results for local indexed repos [#718](https://github.com/sourcebot-dev/sourcebot/pull/718) - ## [1.0.10] - 2025-11-24 ### Changed