github
MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.
MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.
MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.
create_or_update_file
owner
(string): Repository owner (username or organization)repo
(string): Repository namepath
(string): Path where to create/update the filecontent
(string): Content of the filemessage
(string): Commit messagebranch
(string): Branch to create/update the file insha
(optional string): SHA of file being replaced (for updates)Returns: File content and commit details
push_files
owner
(string): Repository ownerrepo
(string): Repository namebranch
(string): Branch to push tofiles
(array): Files to push, each with path
and content
message
(string): Commit messageReturns: Updated branch reference
search_repositories
query
(string): Search querypage
(optional number): Page number for paginationperPage
(optional number): Results per page (max 100)Returns: Repository search results
create_repository
name
(string): Repository namedescription
(optional string): Repository descriptionprivate
(optional boolean): Whether repo should be privateautoInit
(optional boolean): Initialize with READMEReturns: Created repository details
get_file_contents
owner
(string): Repository ownerrepo
(string): Repository namepath
(string): Path to file/directorybranch
(optional string): Branch to get contents fromReturns: File/directory contents
create_issue
owner
(string): Repository ownerrepo
(string): Repository nametitle
(string): Issue titlebody
(optional string): Issue descriptionassignees
(optional string[]): Usernames to assignlabels
(optional string[]): Labels to addmilestone
(optional number): Milestone numberReturns: Created issue details
create_pull_request
owner
(string): Repository ownerrepo
(string): Repository nametitle
(string): PR titlebody
(optional string): PR descriptionhead
(string): Branch containing changesbase
(string): Branch to merge intodraft
(optional boolean): Create as draft PRmaintainer_can_modify
(optional boolean): Allow maintainer editsReturns: Created pull request details
fork_repository
owner
(string): Repository ownerrepo
(string): Repository nameorganization
(optional string): Organization to fork toReturns: Forked repository details
create_branch
owner
(string): Repository ownerrepo
(string): Repository namebranch
(string): Name for new branchfrom_branch
(optional string): Source branch (defaults to repo default)Returns: Created branch reference
list_issues
owner
(string): Repository ownerrepo
(string): Repository namestate
(optional string): Filter by state ('open', 'closed', 'all')labels
(optional string[]): Filter by labelssort
(optional string): Sort by ('created', 'updated', 'comments')direction
(optional string): Sort direction ('asc', 'desc')since
(optional string): Filter by date (ISO 8601 timestamp)page
(optional number): Page numberper_page
(optional number): Results per pageupdate_issue
owner
(string): Repository ownerrepo
(string): Repository nameissue_number
(number): Issue number to updatetitle
(optional string): New titlebody
(optional string): New descriptionstate
(optional string): New state ('open' or 'closed')labels
(optional string[]): New labelsassignees
(optional string[]): New assigneesmilestone
(optional number): New milestone numberadd_issue_comment
owner
(string): Repository ownerrepo
(string): Repository nameissue_number
(number): Issue number to comment onbody
(string): Comment textsearch_code
q
(string): Search query using GitHub code search syntaxsort
(optional string): Sort field ('indexed' only)order
(optional string): Sort order ('asc' or 'desc')per_page
(optional number): Results per page (max 100)page
(optional number): Page numbersearch_issues
q
(string): Search query using GitHub issues search syntaxsort
(optional string): Sort field (comments, reactions, created, etc.)order
(optional string): Sort order ('asc' or 'desc')per_page
(optional number): Results per page (max 100)page
(optional number): Page numbersearch_users
q
(string): Search query using GitHub users search syntaxsort
(optional string): Sort field (followers, repositories, joined)order
(optional string): Sort order ('asc' or 'desc')per_page
(optional number): Results per page (max 100)page
(optional number): Page numberlist_commits
owner
(string): Repository ownerrepo
(string): Repository namepage
(optional string): page numberper_page
(optional string): number of record per pagesha
(optional string): branch nameReturns: List of commits
get_issue
owner
(string): Repository ownerrepo
(string): Repository nameissue_number
(number): Issue number to retrieveReturns: Github Issue object & details
get_pull_request
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberReturns: Pull request details including diff and review status
list_pull_requests
owner
(string): Repository ownerrepo
(string): Repository namestate
(optional string): Filter by state ('open', 'closed', 'all')head
(optional string): Filter by head user/org and branchbase
(optional string): Filter by base branchsort
(optional string): Sort by ('created', 'updated', 'popularity', 'long-running')direction
(optional string): Sort direction ('asc', 'desc')per_page
(optional number): Results per page (max 100)page
(optional number): Page numberReturns: Array of pull request details
create_pull_request_review
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberbody
(string): Review comment textevent
(string): Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT')commit_id
(optional string): SHA of commit to reviewcomments
(optional array): Line-specific comments, each with:path
(string): File pathposition
(number): Line position in diffbody
(string): Comment textReturns: Created review details
merge_pull_request
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numbercommit_title
(optional string): Title for merge commitcommit_message
(optional string): Extra detail for merge commitmerge_method
(optional string): Merge method ('merge', 'squash', 'rebase')Returns: Merge result details
get_pull_request_files
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberReturns: Array of changed files with patch and status details
get_pull_request_status
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberReturns: Combined status check results and individual check details
update_pull_request_branch
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberexpected_head_sha
(optional string): The expected SHA of the pull request's HEAD refReturns: Success message when branch is updated
get_pull_request_comments
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberReturns: Array of pull request review comments with details like the comment text, author, and location in the diff
get_pull_request_reviews
owner
(string): Repository ownerrepo
(string): Repository namepull_number
(number): Pull request numberlanguage:javascript
: Search by programming languagerepo:owner/name
: Search in specific repositorypath:app/src
: Search in specific pathextension:js
: Search by file extensionq: "import express" language:typescript path:src/
is:issue
or is:pr
: Filter by typeis:open
or is:closed
: Filter by statelabel:bug
: Search by labelauthor:username
: Search by authorq: "memory leak" is:issue is:open label:bug
type:user
or type:org
: Filter by account typefollowers:>1000
: Filter by followerslocation:London
: Search by locationq: "fullstack developer" location:London followers:>100
For detailed search syntax, see GitHub's searching documentation.
Create a GitHub Personal Access Token with appropriate permissions:
- Go to Personal access tokens (in GitHub Settings > Developer settings)
- Select which repositories you'd like this token to have access to (Public, All, or Select)
- Create a token with the repo
scope ("Full control of private repositories")
- Alternatively, if working only with public repositories, select only the public_repo
scope
- Copy the generated token
To use this with Claude Desktop, add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"mcp/github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
{
"mcpServers": {
"github": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
Docker build:
docker build -t mcp/github -f src/github/Dockerfile .
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
[
{
"description": "Create or update a single file in a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Branch to create/update the file in",
"type": "string"
},
"content": {
"description": "Content of the file",
"type": "string"
},
"message": {
"description": "Commit message",
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"path": {
"description": "Path where to create/update the file",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
},
"sha": {
"description": "SHA of the file being replaced (required when updating existing files)",
"type": "string"
}
},
"required": [
"owner",
"repo",
"path",
"content",
"message",
"branch"
],
"type": "object"
},
"name": "create_or_update_file"
},
{
"description": "Search for GitHub repositories",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"page": {
"description": "Page number for pagination (default: 1)",
"type": "number"
},
"perPage": {
"description": "Number of results per page (default: 30, max: 100)",
"type": "number"
},
"query": {
"description": "Search query (see GitHub search syntax)",
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
},
"name": "search_repositories"
},
{
"description": "Create a new GitHub repository in your account",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"autoInit": {
"description": "Initialize with README.md",
"type": "boolean"
},
"description": {
"description": "Repository description",
"type": "string"
},
"name": {
"description": "Repository name",
"type": "string"
},
"private": {
"description": "Whether the repository should be private",
"type": "boolean"
}
},
"required": [
"name"
],
"type": "object"
},
"name": "create_repository"
},
{
"description": "Get the contents of a file or directory from a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Branch to get contents from",
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"path": {
"description": "Path to the file or directory",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"path"
],
"type": "object"
},
"name": "get_file_contents"
},
{
"description": "Push multiple files to a GitHub repository in a single commit",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Branch to push to (e.g., 'main' or 'master')",
"type": "string"
},
"files": {
"description": "Array of files to push",
"items": {
"additionalProperties": false,
"properties": {
"content": {
"type": "string"
},
"path": {
"type": "string"
}
},
"required": [
"path",
"content"
],
"type": "object"
},
"type": "array"
},
"message": {
"description": "Commit message",
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"branch",
"files",
"message"
],
"type": "object"
},
"name": "push_files"
},
{
"description": "Create a new issue in a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"assignees": {
"items": {
"type": "string"
},
"type": "array"
},
"body": {
"type": "string"
},
"labels": {
"items": {
"type": "string"
},
"type": "array"
},
"milestone": {
"type": "number"
},
"owner": {
"type": "string"
},
"repo": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"owner",
"repo",
"title"
],
"type": "object"
},
"name": "create_issue"
},
{
"description": "Create a new pull request in a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"base": {
"description": "The name of the branch you want the changes pulled into",
"type": "string"
},
"body": {
"description": "Pull request body/description",
"type": "string"
},
"draft": {
"description": "Whether to create the pull request as a draft",
"type": "boolean"
},
"head": {
"description": "The name of the branch where your changes are implemented",
"type": "string"
},
"maintainer_can_modify": {
"description": "Whether maintainers can modify the pull request",
"type": "boolean"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
},
"title": {
"description": "Pull request title",
"type": "string"
}
},
"required": [
"owner",
"repo",
"title",
"head",
"base"
],
"type": "object"
},
"name": "create_pull_request"
},
{
"description": "Fork a GitHub repository to your account or specified organization",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"organization": {
"description": "Optional: organization to fork to (defaults to your personal account)",
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo"
],
"type": "object"
},
"name": "fork_repository"
},
{
"description": "Create a new branch in a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"branch": {
"description": "Name for the new branch",
"type": "string"
},
"from_branch": {
"description": "Optional: source branch to create from (defaults to the repository's default branch)",
"type": "string"
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
},
"repo": {
"description": "Repository name",
"type": "string"
}
},
"required": [
"owner",
"repo",
"branch"
],
"type": "object"
},
"name": "create_branch"
},
{
"description": "Get list of commits of a branch in a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"owner": {
"type": "string"
},
"page": {
"type": "number"
},
"perPage": {
"type": "number"
},
"repo": {
"type": "string"
},
"sha": {
"type": "string"
}
},
"required": [
"owner",
"repo"
],
"type": "object"
},
"name": "list_commits"
},
{
"description": "List issues in a GitHub repository with filtering options",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"direction": {
"enum": [
"asc",
"desc"
],
"type": "string"
},
"labels": {
"items": {
"type": "string"
},
"type": "array"
},
"owner": {
"type": "string"
},
"page": {
"type": "number"
},
"per_page": {
"type": "number"
},
"repo": {
"type": "string"
},
"since": {
"type": "string"
},
"sort": {
"enum": [
"created",
"updated",
"comments"
],
"type": "string"
},
"state": {
"enum": [
"open",
"closed",
"all"
],
"type": "string"
}
},
"required": [
"owner",
"repo"
],
"type": "object"
},
"name": "list_issues"
},
{
"description": "Update an existing issue in a GitHub repository",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"assignees": {
"items": {
"type": "string"
},
"type": "array"
},
"body": {
"type": "string"
},
"issue_number": {
"type": "number"
},
"labels": {
"items": {
"type": "string"
},
"type": "array"
},
"milestone": {
"type": "number"
},
"owner": {
"type": "string"
},
"repo": {
"type": "string"
},
"state": {
"enum": [
"open",
"closed"
],
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"owner",
"repo",
"issue_number"
],
"type": "object"
},
"name": "update_issue"
},
{
"description": "Add a comment to an existing issue",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"body": {
"type": "string"
},
"issue_number": {
"type": "number"
},
"owner": {
"type": "string"
},
"repo": {
"type": "string"
}
},
"required": [
"owner",
"repo",
"issue_number",
"body"
],
"type": "object"
},
"name": "add_issue_comment"
},
{
"description": "Search for code across GitHub repositories",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"order": {
"enum": [
"asc",
"desc"
],
"type": "string"
},
"page": {
"minimum": 1,
"type": "number"
},
"per_page": {
"maximum": 100,
"minimum": 1,
"type": "number"
},
"q": {
"type": "string"
}
},
"required": [
"q"
],
"type": "object"
},
"name": "search_code"
},
{
"description": "Search for issues and pull requests across GitHub repositories",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"order": {
"enum": [
"asc",
"desc"
],
"type": "string"
},
"page": {
"minimum": 1,
"type": "number"
},
"per_page": {
"maximum": 100,
"minimum": 1,
"type": "number"
},
"q": {
"type": "string"
},
"sort": {
"enum": [
"comments",
"reactions",
"reactions-+1",
"reactions--1",
"reactions-smile",
"reactions-thinking_face",
"reactions-heart",
"reactions-tada",
"interactions",
"created",
"updated"
],
"type": "string"
}
},
"required": [
"q"
],
"type": "object"
},
"name": "search_issues"
},
{
"description": "Search for users on GitHub",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"order": {
"enum": [
"asc",
"desc"
],
"type": "string"
},
"page": {
"minimum": 1,
"type": "number"
},
"per_page": {
"maximum": 100,
"minimum": 1,
"type": "number"
},
"q": {
"type": "string"
},
"sort": {
"enum": [
"followers",
"repositories",
"joined"
],
"type": "string"
}
},
"required": [
"q"
],
"type": "object"
},
"name": "search_users"
},
{
"description": "Get details of a specific issue in a GitHub repository.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"issue_number": {
"type": "number"
},
"owner": {
"type": "string"
},
"repo": {
"type": "string"
}
},
"required": [
"owner",
"repo",
"issue_number"
],
"type": "object"
},
"name": "get_issue"
}
]