GitHub Operations Skill
Full GitHub MCP Server parity using the gh CLI. This skill provides all the functionality of the official GitHub MCP Server without the token overhead.
Requirements: gh CLI installed and authenticated (gh auth login).
Quick Reference
| Domain | Script | Key Operations |
|---|
| Repositories | repos.sh | view, clone, fork, list, create, delete, contents |
| Issues | issues.sh | list, view, create, close, reopen, comment, labels |
| Pull Requests | prs.sh | list, view, create, merge, diff, checks, review |
| Actions | actions.sh | runs, jobs, logs, artifacts, workflows, rerun |
| Releases | releases.sh | list, view, create, delete, download assets |
| Code Security | code-security.sh | code scanning alerts, dependabot alerts |
| Discussions | discussions.sh | list, view, comments, categories |
| Notifications | notifications.sh | list, mark read, subscription |
| Search | search.sh | repos, code, issues, PRs, users, commits |
| Users | users.sh | profile, followers, following, emails |
| Organizations | orgs.sh | info, members, teams, repos |
| Gists | gists.sh | list, view, create, edit, delete |
| Projects | projects.sh | list, view, items, fields (v2) |
How to Use
Method 1: Direct Script Execution
Run scripts directly from the skill directory:
bash
1cd {base_directory}
2
3# Repository operations
4bash scripts/repos.sh view --owner facebook --repo react
5bash scripts/repos.sh contents --owner vercel --repo next.js --path packages
6
7# Issue operations
8bash scripts/issues.sh list --owner cli --repo cli --state open --limit 10
9bash scripts/issues.sh view --owner cli --repo cli --number 123
10
11# Pull request operations
12bash scripts/prs.sh list --owner facebook --repo react --state open
13bash scripts/prs.sh diff --owner cli --repo cli --number 456
14
15# And so on for each domain...
Method 2: Router Script
Use the router for unified access:
bash
1cd {base_directory}
2bash scripts/router.sh repos view --owner facebook --repo react
3bash scripts/router.sh issues list --owner cli --repo cli --state open
4bash scripts/router.sh search repos --query "language:go stars:>10000"
Command-first responses
When the user asks for commands or "exact gh commands", respond with the command(s) first (gh or scripts), then brief notes if needed. Avoid prose-only answers for command requests.
If the user asks to list pull requests or to show the exact commands, always include a literal gh command line in the response.
If owner/repo is missing, still provide the exact gh command with OWNER/REPO placeholders, then ask the user to confirm the repo.
Script Reference
Each script follows a consistent pattern:
bash
1bash scripts/<domain>.sh <action> [options]
Common Options
| Option | Description | Example |
|---|
--owner | Repository owner | --owner facebook |
--repo | Repository name | --repo react |
--number | Issue/PR number | --number 123 |
--limit | Max results | --limit 10 |
--state | Filter by state | --state open |
--json | JSON output | --json |
Safety Rules
Destructive operations require confirmation:
- Creating resources (issues, PRs, releases)
- Modifying state (close, merge, delete)
- Force operations
The scripts will prompt for confirmation before executing destructive actions.
Available Scripts
repos.sh - Repository Operations
bash
1# View repository info
2bash scripts/repos.sh view --owner OWNER --repo REPO
3
4# Get file contents
5bash scripts/repos.sh contents --owner OWNER --repo REPO --path PATH
6
7# List directory
8bash scripts/repos.sh contents --owner OWNER --repo REPO --path PATH --type dir
9
10# Clone repository
11bash scripts/repos.sh clone --owner OWNER --repo REPO [--dir TARGET]
12
13# Fork repository
14bash scripts/repos.sh fork --owner OWNER --repo REPO
15
16# List user's repos
17bash scripts/repos.sh list [--type owner|member|all] [--limit N]
18
19# Create repository (requires confirmation)
20bash scripts/repos.sh create --name NAME [--description DESC] [--private]
21
22# List commits
23bash scripts/repos.sh commits --owner OWNER --repo REPO [--limit N]
24
25# List branches
26bash scripts/repos.sh branches --owner OWNER --repo REPO
27
28# List tags
29bash scripts/repos.sh tags --owner OWNER --repo REPO
30
31# Get default branch
32bash scripts/repos.sh default-branch --owner OWNER --repo REPO
issues.sh - Issue Operations
bash
1# List issues
2bash scripts/issues.sh list --owner OWNER --repo REPO [--state open|closed|all] [--label LABEL] [--limit N]
3
4# View issue
5bash scripts/issues.sh view --owner OWNER --repo REPO --number NUMBER [--comments]
6
7# Create issue (requires confirmation)
8bash scripts/issues.sh create --owner OWNER --repo REPO --title TITLE [--body BODY] [--labels L1,L2]
9
10# Close issue (requires confirmation)
11bash scripts/issues.sh close --owner OWNER --repo REPO --number NUMBER
12
13# Reopen issue
14bash scripts/issues.sh reopen --owner OWNER --repo REPO --number NUMBER
15
16# Add comment
17bash scripts/issues.sh comment --owner OWNER --repo REPO --number NUMBER --body BODY
18
19# Update issue
20bash scripts/issues.sh update --owner OWNER --repo REPO --number NUMBER [--title T] [--body B]
21
22# List issue comments
23bash scripts/issues.sh comments --owner OWNER --repo REPO --number NUMBER
24
25# Add labels
26bash scripts/issues.sh add-labels --owner OWNER --repo REPO --number NUMBER --labels L1,L2
27
28# Remove labels
29bash scripts/issues.sh remove-labels --owner OWNER --repo REPO --number NUMBER --labels L1,L2
bash
1# List PRs
2bash scripts/prs.sh list --owner OWNER --repo REPO [--state open|closed|merged|all] [--limit N]
3
4# View PR
5bash scripts/prs.sh view --owner OWNER --repo REPO --number NUMBER [--comments]
6
7# View PR diff
8bash scripts/prs.sh diff --owner OWNER --repo REPO --number NUMBER
9
10# View PR files
11bash scripts/prs.sh files --owner OWNER --repo REPO --number NUMBER
12
13# Check PR status
14bash scripts/prs.sh checks --owner OWNER --repo REPO --number NUMBER
15
16# Create PR (requires confirmation)
17bash scripts/prs.sh create --owner OWNER --repo REPO --title TITLE --head BRANCH [--base main] [--body BODY]
18
19# Merge PR (requires confirmation)
20bash scripts/prs.sh merge --owner OWNER --repo REPO --number NUMBER [--method merge|squash|rebase]
21
22# Close PR
23bash scripts/prs.sh close --owner OWNER --repo REPO --number NUMBER
24
25# Add review
26bash scripts/prs.sh review --owner OWNER --repo REPO --number NUMBER --event approve|comment|request_changes [--body BODY]
27
28# List reviews
29bash scripts/prs.sh reviews --owner OWNER --repo REPO --number NUMBER
30
31# Get merge status
32bash scripts/prs.sh merge-status --owner OWNER --repo REPO --number NUMBER
actions.sh - GitHub Actions
bash
1# List workflow runs
2bash scripts/actions.sh runs --owner OWNER --repo REPO [--workflow FILE] [--status STATUS] [--limit N]
3
4# View run details
5bash scripts/actions.sh run --owner OWNER --repo REPO --run-id ID
6
7# List jobs in a run
8bash scripts/actions.sh jobs --owner OWNER --repo REPO --run-id ID
9
10# Get job logs
11bash scripts/actions.sh logs --owner OWNER --repo REPO --run-id ID [--job-id JOB_ID] [--failed-only]
12
13# List artifacts
14bash scripts/actions.sh artifacts --owner OWNER --repo REPO --run-id ID
15
16# Download artifact
17bash scripts/actions.sh download-artifact --owner OWNER --repo REPO --artifact-id ID
18
19# List workflows
20bash scripts/actions.sh workflows --owner OWNER --repo REPO
21
22# Rerun workflow (requires confirmation)
23bash scripts/actions.sh rerun --owner OWNER --repo REPO --run-id ID
24
25# Rerun failed jobs (requires confirmation)
26bash scripts/actions.sh rerun-failed --owner OWNER --repo REPO --run-id ID
27
28# Cancel run (requires confirmation)
29bash scripts/actions.sh cancel --owner OWNER --repo REPO --run-id ID
30
31# Trigger workflow (requires confirmation)
32bash scripts/actions.sh dispatch --owner OWNER --repo REPO --workflow FILE [--ref BRANCH] [--inputs JSON]
releases.sh - Release Operations
bash
1# List releases
2bash scripts/releases.sh list --owner OWNER --repo REPO [--limit N]
3
4# View release
5bash scripts/releases.sh view --owner OWNER --repo REPO [--tag TAG]
6
7# View latest release
8bash scripts/releases.sh latest --owner OWNER --repo REPO
9
10# Download release assets
11bash scripts/releases.sh download --owner OWNER --repo REPO --tag TAG [--pattern GLOB]
12
13# Create release (requires confirmation)
14bash scripts/releases.sh create --owner OWNER --repo REPO --tag TAG [--title TITLE] [--notes NOTES] [--draft] [--prerelease]
15
16# Delete release (requires confirmation)
17bash scripts/releases.sh delete --owner OWNER --repo REPO --tag TAG
18
19# Upload asset (requires confirmation)
20bash scripts/releases.sh upload --owner OWNER --repo REPO --tag TAG --file FILE
code-security.sh - Code Security
bash
1# List code scanning alerts
2bash scripts/code-security.sh code-alerts --owner OWNER --repo REPO [--state open|closed|all] [--severity LEVEL]
3
4# View code scanning alert
5bash scripts/code-security.sh code-alert --owner OWNER --repo REPO --number NUMBER
6
7# List Dependabot alerts
8bash scripts/code-security.sh dependabot-alerts --owner OWNER --repo REPO [--state open|closed|all] [--severity LEVEL]
9
10# View Dependabot alert
11bash scripts/code-security.sh dependabot-alert --owner OWNER --repo REPO --number NUMBER
12
13# List secret scanning alerts
14bash scripts/code-security.sh secret-alerts --owner OWNER --repo REPO [--state open|resolved]
15
16# View secret scanning alert
17bash scripts/code-security.sh secret-alert --owner OWNER --repo REPO --number NUMBER
discussions.sh - Discussions
bash
1# List discussions
2bash scripts/discussions.sh list --owner OWNER --repo REPO [--category CATEGORY] [--limit N]
3
4# View discussion
5bash scripts/discussions.sh view --owner OWNER --repo REPO --number NUMBER
6
7# List discussion comments
8bash scripts/discussions.sh comments --owner OWNER --repo REPO --number NUMBER
9
10# List discussion categories
11bash scripts/discussions.sh categories --owner OWNER --repo REPO
12
13# Create discussion (requires confirmation)
14bash scripts/discussions.sh create --owner OWNER --repo REPO --title TITLE --body BODY --category SLUG
notifications.sh - Notifications
bash
1# List notifications
2bash scripts/notifications.sh list [--all] [--participating] [--limit N]
3
4# Mark as read
5bash scripts/notifications.sh mark-read [--thread-id ID]
6
7# Get thread
8bash scripts/notifications.sh thread --id ID
9
10# Subscribe/unsubscribe
11bash scripts/notifications.sh subscribe --owner OWNER --repo REPO
12bash scripts/notifications.sh unsubscribe --owner OWNER --repo REPO
search.sh - Search Operations
bash
1# Search repositories
2bash scripts/search.sh repos --query QUERY [--limit N] [--sort stars|forks|updated]
3
4# Search code
5bash scripts/search.sh code --query QUERY [--limit N]
6
7# Search issues
8bash scripts/search.sh issues --query QUERY [--limit N]
9
10# Search PRs
11bash scripts/search.sh prs --query QUERY [--limit N]
12
13# Search users
14bash scripts/search.sh users --query QUERY [--limit N]
15
16# Search commits
17bash scripts/search.sh commits --query QUERY [--limit N]
bash
1# Get current user
2bash scripts/users.sh me
3
4# Get user profile
5bash scripts/users.sh profile --username USERNAME
6
7# List followers
8bash scripts/users.sh followers [--username USERNAME] [--limit N]
9
10# List following
11bash scripts/users.sh following [--username USERNAME] [--limit N]
12
13# List user's repos
14bash scripts/users.sh repos --username USERNAME [--limit N]
15
16# List user's gists
17bash scripts/users.sh gists --username USERNAME [--limit N]
18
19# Get user emails (authenticated user only)
20bash scripts/users.sh emails
orgs.sh - Organization Operations
bash
1# View organization
2bash scripts/orgs.sh view --org ORG
3
4# List members
5bash scripts/orgs.sh members --org ORG [--role admin|member|all] [--limit N]
6
7# List teams
8bash scripts/orgs.sh teams --org ORG [--limit N]
9
10# View team
11bash scripts/orgs.sh team --org ORG --team TEAM_SLUG
12
13# List team members
14bash scripts/orgs.sh team-members --org ORG --team TEAM_SLUG [--limit N]
15
16# List org repos
17bash scripts/orgs.sh repos --org ORG [--type all|public|private] [--limit N]
gists.sh - Gist Operations
bash
1# List gists
2bash scripts/gists.sh list [--public] [--secret] [--limit N]
3
4# View gist
5bash scripts/gists.sh view --id ID
6
7# Create gist (requires confirmation)
8bash scripts/gists.sh create --filename FILE --content CONTENT [--description DESC] [--public]
9
10# Edit gist (requires confirmation)
11bash scripts/gists.sh edit --id ID --filename FILE --content CONTENT
12
13# Delete gist (requires confirmation)
14bash scripts/gists.sh delete --id ID
15
16# Fork gist
17bash scripts/gists.sh fork --id ID
projects.sh - Projects v2
bash
1# List projects
2bash scripts/projects.sh list --owner OWNER [--limit N]
3
4# View project
5bash scripts/projects.sh view --owner OWNER --number NUMBER
6
7# List project items
8bash scripts/projects.sh items --owner OWNER --number NUMBER [--limit N]
9
10# List project fields
11bash scripts/projects.sh fields --owner OWNER --number NUMBER
Error Handling
All scripts follow these error handling rules:
- Max 2 attempts per operation before failing
- Clear error messages with suggestions
- Exit codes: 0 = success, 1 = error, 2 = user cancelled
Authentication
bash
1# Check auth status
2gh auth status
3
4# Login
5gh auth login
6
7# Refresh with additional scopes
8gh auth refresh -s repo -s workflow -s read:org
Configuration
Edit config/toolsets.json to enable/disable feature groups:
json
1{
2 "enabled": ["repos", "issues", "prs", "actions", "users"],
3 "disabled": ["projects", "gists"]
4}
MCP Parity: This skill provides equivalent functionality to all GitHub MCP Server toolsets.