Skip to content
GitHub Agentic Workflows

Getting Started with MCP

This guide walks you through integrating Model Context Protocol (MCP) servers with GitHub Agentic Workflows, from your first configuration to advanced patterns.

Model Context Protocol (MCP) is a standardized protocol that enables agents to connect to external tools, databases, and APIs. MCP servers act as specialized adapters, giving agents access to GitHub, web search, databases, and third-party services like Notion, Slack, and Datadog.

Get your first MCP integration running in under 5 minutes.

Create a workflow file at .github/workflows/my-workflow.md:

---
on:
issues:
types: [opened]
permissions:
contents: read
issues: read
tools:
github:
toolsets: [default]
---
# Issue Analysis Agent
Analyze the issue and provide a summary of similar existing issues.

The toolsets: [default] configuration gives your agentic workflow access to repository, issue, and pull request tools.

Compile the workflow to generate the GitHub Actions YAML:

Terminal window
gh aw compile my-workflow

Verify the MCP configuration:

Terminal window
gh aw mcp inspect my-workflow

You now have a working MCP integration. The agent can read issues, search repositories, and access pull request information.

Use toolsets: to enable groups of related GitHub tools:

tools:
github:
toolsets: [default] # Expands to: context, repos, issues, pull_requests (action-friendly)

Toolsets remain stable across MCP server versions, while individual tool names may change.

Common toolset combinations:

Use CaseToolsets
General workflows[default]
Issue/PR management[default, discussions]
CI/CD workflows[default, actions]
Security scanning[default, code_security]
Full access[all]

Use allowed: when configuring custom (non-GitHub) MCP servers:

mcp-servers:
notion:
container: "mcp/notion"
allowed: ["search_pages", "get_page"]

The GitHub MCP server is built into agentic workflows and provides comprehensive access to GitHub’s API.

ToolsetDescriptionTools
contextUser and team informationget_teams, get_team_members
reposRepository operationsget_repository, get_file_contents, list_commits
issuesIssue managementlist_issues, create_issue, update_issue
pull_requestsPR operationslist_pull_requests, create_pull_request
actionsWorkflow runs and artifactslist_workflows, list_workflow_runs
discussionsGitHub Discussionslist_discussions, create_discussion
code_securitySecurity alertslist_code_scanning_alerts
usersUser profilesget_me, get_user, list_users

The default toolset includes: context, repos, issues, pull_requests. When used in workflows, [default] expands to action-friendly toolsets that work with GitHub Actions tokens. Note: The users toolset is not included by default.

GitHub MCP supports two modes. Choose based on your requirements:

Remote Mode (Recommended):

tools:
github:
mode: remote
toolsets: [default]

Remote mode connects to the hosted GitHub MCP server with faster startup and no Docker requirement.

Local Mode (Docker-based):

tools:
github:
mode: local
toolsets: [default]
version: "sha-09deac4"

Local mode runs the MCP server in a Docker container, useful for pinning specific versions or offline environments.

Tokens are used in order: github-token configuration field, GH_AW_GITHUB_TOKEN secret, then GITHUB_TOKEN (default).

tools:
github:
github-token: "${{ secrets.CUSTOM_PAT }}" # Optional custom token
toolsets: [default]

Restrict operations to read-only for security-sensitive workflows:

tools:
github:
read-only: true
toolsets: [repos, issues]

The GitHub MCP registry provides a centralized catalog of MCP servers.

Terminal window
# Browse available MCP servers
gh aw mcp add
# Add a specific server
gh aw mcp add my-workflow makenotion/notion-mcp-server
# Add with custom tool ID
gh aw mcp add my-workflow makenotion/notion-mcp-server --tool-id my-notion

The command searches the registry, adds the server configuration, and recompiles the workflow.

Reference registry servers directly in your workflow:

mcp-servers:
markitdown:
registry: https://api.mcp.github.com/v0/servers/microsoft/markitdown
container: "ghcr.io/microsoft/markitdown"
allowed: ["*"]

The registry field provides metadata for tooling while the container or command fields specify how to run the server.

For enterprise or private registries:

Terminal window
gh aw mcp add my-workflow server-name --registry https://custom.registry.com/v1

Configure third-party MCP servers using commands, Docker containers, or HTTP endpoints:

mcp-servers:
# Command-based (stdio)
markitdown:
command: "npx"
args: ["-y", "markitdown-mcp"]
allowed: ["*"]
# Docker container
ast-grep:
container: "mcp/ast-grep:latest"
allowed: ["*"]
# HTTP endpoint with auth
slack:
url: "https://api.slack.com/mcp"
env:
SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}"
network:
allowed: ["api.slack.com"] # Optional egress restrictions
allowed: ["send_message", "get_channel_history"]
---
on:
issues:
types: [opened]
permissions:
contents: read
issues: read
tools:
github:
toolsets: [default]
safe-outputs:
add-comment:
---
# Issue Triage Agent
Analyze issue #${{ github.event.issue.number }} and add a comment with category, related issues, and suggested labels.
---
on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: read
actions: read
tools:
github:
toolsets: [default, actions]
safe-outputs:
add-comment:
---
# PR Review Agent
Review PR #${{ github.event.pull_request.number }}, check workflow runs, analyze code changes, and provide feedback.
---
on: weekly on sunday
permissions:
contents: read
security-events: read
discussions: write
tools:
github:
toolsets: [default, code_security, discussions]
safe-outputs:
create-discussion:
category: "Security"
title-prefix: "[security-scan] "
---
# Security Audit Agent
Review code scanning alerts and create weekly security discussions with findings.

Inspect configured servers and available tools:

Terminal window
# View all MCP servers
gh aw mcp inspect my-workflow
# Get detailed server information
gh aw mcp inspect my-workflow --server github --verbose
# List available tools
gh aw mcp list-tools github my-workflow
# Validate configuration
gh aw compile my-workflow --validate --strict

Tool not found: Run gh aw mcp inspect my-workflow to verify available tools. Ensure the correct toolset is enabled or that tool names in allowed: match exactly.

Authentication errors: Verify the secret exists in repository settings and has required scopes. For remote mode, set GH_AW_GITHUB_TOKEN with a PAT.

Connection failures: Check URL syntax for HTTP servers, network configuration for containers, and verify Docker images exist.

Validation errors: Check YAML syntax, ensure toolsets: uses array format ([default] not default), and verify allowed: is an array.

Continue learning with these resources:

Explore shared MCP configurations in .github/workflows/shared/mcp/ for ready-to-use integrations with popular services.