GH-AW as an MCP Server
The gh aw mcp-server command exposes the GitHub Agentic Workflows CLI commands (status, compile, logs, audit, update, add, mcp-inspect) as tools to AI agents through the Model Context Protocol.
This allows your chat system or other workflows to interact with GitHub Agentic Workflows, check their status, download logs, and perform audits programmatically, all while respecting repository permissions and security best practices.
Start the server:
gh aw mcp-serverOr configure for any Model Context Protocol (MCP) host:
command: ghargs: [aw, mcp-server]Configuration Options
Section titled “Configuration Options”HTTP Server Mode
Section titled “HTTP Server Mode”Run with HTTP/SSE transport using --port:
gh aw mcp-server --port 8080Actor Validation
Section titled “Actor Validation”Control access to logs and audit tools based on repository permissions using --validate-actor:
gh aw mcp-server --validate-actorWhen actor validation is enabled:
- Logs and audit tools require write, maintain, or admin repository access
- The server reads
GITHUB_ACTORandGITHUB_REPOSITORYenvironment variables to determine actor permissions - Permission checks are performed at runtime using the GitHub API
- Results are cached for 1 hour to minimize API calls
When actor validation is disabled (default):
- All tools are available without permission checks
- Backward compatible with existing configurations
Environment Variables:
GITHUB_ACTOR: GitHub username of the current actor (required when validation enabled)GITHUB_REPOSITORY: Repository inowner/repoformat (optional, improves performance)
Permission Requirements:
Restricted tools (logs, audit) require:
- Minimum role: write, maintain, or admin
- Permission check via GitHub API:
GET /repos/{owner}/{repo}/collaborators/{username}/permission
Configuring with GitHub Copilot Agent
Section titled “Configuring with GitHub Copilot Agent”Configure GitHub Copilot Agent to use gh-aw MCP server:
gh aw initThis creates .github/workflows/copilot-setup-steps.yml that sets up Go, GitHub CLI, and gh-aw extension before agent sessions start, making workflow management tools available to the agent. MCP server integration is enabled by default. Use gh aw init --no-mcp to skip MCP configuration.
Configuring with Copilot CLI
Section titled “Configuring with Copilot CLI”To add the MCP server in the interactive Copilot CLI session, start copilot and run:
/mcp add github-agentic-workflows gh aw mcp-serverConfiguring with VS Code
Section titled “Configuring with VS Code”Configure VS Code Copilot Chat to use gh-aw MCP server:
gh aw initThis creates .vscode/mcp.json and .github/workflows/copilot-setup-steps.yml. MCP server integration is enabled by default. Use gh aw init --no-mcp to skip MCP configuration.
Alternatively, create .vscode/mcp.json manually:
{ "servers": { "github-agentic-workflows": { "command": "gh", "args": ["aw", "mcp-server"], "cwd": "${workspaceFolder}" } }}Reload VS Code after making changes.
Configuring with Docker
Section titled “Configuring with Docker”If gh is not installed locally, use the ghcr.io/github/gh-aw Docker image. The image ships with the GitHub CLI and gh-aw pre-installed and uses mcp-server as the default command.
{ "command": "docker", "args": [ "run", "--rm", "-i", "-e", "GITHUB_TOKEN", "-e", "GITHUB_ACTOR", "ghcr.io/github/gh-aw:latest", "mcp-server" ]}Pass your GitHub token via the GITHUB_TOKEN environment variable. Add --validate-actor to the args array to enforce permission checks based on GITHUB_ACTOR.
Available Tools
Section titled “Available Tools”The MCP server exposes the following tools for workflow management:
status
Section titled “status”Show status of agentic workflow files and workflows.
Parameters:
pattern(optional): Filter workflows by name patternjq(optional): Apply jq filter to JSON output
Returns: JSON array with workflow information including:
workflow: Name of the workflow fileagent: AI engine used (e.g., “copilot”, “claude”, “codex”)compiled: Compilation status (“Yes”, “No”, or “N/A”)status: GitHub workflow status (“active”, “disabled”, “Unknown”)time_remaining: Time remaining until workflow deadline (if applicable)
compile
Section titled “compile”Compile Markdown workflows to GitHub Actions YAML with optional static analysis.
Parameters:
workflows(optional): Array of workflow files to compile (empty for all)strict(optional): Enforce strict mode validation (default: true)fix(optional): Apply automatic codemod fixes before compilingzizmor(optional): Run zizmor security scannerpoutine(optional): Run poutine security scanneractionlint(optional): Run actionlint linterjq(optional): Apply jq filter to JSON output
Returns: JSON array with validation results:
workflow: Name of the workflow filevalid: Boolean indicating compilation successerrors: Array of error objects with type, message, and line numberwarnings: Array of warning objectscompiled_file: Path to generated.lock.ymlfile
Download and analyze workflow logs with timeout handling and size guardrails.
Parameters:
workflow_name(optional): Workflow name to download logs for (empty for all)count(optional): Number of workflow runs to download (default: 100)start_date(optional): Filter runs after this date (YYYY-MM-DD or delta like -1d, -1w, -1mo)end_date(optional): Filter runs before this dateengine(optional): Filter by agentic engine type (claude, codex, copilot)firewall(optional): Filter to only runs with firewall enabledno_firewall(optional): Filter to only runs without firewallbranch(optional): Filter runs by branch nameafter_run_id(optional): Filter runs after this database IDbefore_run_id(optional): Filter runs before this database IDtimeout(optional): Maximum time in seconds to download logs (default: 50)max_tokens(optional): Maximum output tokens before guardrail triggers (default: 12000)jq(optional): Apply jq filter to JSON output
Returns: JSON with workflow run data and metrics, or continuation parameters if timeout occurred.
Investigate a workflow run, job, or specific step and generate a detailed report.
Parameters:
run_id_or_url(required): One of:- Numeric run ID:
1234567890 - Run URL:
https://github.com/owner/repo/actions/runs/1234567890 - Job URL:
https://github.com/owner/repo/actions/runs/1234567890/job/9876543210 - Job URL with step:
https://github.com/owner/repo/actions/runs/1234567890/job/9876543210#step:7:1
- Numeric run ID:
jq(optional): Apply jq filter to JSON output
Returns: JSON with comprehensive audit data:
overview: Basic run information (run_id, workflow_name, status, conclusion, duration, url, logs_path)metrics: Execution metrics (token_usage, estimated_cost, turns, error_count, warning_count)jobs: List of job details (name, status, conclusion, duration)downloaded_files: List of artifact files with descriptionsmissing_tools: Tools requested but not availablemcp_failures: MCP server failureserrors: Error details with file, line, type, and messagewarnings: Warning detailstool_usage: Tool usage statisticsfirewall_analysis: Network firewall analysis if available
mcp-inspect
Section titled “mcp-inspect”Inspect MCP servers in workflows and list available tools, resources, and roots.
Parameters:
workflow_file(optional): Workflow file to inspect (empty to list all workflows with MCP servers)server(optional): Filter to specific MCP servertool(optional): Show detailed information about a specific tool (requires server parameter)
Returns: Formatted text output showing:
- Available MCP servers in the workflow
- Tools, resources, and roots exposed by each server
- Secret availability status (if GitHub token available)
- Detailed tool information when tool parameter specified
Add workflows from remote repositories to .github/workflows.
Parameters:
workflows(required): Array of workflow specifications- Format:
owner/repo/workflow-nameorowner/repo/workflow-name@version
- Format:
number(optional): Create multiple numbered copiesname(optional): Specify name for added workflow (without .md extension)
Returns: Formatted text output showing added workflows.
update
Section titled “update”Update workflows from their source repositories and check for gh-aw updates.
Parameters:
workflows(optional): Array of workflow IDs to update (empty for all)major(optional): Allow major version updates when updating tagged releasesforce(optional): Force update even if no changes detected
Returns: Formatted text output showing:
- Extension update status
- Updated workflows with new versions
- Compilation status for each workflow
Apply automatic codemod-style fixes to workflow files.
Parameters:
workflows(optional): Array of workflow IDs to fix (empty for all)write(optional): Write changes to files (default is dry-run)list_codemods(optional): List all available codemods and exit
Available Codemods:
timeout-minutes-migration: Replacestimeout_minuteswithtimeout-minutesnetwork-firewall-migration: Removes deprecatednetwork.firewallfieldsandbox-agent-false-removal: Removessandbox.agent: false(firewall now mandatory)mcp-scripts-mode-removal: Removes deprecatedmcp-scripts.modefield
Returns: Formatted text output showing:
- List of workflow files processed
- Which codemods were applied to each file
- Summary of fixes applied
Using GH-AW as an MCP from an Agentic Workflow
Section titled “Using GH-AW as an MCP from an Agentic Workflow”It is possible to use the GH-AW MCP server from within an agentic workflow to enable self-management capabilities. For example, you can allow an agent to check the status of workflows, compile changes, or download logs for analysis.
Enable in workflow frontmatter:
---permissions: actions: read # Required for agentic-workflows tooltools: agentic-workflows:---
Check workflow status, download logs, and audit failures.