🫑

anthropics/claude-code-action@v1 の builtin github tool の有効化の方法と紹介

に公開

組織で AI 自動開発の仕組みを作ろうとしており、その中で claude-code-action を使用しています。

組み込み GitHub MCP Server があるよーとドキュメントには書いてあるものの claude_args に --dangerously-skip-permissions を付与しても使えず、有効にする方法がよくわからなかったのでメモ。

Using Custom MCP Configuration

You can add custom MCP (Model Context Protocol) servers to extend Claude's capabilities using the --mcp-config flag in claude_args. These servers merge with the built-in GitHub MCP servers.

https://github.com/anthropics/claude-code-action/blob/main/docs/configuration.md#using-custom-mcp-configuration


結論

allowedTools で明示的に許可しないと入らないものがあるので、使いたいものについて調べて claude_args: --allowedTools に書く。

- name: Run Claude Code Action
  uses: anthropics/claude-code-action@v1
  with:
    claude_args: |
      --allowedTools mcp__github_ci__get_ci_status

また mcp__github__* を記載すると、github 公式の mcp-server が有効になる。

- name: Run Claude Code Action
  uses: anthropics/claude-code-action@v1
  with:
    claude_args: |
      --allowedTools mcp__github__pull_request_read

https://github.com/github/github-mcp-server

理由

claude-code-actionの内部処理で allowedTools に応じて有効にするツールを切り替えているため。

https://github.com/anthropics/claude-code-action/blob/3eacedbeb73bdaa9e72f354f7d6f72e2a336166c/src/mcp/install-mcp-server.ts#L67-L86

https://github.com/anthropics/claude-code-action/blob/2e92922dd680524c75abf6a46fbf8633f59cb0f7/src/modes/agent/index.ts#L113-L140

組み込みサーバー一覧

せっかく調べたので記載しておきます。ツール一覧は実装の toolName と description をコピペしただけ。ツール単体で許可したい時は mcp__github_ci__get_ci_status のようにすれば良い。

github-actions-server.ts

mcp__github_ci__* が allowedTools にあると有効になる。
たぶん additional_permissions の記述とトークンに action の read 権限が必要。

- name: Run Claude Code Action
  uses: anthropics/claude-code-action@v1
  with:
    claude_args: |
        --allowedTools github_ci__get_ci_status
    additional_permissions: |
        actions: read
  • get_ci_status: Get CI status summary for this PR
  • get_workflow_run_details: Get job and step details for a workflow run
  • download_job_log: Download job logs to disk

https://github.com/anthropics/claude-code-action/blob/0f9a2c4dc3ab97e8e566ac723330fdb05b888d78/src/mcp/github-actions-server.ts

github-comment-server.ts

これは常に有効になる。実装上は !isAgentMode という条件があるものの、現状は常に agent モードになる。

  • update_claude_comment: Update the Claude comment with progress and results (automatically handles both issue and PR comments)

https://github.com/anthropics/claude-code-action/blob/a1507aefdc04f00f278407dba905d158ac62399e/src/mcp/github-comment-server.ts

github-file-ops-server.ts

actionの呼び出し時に use_commit_signing: true を渡していると有効になるぽい。

https://github.com/anthropics/claude-code-action/blob/3eacedbeb73bdaa9e72f354f7d6f72e2a336166c/src/mcp/install-mcp-server.ts#L116-L135

https://github.com/anthropics/claude-code-action/blob/9db20ef677c726762b864933147219a688175107/action.yml#L76-L79

use_commit_signing の description 的に署名付きコミットをする時に使うぽい。まあ github actions のランナーに git と gh があるので false で困ることはなさそう。

  • commit_files: Commit one or more files to a repository in a single commit (this will commit them atomically in the remote repository)
  • delete_files: Delete one or more files from a repository in a single commit

https://github.com/anthropics/claude-code-action/blob/0630ef383a451c46ccac86eb86ee7641e99c4c9a/src/mcp/github-file-ops-server.ts

github-inline-comment-server.ts

mcp__github_inline_comment__* が allowedTools にあると有効になる。

  • create_inline_comment: Create an inline comment on a specific line or lines in a PR file

組み込みツールとしては最重要。これが無いと PR へインラインコメントをすることが難しい。
ランナー内に gh があるためよしなにやってくれそうだが、gh api ではなく gh graphql を使用する必要があることと、仕様が割と複雑なので gh コマンドでやるのはむずい。とりあえず有効にしておくことをおすすめします。

気になる人は以下の公式ドキュメントを参照。

https://docs.github.com/ja/rest/pulls/comments

https://github.com/anthropics/claude-code-action/blob/a1507aefdc04f00f278407dba905d158ac62399e/src/mcp/github-inline-comment-server.ts

ちなみに

いつも Claude Code を使っていると忘れがちだが WebSearch ツールはデフォルト無効なので allowedTools に入れておくと良い。

- name: Run Claude Code Action
  uses: anthropics/claude-code-action@v1
  with:
    claude_args: |
      --allowedTools WebSearch

ちなみに Claude Code は mcp__{mcpServerName} で指定した mcp サーバーの許可をすることができるが、この実装は mcp__github_comment__ のようになっているので、全ツールを許可している状態だと逆に使えないという問題が起こる。

mcp__github__* があると github 公式の mcp server が有効になるが、github 公式の方は mcp サーバーの起動時に使用可能なツールを制限することができるので、そっちでそもそも使えるツールの制御をして全部許可しとくのが楽。

https://github.com/github/github-mcp-server?tab=readme-ov-file#tool-configuration

https://github.com/anthropics/claude-code-action/blob/3eacedbeb73bdaa9e72f354f7d6f72e2a336166c/src/mcp/install-mcp-server.ts#L201-L219

ちなみに2

冒頭で触れた AI 自動開発の仕組みは、アドベントカレンダーで詳しく記載する予定なので、よければそちらもご覧ください。

https://qiita.com/advent-calendar/2025/air-closet

追記

投稿後にインラインコメントについて書いている記事があったのに気づいた。もっと早く気づきたかった……。

https://zenn.dev/sonicmoov/articles/55f83aa4338756

エアークローゼットテックブログ

Discussion