@edjl/github-mcp
v1.0.8
Published
MCP server for GitHub operations using GitHub CLI
Readme
GitHub MCP Server
MCP server for GitHub operations using the GitHub CLI (gh).
Prerequisites
- GitHub CLI (
gh) installed and authenticated - Node.js 18+
Installing GitHub CLI
# macOS
brew install gh
# Ubuntu/Debian
sudo apt install gh
# Or download from https://cli.github.com/Authenticating
gh auth loginInstallation
npm install
npm run buildConfiguration
Add to your MCP client configuration:
{
"github-mcp": {
"command": "node",
"args": ["/path/to/github-mcp/build/index.js"]
}
}Available Tools
Repository Management
1. github_repos_list
List GitHub repositories. When no owner specified, lists ALL your accessible repos including organizations.
Parameters:
owner(optional): Repository owner (defaults to all accessible repos)visibility: "public", "private", or "all"type: "all", "owner", or "member"sort: "created", "updated", "pushed", "name", or "stargazers"limit: Maximum number of repositories per organizationarchived: Include archived repositoriestopic: Filter by topic
Example:
{
"owner": "facebook",
"visibility": "public",
"sort": "stargazers",
"limit": 10
}2. github_file_get
Get the content of a file from a GitHub repository.
Parameters:
repository: Repository in owner/repo formatpath: Path to the fileref(optional): Branch, tag, or commit SHAraw: Return raw content without metadata
Example:
{
"repository": "facebook/react",
"path": "README.md",
"ref": "main"
}3. github_branch_list
List branches in a repository.
Parameters:
repository: Repository in owner/repo formatprotected(optional): Show only protected branchessort: "name" or "updated"limit: Maximum number of branches
Example:
{
"repository": "nodejs/node",
"sort": "updated",
"limit": 20
}Pull Requests
4. github_pr_list
List pull requests from a repository or all your repositories.
Parameters:
repository(optional): Repository in owner/repo formatstate: "open", "closed", "merged", or "all"author(optional): Filter by authorassignee(optional): Filter by assigneelabel(optional): Filter by labelbase(optional): Filter by base branchsort: "created", "updated", or "comments"limit: Maximum number of PRs
Example:
{
"repository": "kubernetes/kubernetes",
"state": "open",
"limit": 20
}5. github_pr_details
Get detailed information about a specific pull request.
Parameters:
repository: Repository in owner/repo formatpr_number: Pull request numbershow_checks: Show status checks (default: true)show_reviews: Show review status (default: true)
Example:
{
"repository": "rust-lang/rust",
"pr_number": 12345
}6. github_pr_create
Create a new pull request.
Parameters:
repository: Repository in owner/repo formattitle: PR titlebody(optional): PR descriptionbase: Base branch (default: "main")head: Head branch (your feature branch)draft: Create as draft (default: false)assignees(optional): Array of usernameslabels(optional): Array of labelsreviewers(optional): Array of reviewers
Example:
{
"repository": "owner/repo",
"title": "Add new feature",
"body": "This PR adds...",
"base": "main",
"head": "feature-branch",
"draft": false,
"reviewers": ["user1", "user2"]
}7. github_pr_changes
Get the changes (diff) from a pull request.
Parameters:
repository: Repository in owner/repo formatpr_number: Pull request numberformat: "patch" (raw diff), "files" (list), or "stats" (summary)
Example:
{
"repository": "nodejs/node",
"pr_number": 12345,
"format": "files"
}8. github_pr_comments_get
Get comments from a pull request, including inline code comments.
Parameters:
repository: Repository in owner/repo formatpr_number: Pull request numbertype: "all", "review" (inline), or "issue" (general)
Example:
{
"repository": "microsoft/vscode",
"pr_number": 98765,
"type": "all"
}9. github_pr_suggest_change
Suggest a specific code change on a pull request.
Parameters:
repository: Repository in owner/repo formatpr_number: Pull request numberpath: File path where the change should be madeline: Starting line numberend_line(optional): End line for multi-line suggestionsoriginal_code: The original code to be replacedsuggested_code: The suggested replacementcomment(optional): Explanation for the change
Example:
{
"repository": "owner/repo",
"pr_number": 123,
"path": "src/index.js",
"line": 42,
"original_code": "let value = 42;",
"suggested_code": "const value = 42;",
"comment": "Use const for values that won't be reassigned"
}10. github_pr_approve
Approve, request changes, or comment on a pull request.
Parameters:
repository: Repository in owner/repo formatpr_number: Pull request numberbody(optional): Review commentevent: "APPROVE", "REQUEST_CHANGES", or "COMMENT" (default: "APPROVE")
Example:
{
"repository": "owner/repo",
"pr_number": 123,
"body": "Looks good to me! Great work on the implementation.",
"event": "APPROVE"
}Issues
11. github_issues_list
List issues from a repository or all your repositories.
Parameters:
repository(optional): Repository in owner/repo formatstate: "open", "closed", or "all"author(optional): Filter by authorassignee(optional): Filter by assigneelabel(optional): Filter by labelmilestone(optional): Filter by milestonesort: "created", "updated", or "comments"limit: Maximum number of issues
Example:
{
"state": "open",
"assignee": "@me",
"sort": "updated",
"limit": 30
}Usage Examples
List all your repositories (including organizations)
Use github_repos_list without any parameters to see ALL repositories you have access toFind and review open PRs
- List open PRs:
github_pr_listwith state: "open" - Get PR details:
github_pr_details - View changes:
github_pr_changes - Read comments:
github_pr_comments_get - Suggest changes:
github_pr_suggest_changewith specific code improvements - Approve PR:
github_pr_approvewith event: "APPROVE"
Create a new PR
Use github_pr_create with repository, title, head branch, and base branchTrack issues assigned to you
Use github_issues_list with assignee: "@me" and state: "open"Explore a repository
- List branches:
github_branch_list - Get README:
github_file_getwith path: "README.md" - View open PRs:
github_pr_list - Check issues:
github_issues_list
Troubleshooting
Authentication Issues
If you see authentication errors:
gh auth status # Check status
gh auth login # Re-authenticateRate Limiting
GitHub API has rate limits. Authenticated requests have higher limits.
Permissions
Ensure your GitHub token has appropriate permissions for the operations you want to perform.
