From 6ede3f41d80effc6837fcf33cc7063722ee7d1e2 Mon Sep 17 00:00:00 2001 From: kiannidev <156195510+kiannidev@users.noreply.github.com> Date: Wed, 1 Jul 2026 11:07:40 +0200 Subject: [PATCH] fix(mcp): parse http and git protocol GitHub remotes Support legacy git:// and plain http:// GitHub remote URLs so local MCP preflight can infer repoFullName without an explicit --repo override. Co-authored-by: Cursor --- packages/gittensory-mcp/lib/local-branch.js | 2 ++ test/unit/local-branch.test.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/gittensory-mcp/lib/local-branch.js b/packages/gittensory-mcp/lib/local-branch.js index 95bfb25e1e..4e34385d5b 100644 --- a/packages/gittensory-mcp/lib/local-branch.js +++ b/packages/gittensory-mcp/lib/local-branch.js @@ -16,7 +16,9 @@ export function parseGitRemote(remoteUrl) { const patterns = [ /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/, /^https:\/\/github\.com\/([^/]+)\/(.+?)(?:\.git)?$/, + /^http:\/\/github\.com\/([^/]+)\/(.+?)(?:\.git)?$/, /^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?$/, + /^git:\/\/github\.com\/([^/]+)\/(.+?)(?:\.git)?$/, ]; for (const pattern of patterns) { const match = trimmed.match(pattern); diff --git a/test/unit/local-branch.test.ts b/test/unit/local-branch.test.ts index 16ad62dff5..50af3ac1e4 100644 --- a/test/unit/local-branch.test.ts +++ b/test/unit/local-branch.test.ts @@ -1759,6 +1759,8 @@ describe("local MCP git metadata collection", () => { expect(parseGitRemote("https://github.com/JSONbored/gittensory.git")).toBe("JSONbored/gittensory"); expect(parseGitRemote("https://github.com/JSONbored/gittensory/")).toBe("JSONbored/gittensory"); expect(parseGitRemote("https://github.com/JSONbored/gittensory////")).toBe("JSONbored/gittensory"); + expect(parseGitRemote("http://github.com/JSONbored/gittensory.git")).toBe("JSONbored/gittensory"); + expect(parseGitRemote("git://github.com/JSONbored/gittensory.git")).toBe("JSONbored/gittensory"); expect(parseGitRemote(`x${"/".repeat(32_000)}x`)).toBeUndefined(); tempDir = mkdtempSync(join(tmpdir(), "gittensory-local-"));