diff --git a/src/modes/tag/index.ts b/src/modes/tag/index.ts index 0adf746c2..50865794e 100644 --- a/src/modes/tag/index.ts +++ b/src/modes/tag/index.ts @@ -131,6 +131,12 @@ export async function prepareTagMode({ ...userAllowedMCPTools, ]; + // Enable inline PR comments for PR contexts so Claude can post + // review feedback directly on diff lines alongside the tracking comment + if (context.isPR) { + tagModeTools.push("mcp__github_inline_comment__create_inline_comment"); + } + // Add git commands when using git CLI (no API commit signing, or SSH signing) // SSH signing still uses git CLI, just with signing enabled if (!useApiCommitSigning) { diff --git a/test/install-mcp-server.test.ts b/test/install-mcp-server.test.ts index 152d2be78..7d4df2b6d 100644 --- a/test/install-mcp-server.test.ts +++ b/test/install-mcp-server.test.ts @@ -313,4 +313,47 @@ describe("prepareMcpConfig", () => { const parsed = JSON.parse(result); expect(parsed.mcpServers.github_ci).not.toBeDefined(); }); + + test("should not include inline comment server for non-PR contexts", async () => { + const result = await prepareMcpConfig({ + githubToken: "test-token", + owner: "test-owner", + repo: "test-repo", + branch: "test-branch", + baseBranch: "main", + allowedTools: ["mcp__github_inline_comment__create_inline_comment"], + mode: "tag", + context: mockContext, // isPR: false + }); + + const parsed = JSON.parse(result); + expect(parsed.mcpServers.github_inline_comment).not.toBeDefined(); + }); + + test("should include both comment and inline comment servers for PR contexts", async () => { + const mockPRContextWithSticky: ParsedGitHubContext = { + ...mockPRContext, + inputs: { + ...mockPRContext.inputs, + useStickyComment: true, + }, + }; + + const result = await prepareMcpConfig({ + githubToken: "test-token", + owner: "test-owner", + repo: "test-repo", + branch: "test-branch", + baseBranch: "main", + allowedTools: ["mcp__github_inline_comment__create_inline_comment"], + mode: "tag", + context: mockPRContextWithSticky, + }); + + const parsed = JSON.parse(result); + // Both comment server (for sticky tracking comment) and inline comment server should coexist + expect(parsed.mcpServers.github_comment).toBeDefined(); + expect(parsed.mcpServers.github_inline_comment).toBeDefined(); + expect(parsed.mcpServers.github_inline_comment.env.PR_NUMBER).toBe("456"); + }); });