From 25f9b8ef9ec0e3c1882b2075a6f1a14bd2458ab7 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Wed, 11 Jun 2025 17:45:05 -0400 Subject: [PATCH] fix: add baseUrl to Octokit initialization in update_claude_comment (#157) * fix: add baseUrl to Octokit initialization in update_claude_comment Fixes Bad credentials error on GitHub Enterprise Server by passing GITHUB_API_URL as baseUrl when initializing Octokit, consistent with other Octokit instances in the codebase. Fixes #156 Related to #107 Co-authored-by: ashwin-ant * fix: pass GITHUB_API_URL as env var to MCP server Update the MCP server initialization to pass GITHUB_API_URL as an environment variable, allowing it to work correctly with GitHub Enterprise Server instances. Co-authored-by: ashwin-ant * fix: import GITHUB_API_URL from config in install-mcp-server Use the centralized GITHUB_API_URL constant from src/github/api/config.ts instead of reading directly from process.env when passing environment variables to the MCP server. This ensures consistency with how the API URL is handled throughout the codebase. Co-authored-by: ashwin-ant * fix --------- Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: ashwin-ant --- src/mcp/github-file-ops-server.ts | 1 + src/mcp/install-mcp-server.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/mcp/github-file-ops-server.ts b/src/mcp/github-file-ops-server.ts index a34f115..9a769af 100644 --- a/src/mcp/github-file-ops-server.ts +++ b/src/mcp/github-file-ops-server.ts @@ -466,6 +466,7 @@ server.tool( const octokit = new Octokit({ auth: githubToken, + baseUrl: GITHUB_API_URL, }); const isPullRequestReviewComment = diff --git a/src/mcp/install-mcp-server.ts b/src/mcp/install-mcp-server.ts index 0eba6af..0fa5436 100644 --- a/src/mcp/install-mcp-server.ts +++ b/src/mcp/install-mcp-server.ts @@ -1,4 +1,5 @@ import * as core from "@actions/core"; +import { GITHUB_API_URL } from "../github/api/config"; type PrepareConfigParams = { githubToken: string; @@ -46,6 +47,7 @@ export async function prepareMcpConfig( ...(claudeCommentId && { CLAUDE_COMMENT_ID: claudeCommentId }), GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || "", IS_PR: process.env.IS_PR || "false", + GITHUB_API_URL: GITHUB_API_URL, }, }, },