diff --git a/src/mcp/install-mcp-server.ts b/src/mcp/install-mcp-server.ts index a83acbe..ff20269 100644 --- a/src/mcp/install-mcp-server.ts +++ b/src/mcp/install-mcp-server.ts @@ -32,9 +32,6 @@ export async function prepareMcpConfig( const hasGitHubMcpTools = allowedToolsList.some((tool) => tool.startsWith("mcp__github__"), ); - const hasGitHubFileOpsTools = allowedToolsList.some((tool) => - tool.startsWith("mcp__github_file_ops__"), - ); // Start with an empty servers object const mcpServers: Record = {}; @@ -59,26 +56,24 @@ export async function prepareMcpConfig( // Always include github_file_ops server as it contains essential tools // (mcp__github_file_ops__commit_files, mcp__github_file_ops__update_claude_comment) - // These are in the BASE_ALLOWED_TOOLS - if (hasGitHubFileOpsTools || !allowedTools) { - mcpServers.github_file_ops = { - command: "bun", - args: [ - "run", - `${process.env.GITHUB_ACTION_PATH}/src/mcp/github-file-ops-server.ts`, - ], - env: { - GITHUB_TOKEN: githubToken, - REPO_OWNER: owner, - REPO_NAME: repo, - BRANCH_NAME: branch, - REPO_DIR: process.env.GITHUB_WORKSPACE || process.cwd(), - ...(claudeCommentId && { CLAUDE_COMMENT_ID: claudeCommentId }), - GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || "", - IS_PR: process.env.IS_PR || "false", - }, - }; - } + // These are in the BASE_ALLOWED_TOOLS and should always be available + mcpServers.github_file_ops = { + command: "bun", + args: [ + "run", + `${process.env.GITHUB_ACTION_PATH}/src/mcp/github-file-ops-server.ts`, + ], + env: { + GITHUB_TOKEN: githubToken, + REPO_OWNER: owner, + REPO_NAME: repo, + BRANCH_NAME: branch, + REPO_DIR: process.env.GITHUB_WORKSPACE || process.cwd(), + ...(claudeCommentId && { CLAUDE_COMMENT_ID: claudeCommentId }), + GITHUB_EVENT_NAME: process.env.GITHUB_EVENT_NAME || "", + IS_PR: process.env.IS_PR || "false", + }, + }; const baseMcpConfig = { mcpServers, diff --git a/test/install-mcp-server.test.ts b/test/install-mcp-server.test.ts index 539c1fc..5f6d1b3 100644 --- a/test/install-mcp-server.test.ts +++ b/test/install-mcp-server.test.ts @@ -81,7 +81,7 @@ describe("prepareMcpConfig", () => { expect(parsed.mcpServers.github_file_ops).toBeDefined(); }); - test("should not include any MCP servers when no GitHub tools are allowed", async () => { + test("should include file_ops server even when no GitHub tools are allowed", async () => { const result = await prepareMcpConfig({ githubToken: "test-token", owner: "test-owner", @@ -93,7 +93,7 @@ describe("prepareMcpConfig", () => { const parsed = JSON.parse(result); expect(parsed.mcpServers).toBeDefined(); expect(parsed.mcpServers.github).not.toBeDefined(); - expect(parsed.mcpServers.github_file_ops).not.toBeDefined(); + expect(parsed.mcpServers.github_file_ops).toBeDefined(); }); test("should return base config when additional config is empty string", async () => {