claude-code-action icon indicating copy to clipboard operation
claude-code-action copied to clipboard

Default Github MCP servers are not starting even with explicit allowed tools

Open patrickbosch-trilogy opened this issue 1 year ago • 6 comments

Describe the bug The default MCP servers for Github operations like adding a comment are not starting, at least, the debug output doesn't show it. The model then gets an error that specific tools aren't available, for example, when trying to update a comment.

The debug output for startup is the following:

2025-09-04T12:10:13.0748529Z ##[debug]ALLOWED_TOOLS='Edit,MultiEdit,Glob,Grep,LS,Read,Write,mcp__github_comment__update_claude_comment,Bash(git add:),Bash(git commit:),Bash(git push:),Bash(git status:),Bash(git diff:),Bash(git log:),Bash(git rm:)' 2025-09-04T12:10:13.0749415Z ##[debug]DISALLOWED_TOOLS='WebSearch,WebFetch' 2025-09-04T12:10:13.0770295Z ##[debug]Set output action_inputs_present = {"trigger_phrase":false,"assignee_trigger":false,"label_trigger":false,"base_branch":false,"branch_prefix":false,"allowed_bots":false,"mode":true,"model":false,"anthropic_model":false,"fallback_model":false,"allowed_tools":false,"disallowed_tools":false,"custom_instructions":false,"direct_prompt":false,"override_prompt":false,"additional_permissions":false,"claude_env":false,"settings":false,"anthropic_api_key":false,"claude_code_oauth_token":false,"github_token":true,"max_turns":false,"use_sticky_comment":false,"use_commit_signing":false,"experimental_allowed_domains":false} 2025-09-04T12:10:13.0772549Z ##[debug]Set output GITHUB_TOKEN = *** 2025-09-04T12:10:13.0772886Z ##[debug]Set output contains_trigger = true 2025-09-04T12:10:13.0773239Z ##[debug]Set output claude_comment_id = 3253392938 2025-09-04T12:10:13.0773622Z ##[debug]Set output claude_args = --mcp-config '{ 2025-09-04T12:10:13.0773917Z ##[debug] "mcpServers": {} 2025-09-04T12:10:13.0775069Z ##[debug]}' --allowedTools "Edit,MultiEdit,Glob,Grep,LS,Read,Write,mcp__github_comment__update_claude_comment,mcp__github_ci__get_ci_status,mcp__github_ci__get_workflow_run_details,mcp__github_ci__download_job_log,Bash(git add:),Bash(git commit:),Bash(git push:),Bash(git status:),Bash(git diff:),Bash(git log:),Bash(git rm:)" --model us.anthropic.claude-opus-4-1-20250805-v1:0

It doesn't make a difference if allowedTools are specifically set as an argument either:

2025-09-04T13:20:10.5661525Z ##[debug]ALLOWED_TOOLS='Edit,MultiEdit,Glob,Grep,LS,Read,Write,mcp__github_comment__update_claude_comment,Bash(git add:),Bash(git commit:),Bash(git push:),Bash(git status:),Bash(git diff:),Bash(git log:),Bash(git rm:)' 2025-09-04T13:20:10.5662417Z ##[debug]DISALLOWED_TOOLS='WebSearch,WebFetch' 2025-09-04T13:20:10.5682399Z ##[debug]Set output action_inputs_present = {"trigger_phrase":false,"assignee_trigger":false,"label_trigger":false,"base_branch":false,"branch_prefix":false,"allowed_bots":false,"mode":true,"model":false,"anthropic_model":false,"fallback_model":false,"allowed_tools":false,"disallowed_tools":false,"custom_instructions":false,"direct_prompt":false,"override_prompt":false,"additional_permissions":false,"claude_env":false,"settings":false,"anthropic_api_key":false,"claude_code_oauth_token":false,"github_token":true,"max_turns":false,"use_sticky_comment":false,"use_commit_signing":false,"experimental_allowed_domains":false} 2025-09-04T13:20:10.5684662Z ##[debug]Set output GITHUB_TOKEN = *** 2025-09-04T13:20:10.5684998Z ##[debug]Set output contains_trigger = true 2025-09-04T13:20:10.5685346Z ##[debug]Set output claude_comment_id = 3253690483 2025-09-04T13:20:10.5685715Z ##[debug]Set output claude_args = --mcp-config '{ 2025-09-04T13:20:10.5686016Z ##[debug] "mcpServers": {} 2025-09-04T13:20:10.5687207Z ##[debug]}' --allowedTools "Edit,MultiEdit,Glob,Grep,LS,Read,Write,mcp__github_comment__update_claude_comment,mcp__github_ci__get_ci_status,mcp__github_ci__get_workflow_run_details,mcp__github_ci__download_job_log,Bash(git add:),Bash(git commit:),Bash(git push:),Bash(git status:),Bash(git diff:),Bash(git log:),Bash(git rm:)" --model us.anthropic.claude-opus-4-1-20250805-v1:0 2025-09-04T13:20:10.5689329Z ##[debug]--allowedTools "mcp__github_comment__update_claude_comment,mcp__github_inline_comment__create_inline_comment,mcp__github_ci__get_ci_status,mcp__github_ci__get_workflow_run_details,mcp__github_ci__download_job_log,Bash(gh pr comment:),Bash(gh pr diff:),Bash(gh pr view:*)"

The result is the following issue when the model is trying to use the tool:

2025-09-04T12:13:45.6462951Z { 2025-09-04T12:13:45.6463451Z "type": "user", 2025-09-04T12:13:45.6463803Z "message": { 2025-09-04T12:13:45.6464120Z "role": "user", 2025-09-04T12:13:45.6464458Z "content": [ 2025-09-04T12:13:45.6464794Z { 2025-09-04T12:13:45.6465095Z "type": "tool_result", 2025-09-04T12:13:45.6465865Z "content": "<tool_use_error>Error: No such tool available: mcp__github_comment__update_claude_comment</tool_use_error>", 2025-09-04T12:13:45.6466888Z "is_error": true, 2025-09-04T12:13:45.6467381Z "tool_use_id": "toolu_bdrk_012yjDgacDVuckvEG9gWUmSU" 2025-09-04T12:13:45.6467907Z } 2025-09-04T12:13:45.6468205Z ] 2025-09-04T12:13:45.6468511Z }, 2025-09-04T12:13:45.6468848Z "parent_tool_use_id": null, 2025-09-04T12:13:45.6469343Z "session_id": "01b27eea-fe4f-4009-8000-bec4b21f51f5", 2025-09-04T12:13:45.6469902Z "uuid": "6b83b396-92f8-4930-a781-dfacffe07366" 2025-09-04T12:13:45.6470353Z }

To Reproduce Steps to reproduce the behavior:

  1. Set up the claude code action with v1 tag
  2. Define a prompt, track_progress, claude_args with allowed tools basically allowing any of the github MCP ones, bedrock true, and setting a bedrock model
  3. Run it as an action, for example, triggering on a commit for a review, similar to https://github.com/anthropics/claude-code-action/blob/main/examples/pr-review-comprehensive.yml

Expected behavior MCP servers should start and tools should be available to the model.

Workflow yml file This is a minimized version of the workflow removing the mention part:

name: Claude

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  pull_request_review:
    types: [submitted]
  issues:
    types: [opened, assigned]

jobs:
  review-pr:
    if: github.event_name == 'pull_request' && !github.event.pull_request.draft
    runs-on: ubuntu-latest
    concurrency:
      group: review-pr-${{ github.head_ref }}
      cancel-in-progress: true
    permissions:
      contents: read
      pull-requests: write
      issues: read
      id-token: write

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: <some_arn>
          aws-region: <some_region>

      - name: Claude automatic PR review
        uses: anthropics/claude-code-action@v1
        with:
          use_bedrock: true
          github_token: ${{ secrets.GITHUB_TOKEN }}
          track_progress: true
          claude_args: |
            --model us.anthropic.claude-opus-4-1-20250805-v1:0
            --allowedTools "mcp__github_comment__update_claude_comment,mcp__github_inline_comment__create_inline_comment,mcp__github_ci__get_ci_status,mcp__github_ci__get_workflow_run_details,mcp__github_ci__download_job_log,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
          prompt: |
            Some prompt

API Provider

[ ] Anthropic First-Party API (default) [x] AWS Bedrock [ ] GCP Vertex

Additional context I saw a recent PR that could be related as it makes MCP servers conditional: https://github.com/anthropics/claude-code-action/pull/513

patrickbosch-trilogy avatar Sep 04 '25 13:09 patrickbosch-trilogy

I am running into this as well:

{
  "type": "user",
  "message": {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "content": "<tool_use_error>Error: No such tool available: mcp__github_comment__update_claude_comment</tool_use_error>",
        "is_error": true,
        "tool_use_id": "toolu_0173aKjAk2ZaAd3G9CTJvj1v"
      }
    ]
  },
  "parent_tool_use_id": null,
  "session_id": "7b3b6b2e-af7c-48f9-a9de-ca398a66f79d",
  "uuid": "2543298b-0dc1-4c9f-8d6a-69128d094c9a"
}

dkobia avatar Sep 04 '25 14:09 dkobia

When reviewing PRs, Claude won't use the mcp__github_comment__update_claude_comment tool. We recommend using the allowed tools from the example you linked: https://github.com/anthropics/claude-code-action/blob/main/examples/pr-review-comprehensive.yml#L68C29-L68C78

ashwin-ant avatar Sep 04 '25 15:09 ashwin-ant

The mcp__github_comment__update_claude_comment is only used for when Claude is explicitly @-mentioned somewhere.

ashwin-ant avatar Sep 04 '25 15:09 ashwin-ant

@ashwin-ant this issue persists. In the auto-review below I still get this error. @-mentioned is not used. Additionally tracking_comments are not updated. The final comment even if it is complete is I'll analyze this and get back to you.

{
  "type": "user",
  "message": {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "content": "<tool_use_error>Error: No such tool available: mcp__github_comment__update_claude_comment</tool_use_error>",
        "is_error": true,
        "tool_use_id": "toolu_01M5WDWMPphnS4qfrWwxh9D1"
      }
    ]
  },
  "parent_tool_use_id": null,
  "session_id": "2db638c8-8439-4ba2-b050-49f975d529f4",
  "uuid": "a8503e9c-06dc-4d24-af58-7ff1d14fa743"
}
name: Claude PR Assistant

on:
  # Manual “@claude …” triggers
  issue_comment: { types: [ created ] }
  pull_request_review_comment: { types: [ created ] }
  pull_request_review: { types: [ submitted ] }
  issues: { types: [ opened, assigned ] }

  # Automatic review on every PR push / creation
  pull_request: { types: [ opened, synchronize, ready_for_review, reopened ] }

permissions:
  contents: write
  pull-requests: write
  issues: write
  id-token: write
  actions: read

jobs:
  ##########################
  # 1. AUTOMATIC PR REVIEW #
  ##########################
  auto-review:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Automatic PR Review
        uses: anthropics/claude-code-action@v1
        with:
          github_token: ${{ secrets.GH_ACTIONS_TOKEN }}
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          claude_args: |
            --model claude-sonnet-4-20250514
            --allowedTools "mcp__github_comment__update_claude_comment,mcp__github_inline_comment__create_inline_comment,mcp__github_ci__get_ci_status,mcp__github_ci__get_workflow_run_details,mcp__github_ci__download_job_log,View,Read,Bash,Write"
          track_progress: true
          prompt: |
            REPO: ${{ github.repository }}
            PR NUMBER: ${{ github.event.pull_request.number }}
            
            Please review this pull request and provide comprehensive feedback.

            ... rest of prompt

  ############################
  # 2. MANUAL “@claude …” JOB #
  ############################
  claude-code-action:
    if: |
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
      (github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 1
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Run Claude PR Action
        uses: anthropics/claude-code-action@v1
        with:
          github_token: ${{ secrets.GH_ACTIONS_TOKEN }}
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          track_progress: true
          claude_args: |
            --model claude-sonnet-4-20250514
            --allowedTools "mcp__github_comment__update_claude_comment,mcp__github_inline_comment__create_inline_comment,mcp__github_ci__get_ci_status,mcp__github_ci__get_workflow_run_details,mcp__github_ci__download_job_log,View,Read,Bash,Write"

Finally you'll see that I'm having to add a personal access token via github_token otherwise I run into this error (not sure if this has been brought up before):

Trigger result: true
Preparing with mode: agent for event: pull_request
GET /user - 403 with id D7C4:913B:1A51A08:5EE5F90:68B99D5F in 64ms
Failed to configure git authentication: 11 |   /**
12 |    * Response object if a response was received
13 |    */
14 |   response;
15 |   constructor(message, statusCode, options) {
16 |     super(message);
         ^
HttpError: Resource not accessible by integration - https://docs.github.com/rest/users/users#get-the-authenticated-user
   status: 403,
  request: {
  method: "GET",
  url: "https://api.github.com/user",
  headers: [Object ...],
  request: [Object ...],
},
 response: {
  url: "https://api.github.com/user",
  status: 403,
  headers: [Object ...],
  data: [Object ...],
},

      at new RequestError (/home/runner/work/_actions/anthropics/claude-code-action/v1/node_modules/@octokit/rest/node_modules/@octokit/core/node_modules/@octokit/request-error/dist-src/index.js:16:5)
      at fetchWrapper (/home/runner/work/_actions/anthropics/claude-code-action/v1/node_modules/@octokit/rest/node_modules/@octokit/core/node_modules/@octokit/request/dist-bundle/index.js:122:11)

dkobia avatar Sep 04 '25 18:09 dkobia

@ashwin-ant this issue persists. In the auto-review below I still get this error. @-mentioned is not used. Additionally tracking_comments are not updated. The final comment even if it is complete is I'll analyze this and get back to you.

I was having this same problem with track progress, tried downgrading to v1.0.3, and the track_progress started working again every time.

I'm still sometimes getting odd behavior where even though prompted to only review code (I'm using pr-review-comprehensive.yml), the action will modify and push code changes to the PR. This tends to happen when changes have been requested at some point in the PR, but Claude was never @ mentioned to make changes. I even tried adding "CRITICAL: ONLY REVIEW CODE--DO NOT IMPLEMENT ANY CHANGES REQUESTED IN OTHER COMMENTS!!!" to the example prompt, and that didn't help. So it seems like the prompt isn't getting used.

hskiba avatar Sep 04 '25 23:09 hskiba

I was also struggling with the same issue, but after seeing the comment at https://github.com/anthropics/claude-code-action/issues/532#issuecomment-3256200247, I removed track_progress: true and now the auto-review comments are working properly in v1.0.4 as well. Thank you!

sosukeokubo avatar Sep 05 '25 10:09 sosukeokubo