GitHub Operations Skill
Learn how to work with GitHub via MCP tools for the Drift project.
Before using any GitHub MCP tools, determine the actual repository owner and name from git:
bash
1git remote get-url origin
Parse the output to extract owner and repository name:
Example outputs:
https://github.com/jarosser06/drift.git → owner: jarosser06, repo: drift
git@github.com:jarosser06/drift.git → owner: jarosser06, repo: drift
Check git first before any GitHub operations to get accurate repository information.
Issue Operations
Get issue details:
python
1mcp__github__get_issue(
2 owner="jarosser06",
3 repo="drift",
4 issue_number=42
5)
Returns full issue details including title, body, labels, assignees, state, comments.
List issues with filters:
python
1mcp__github__list_issues(
2 owner="jarosser06",
3 repo="drift",
4 state="open", # open, closed, all
5 assignee="username", # filter by assignee
6 labels=["bug"], # filter by labels
7 sort="created", # created, updated, comments
8 direction="desc" # asc or desc
9)
Create new issue:
python
1mcp__github__create_issue(
2 owner="jarosser06",
3 repo="drift",
4 title="Add support for custom validators",
5 body="## Problem\nUsers need to define custom validators...",
6 labels=["enhancement"],
7 assignees=["username"]
8)
Update existing issue:
python
1mcp__github__update_issue(
2 owner="jarosser06",
3 repo="drift",
4 issue_number=42,
5 title="Updated title",
6 body="Updated description",
7 state="closed", # open or closed
8 labels=["bug", "priority:high"],
9 assignees=["username"]
10)
Add comment to issue:
python
1mcp__github__add_issue_comment(
2 owner="jarosser06",
3 repo="drift",
4 issue_number=42,
5 body="Fixed in PR #50"
6)
Pull Request Operations
Create pull request:
python
1mcp__github__create_pull_request(
2 owner="jarosser06",
3 repo="drift",
4 title="Issue #42: Add custom validator support",
5 head="issue-42-custom-validators", # branch with changes
6 base="main", # target branch
7 body="## Summary\n- Adds CustomValidator class\n- Updates config schema",
8 draft=False
9)
Get PR details:
python
1mcp__github__get_pull_request(
2 owner="jarosser06",
3 repo="drift",
4 pull_number=50
5)
Returns PR metadata, description, status, review state, mergability.
List pull requests:
python
1mcp__github__list_pull_requests(
2 owner="jarosser06",
3 repo="drift",
4 state="open", # open, closed, all
5 head="user:branch-name", # filter by source branch
6 base="main", # filter by target branch
7 sort="created", # created, updated, popularity, long-running
8 direction="desc" # asc or desc
9)
Review pull request:
python
1mcp__github__create_pull_request_review(
2 owner="jarosser06",
3 repo="drift",
4 pull_number=50,
5 body="Overall looks good. Please address inline comments.",
6 event="REQUEST_CHANGES", # APPROVE, REQUEST_CHANGES, COMMENT
7 comments=[{
8 "path": "src/drift/validators.py",
9 "line": 45,
10 "body": "Add type hint for return value"
11 }, {
12 "path": "tests/test_validators.py",
13 "line": 23,
14 "body": "Add test for edge case with empty input"
15 }]
16)
Merge pull request:
python
1mcp__github__merge_pull_request(
2 owner="jarosser06",
3 repo="drift",
4 pull_number=50,
5 merge_method="squash", # merge, squash, rebase
6 commit_title="Add custom validator support",
7 commit_message="Implements CustomValidator class with config schema updates"
8)
Get files changed in PR:
python
1mcp__github__get_pull_request_files(
2 owner="jarosser06",
3 repo="drift",
4 pull_number=50
5)
Returns list of files with additions, deletions, changes, patch data.
Get PR CI status:
python
1mcp__github__get_pull_request_status(
2 owner="jarosser06",
3 repo="drift",
4 pull_number=50
5)
Returns combined status of all CI checks (tests, linting, etc.).
Branch Operations
Create new branch:
python
1mcp__github__create_branch(
2 owner="jarosser06",
3 repo="drift",
4 branch="issue-42-custom-validators",
5 from_branch="main" # optional, defaults to default branch
6)
Creates branch on GitHub. You'll still need to fetch and checkout locally:
bash
1git fetch origin
2git checkout issue-42-custom-validators
Repository Operations
Get file contents:
python
1mcp__github__get_file_contents(
2 owner="jarosser06",
3 repo="drift",
4 path="src/drift/config.py",
5 branch="main" # optional, defaults to default branch
6)
Returns file content, SHA, and metadata.
Create or update single file:
python
1mcp__github__create_or_update_file(
2 owner="jarosser06",
3 repo="drift",
4 path="src/drift/new_module.py",
5 content="# New module\n\ndef new_function():\n pass",
6 message="Add new module for custom validators",
7 branch="issue-42-custom-validators",
8 sha="abc123..." # required for updates, get from get_file_contents
9)
Push multiple files in single commit:
python
1mcp__github__push_files(
2 owner="jarosser06",
3 repo="drift",
4 branch="issue-42-custom-validators",
5 files=[
6 {
7 "path": "src/drift/validators.py",
8 "content": "# Updated validator code..."
9 },
10 {
11 "path": "tests/test_validators.py",
12 "content": "# New tests..."
13 }
14 ],
15 message="Add custom validator with tests"
16)
Use this for multi-file changes in a single commit.
Search Operations
Search repositories:
python
1mcp__github__search_repositories(
2 query="drift language:python stars:>10",
3 page=1,
4 perPage=30
5)
Search code across GitHub:
python
1mcp__github__search_code(
2 q="parse_conversation language:python",
3 per_page=30,
4 page=1
5)
Search issues and PRs:
python
1mcp__github__search_issues(
2 q="is:open label:bug repo:jarosser06/drift",
3 sort="created",
4 order="desc"
5)
Search syntax supports many filters: is:issue, is:pr, label:bug, author:username, etc.
How to Follow Git Workflows
See Git Workflows for detailed guides on:
- Standard development workflow (5 steps)
- Assigning issues to yourself
- Closing issues with comments
- Requesting PR changes
- Approving and merging PRs
How to Organize with Labels
Common Label Patterns
Issue type labels:
bug - Something isn't working correctly
enhancement - New feature or improvement request
documentation - Documentation improvements or fixes
refactoring - Code restructuring without behavior change
Priority labels:
priority:high - Needs immediate attention
priority:medium - Important but not urgent
priority:low - Nice to have, can wait
Status labels:
good first issue - Good for newcomers to the project
help wanted - Extra attention needed
in progress - Currently being worked on
blocked - Blocked by dependencies or decisions
How to Apply Labels
When creating issue:
python
1mcp__github__create_issue(
2 owner="jarosser06",
3 repo="drift",
4 title="Add support for custom validators",
5 body="...",
6 labels=["enhancement", "priority:high"]
7)
Update labels on existing issue:
python
1mcp__github__update_issue(
2 owner="jarosser06",
3 repo="drift",
4 issue_number=42,
5 labels=["enhancement", "priority:high", "in progress"]
6)
Filter issues by labels:
python
1mcp__github__list_issues(
2 owner="jarosser06",
3 repo="drift",
4 state="open",
5 labels=["bug", "priority:high"]
6)
How to Search by Labels
Use GitHub search syntax:
python
1mcp__github__search_issues(
2 q="is:open label:bug label:priority:high repo:jarosser06/drift",
3 sort="created",
4 order="desc"
5)
Supports complex queries:
is:issue or is:pr - Filter by type
label:bug - Has label
no:label - No labels
author:username - Created by user
assignee:username - Assigned to user
is:open or is:closed - Filter by state
Example Workflows
See Workflows for common GitHub workflows:
- Working on new feature (end-to-end)
- Reviewing PR
- Bulk issue management
Resources
Common GitHub workflows using MCP tools.
Use when: Need examples for standard GitHub operations via MCP.
Standard git development workflows with MCP integration.
Use when: Following standard development workflow or managing PRs and issues.