Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/modes/tag/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Comment on lines +134 to +138
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tagModeTools already contains user-supplied MCP tools via userAllowedMCPTools. Unconditionally pushing mcp__github_inline_comment__create_inline_comment for PRs can introduce duplicates when the user also provided that tool, and --allowedTools later uses tagModeTools.join(",") without de-duping. Consider building a de-duplicated list once (e.g., via Set) and use it consistently for both prepareMcpConfig and the CLI --allowedTools string.

Copilot uses AI. Check for mistakes.

// 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) {
Expand Down
43 changes: 43 additions & 0 deletions test/install-mcp-server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});