- Notifications
You must be signed in to change notification settings - Fork899
GitHub's official MCP Server
License
github/github-mcp-server
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The GitHub MCP Server is aModel Context Protocol (MCP)server that provides seamless integration with GitHub APIs, enabling advancedautomation and interaction capabilities for developers and tools.
- Automating GitHub workflows and processes.
- Extracting and analyzing data from GitHub repositories.
- Building AI powered tools and applications that interact with GitHub's ecosystem.
- To run the server in a container, you will need to haveDocker installed.
- Once Docker is installed, you will also need to ensure Docker is running. The image is public; if you get errors on pull, you may have an expired token and need to
docker logout ghcr.io
. - Lastly you will need toCreate a GitHub Personal Access Token.The MCP server can use many of the GitHub APIs, so enable the permissions that you feel comfortable granting your AI tools (to learn more about access tokens, please check out thedocumentation).
For quick installation, use one of the one-click install buttons at the top of this README. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressingCtrl + Shift + P
and typingPreferences: Open User Settings (JSON)
.
{"mcp": {"inputs": [ {"type":"promptString","id":"github_token","description":"GitHub Personal Access Token","password":true } ],"servers": {"github": {"command":"docker","args": ["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server" ],"env": {"GITHUB_PERSONAL_ACCESS_TOKEN":"${input:github_token}" } } } }}
Optionally, you can add a similar example (i.e. without the mcp key) to a file called.vscode/mcp.json
in your workspace. This will allow you to share the configuration with others.
{"inputs": [ {"type":"promptString","id":"github_token","description":"GitHub Personal Access Token","password":true } ],"servers": {"github": {"command":"docker","args": ["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server" ],"env": {"GITHUB_PERSONAL_ACCESS_TOKEN":"${input:github_token}" } } }}
More about using MCP server tools in VS Code'sagent mode documentation.
{"mcpServers": {"github": {"command":"docker","args": ["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server" ],"env": {"GITHUB_PERSONAL_ACCESS_TOKEN":"<YOUR_TOKEN>" } } }}
If you don't have Docker, you can usego build
to build the binary in thecmd/github-mcp-server
directory, and use thegithub-mcp-server stdio
command with theGITHUB_PERSONAL_ACCESS_TOKEN
environment variable set to your token. To specify the output location of the build, use the-o
flag. You should configure your server to use the built executable as itscommand
. For example:
{"mcp": {"servers": {"github": {"command":"/path/to/github-mcp-server","args": ["stdio"],"env": {"GITHUB_PERSONAL_ACCESS_TOKEN":"<YOUR_TOKEN>" } } } }}
The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the--toolsets
flag. This allows you to control which GitHub API capabilities are available to your AI tools. Enabling only the toolsets that you need can help the LLM with tool choice and reduce the context size.
The following sets of tools are available (all are on by default):
Toolset | Description |
---|---|
repos | Repository-related tools (file operations, branches, commits) |
issues | Issue-related tools (create, read, update, comment) |
users | Anything relating to GitHub Users |
pull_requests | Pull request operations (create, merge, review) |
code_security | Code scanning alerts and security features |
experiments | Experimental features (not considered stable) |
To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:
Using Command Line Argument:
github-mcp-server --toolsets repos,issues,pull_requests,code_security
Using Environment Variable:
GITHUB_TOOLSETS="repos,issues,pull_requests,code_security" ./github-mcp-server
The environment variableGITHUB_TOOLSETS
takes precedence over the command line argument if both are provided.
When using Docker, you can pass the toolsets as environment variables:
docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \ -e GITHUB_TOOLSETS="repos,issues,pull_requests,code_security,experiments" \ ghcr.io/github/github-mcp-server
The special toolsetall
can be provided to enable all available toolsets regardless of any other configuration:
./github-mcp-server --toolsets all
Or using the environment variable:
GITHUB_TOOLSETS="all" ./github-mcp-server
Note: This feature is currently in beta and may not be available in all environments. Please test it out and let us know if you encounter any issues.
Instead of starting with all tools enabled, you can turn on dynamic toolset discovery. Dynamic toolsets allow the MCP host to list and enable toolsets in response to a user prompt. This should help to avoid situations where the model gets confused by the sheer number of tools available.
When using the binary, you can pass the--dynamic-toolsets
flag.
./github-mcp-server --dynamic-toolsets
When using Docker, you can pass the toolsets as environment variables:
docker run -i --rm \ -e GITHUB_PERSONAL_ACCESS_TOKEN=<your-token> \ -e GITHUB_DYNAMIC_TOOLSETS=1 \ ghcr.io/github/github-mcp-server
The flag--gh-host
and the environment variableGITHUB_HOST
can be used to setthe GitHub Enterprise Server hostname.Prefix the hostname with thehttps://
URI scheme, as it otherwise defaults tohttp://
which GitHub Enterprise Server does not support.
"github": {"command":"docker","args": ["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","-e","GITHUB_HOST","ghcr.io/github/github-mcp-server" ],"env": {"GITHUB_PERSONAL_ACCESS_TOKEN":"${input:github_token}","GITHUB_HOST":"https://<your GHES domain name>" }}
The descriptions of the tools can be overridden by creating agithub-mcp-server-config.json
file in the same directory as the binary.
The file should contain a JSON object with the tool names as keys and the newdescriptions as values. For example:
{"TOOL_ADD_ISSUE_COMMENT_DESCRIPTION":"an alternative description","TOOL_CREATE_BRANCH_DESCRIPTION":"Create a new branch in a GitHub repository"}
You can create an export of the current translations by running the binary withthe--export-translations
flag.
This flag will preserve any translations/overrides you have made, while addingany new translations that have been added to the binary since the last time youexported.
./github-mcp-server --export-translationscat github-mcp-server-config.json
You can also use ENV vars to override the descriptions. The environmentvariable names are the same as the keys in the JSON file, prefixed withGITHUB_MCP_
and all uppercase.
For example, to override theTOOL_ADD_ISSUE_COMMENT_DESCRIPTION
tool, you canset the following environment variable:
export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"
- get_me - Get details of the authenticated user
- No parameters required
get_issue - Gets the contents of an issue within a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)issue_number
: Issue number (number, required)
get_issue_comments - Get comments for a GitHub issue
owner
: Repository owner (string, required)repo
: Repository name (string, required)issue_number
: Issue number (number, required)
create_issue - Create a new issue in a GitHub repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)title
: Issue title (string, required)body
: Issue body content (string, optional)assignees
: Usernames to assign to this issue (string[], optional)labels
: Labels to apply to this issue (string[], optional)
add_issue_comment - Add a comment to an issue
owner
: Repository owner (string, required)repo
: Repository name (string, required)issue_number
: Issue number (number, required)body
: Comment text (string, required)
list_issues - List and filter repository issues
owner
: Repository owner (string, required)repo
: Repository name (string, required)state
: Filter by state ('open', 'closed', 'all') (string, optional)labels
: Labels to filter by (string[], optional)sort
: Sort by ('created', 'updated', 'comments') (string, optional)direction
: Sort direction ('asc', 'desc') (string, optional)since
: Filter by date (ISO 8601 timestamp) (string, optional)page
: Page number (number, optional)perPage
: Results per page (number, optional)
update_issue - Update an existing issue in a GitHub repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)issue_number
: Issue number to update (number, required)title
: New title (string, optional)body
: New description (string, optional)state
: New state ('open' or 'closed') (string, optional)labels
: New labels (string[], optional)assignees
: New assignees (string[], optional)milestone
: New milestone number (number, optional)
search_issues - Search for issues and pull requests
query
: Search query (string, required)sort
: Sort field (string, optional)order
: Sort order (string, optional)page
: Page number (number, optional)perPage
: Results per page (number, optional)
get_pull_request - Get details of a specific pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)
list_pull_requests - List and filter repository pull requests
owner
: Repository owner (string, required)repo
: Repository name (string, required)state
: PR state (string, optional)sort
: Sort field (string, optional)direction
: Sort direction (string, optional)perPage
: Results per page (number, optional)page
: Page number (number, optional)
merge_pull_request - Merge a pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)commit_title
: Title for the merge commit (string, optional)commit_message
: Message for the merge commit (string, optional)merge_method
: Merge method (string, optional)
get_pull_request_files - Get the list of files changed in a pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)
get_pull_request_status - Get the combined status of all status checks for a pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)
update_pull_request_branch - Update a pull request branch with the latest changes from the base branch
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)expectedHeadSha
: The expected SHA of the pull request's HEAD ref (string, optional)
get_pull_request_comments - Get the review comments on a pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)
get_pull_request_reviews - Get the reviews on a pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)
create_pull_request_review - Create a review on a pull request review
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)body
: Review comment text (string, optional)event
: Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT') (string, required)commitId
: SHA of commit to review (string, optional)comments
: Line-specific comments array of objects to place comments on pull request changes (array, optional)- For inline comments: provide
path
,position
(orline
), andbody
- For multi-line comments: provide
path
,start_line
,line
, optionalside
/start_side
, andbody
- For inline comments: provide
create_pull_request - Create a new pull request
owner
: Repository owner (string, required)repo
: Repository name (string, required)title
: PR title (string, required)body
: PR description (string, optional)head
: Branch containing changes (string, required)base
: Branch to merge into (string, required)draft
: Create as draft PR (boolean, optional)maintainer_can_modify
: Allow maintainer edits (boolean, optional)
add_pull_request_review_comment - Add a review comment to a pull request or reply to an existing comment
owner
: Repository owner (string, required)repo
: Repository name (string, required)pull_number
: Pull request number (number, required)body
: The text of the review comment (string, required)commit_id
: The SHA of the commit to comment on (string, required unless using in_reply_to)path
: The relative path to the file that necessitates a comment (string, required unless using in_reply_to)line
: The line of the blob in the pull request diff that the comment applies to (number, optional)side
: The side of the diff to comment on (LEFT or RIGHT) (string, optional)start_line
: For multi-line comments, the first line of the range (number, optional)start_side
: For multi-line comments, the starting side of the diff (LEFT or RIGHT) (string, optional)subject_type
: The level at which the comment is targeted (line or file) (string, optional)in_reply_to
: The ID of the review comment to reply to (number, optional). When specified, only body is required and other parameters are ignored.
update_pull_request - Update an existing pull request in a GitHub repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number to update (number, required)title
: New title (string, optional)body
: New description (string, optional)state
: New state ('open' or 'closed') (string, optional)base
: New base branch name (string, optional)maintainer_can_modify
: Allow maintainer edits (boolean, optional)
request_copilot_review - Request a GitHub Copilot review for a pull request (experimental; subject to GitHub API support)
owner
: Repository owner (string, required)repo
: Repository name (string, required)pullNumber
: Pull request number (number, required)- Note: Currently, this tool will only work for github.com
create_or_update_file - Create or update a single file in a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)path
: File path (string, required)message
: Commit message (string, required)content
: File content (string, required)branch
: Branch name (string, optional)sha
: File SHA if updating (string, optional)
list_branches - List branches in a GitHub repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)page
: Page number (number, optional)perPage
: Results per page (number, optional)
push_files - Push multiple files in a single commit
owner
: Repository owner (string, required)repo
: Repository name (string, required)branch
: Branch to push to (string, required)files
: Files to push, each with path and content (array, required)message
: Commit message (string, required)
search_repositories - Search for GitHub repositories
query
: Search query (string, required)sort
: Sort field (string, optional)order
: Sort order (string, optional)page
: Page number (number, optional)perPage
: Results per page (number, optional)
create_repository - Create a new GitHub repository
name
: Repository name (string, required)description
: Repository description (string, optional)private
: Whether the repository is private (boolean, optional)autoInit
: Auto-initialize with README (boolean, optional)
get_file_contents - Get contents of a file or directory
owner
: Repository owner (string, required)repo
: Repository name (string, required)path
: File path (string, required)ref
: Git reference (string, optional)
fork_repository - Fork a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)organization
: Target organization name (string, optional)
create_branch - Create a new branch
owner
: Repository owner (string, required)repo
: Repository name (string, required)branch
: New branch name (string, required)sha
: SHA to create branch from (string, required)
list_commits - Get a list of commits of a branch in a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)sha
: Branch name, tag, or commit SHA (string, optional)path
: Only commits containing this file path (string, optional)page
: Page number (number, optional)perPage
: Results per page (number, optional)
get_commit - Get details for a commit from a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)sha
: Commit SHA, branch name, or tag name (string, required)page
: Page number, for files in the commit (number, optional)perPage
: Results per page, for files in the commit (number, optional)
search_code - Search for code across GitHub repositories
query
: Search query (string, required)sort
: Sort field (string, optional)order
: Sort order (string, optional)page
: Page number (number, optional)perPage
: Results per page (number, optional)
- search_users - Search for GitHub users
q
: Search query (string, required)sort
: Sort field (string, optional)order
: Sort order (string, optional)page
: Page number (number, optional)perPage
: Results per page (number, optional)
get_code_scanning_alert - Get a code scanning alert
owner
: Repository owner (string, required)repo
: Repository name (string, required)alertNumber
: Alert number (number, required)
list_code_scanning_alerts - List code scanning alerts for a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)ref
: Git reference (string, optional)state
: Alert state (string, optional)severity
: Alert severity (string, optional)tool_name
: The name of the tool used for code scanning (string, optional)
get_secret_scanning_alert - Get a secret scanning alert
owner
: Repository owner (string, required)repo
: Repository name (string, required)alertNumber
: Alert number (number, required)
list_secret_scanning_alerts - List secret scanning alerts for a repository
owner
: Repository owner (string, required)repo
: Repository name (string, required)state
: Alert state (string, optional)secret_type
: The secret types to be filtered for in a comma-separated list (string, optional)resolution
: The resolution status (string, optional)
Get Repository ContentRetrieves the content of a repository at a specific path.
- Template:
repo://{owner}/{repo}/contents{/path*}
- Parameters:
owner
: Repository owner (string, required)repo
: Repository name (string, required)path
: File or directory path (string, optional)
- Template:
Get Repository Content for a Specific BranchRetrieves the content of a repository at a specific path for a given branch.
- Template:
repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}
- Parameters:
owner
: Repository owner (string, required)repo
: Repository name (string, required)branch
: Branch name (string, required)path
: File or directory path (string, optional)
- Template:
Get Repository Content for a Specific CommitRetrieves the content of a repository at a specific path for a given commit.
- Template:
repo://{owner}/{repo}/sha/{sha}/contents{/path*}
- Parameters:
owner
: Repository owner (string, required)repo
: Repository name (string, required)sha
: Commit SHA (string, required)path
: File or directory path (string, optional)
- Template:
Get Repository Content for a Specific TagRetrieves the content of a repository at a specific path for a given tag.
- Template:
repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}
- Parameters:
owner
: Repository owner (string, required)repo
: Repository name (string, required)tag
: Tag name (string, required)path
: File or directory path (string, optional)
- Template:
Get Repository Content for a Specific Pull RequestRetrieves the content of a repository at a specific path for a given pull request.
- Template:
repo://{owner}/{repo}/refs/pull/{prNumber}/head/contents{/path*}
- Parameters:
owner
: Repository owner (string, required)repo
: Repository name (string, required)prNumber
: Pull request number (string, required)path
: File or directory path (string, optional)
- Template:
The exported Go API of this module should currently be considered unstable, and subject to breaking changes. In the future, we may offer stability; please file an issue if there is a use case where this would be valuable.
This project is licensed under the terms of the MIT open source license. Please refer toMIT for the full terms.
About
GitHub's official MCP Server
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.