GitHub MCP Server

  • Version Control
  • File Systems
  • Search
JavaScript
MIT
1,492
5,149
A
security – no known vulnerabilities (report Issue)
A
license - permissive license (MIT)
A
quality - confirmed to work

MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.

  1. Tools
  2. Prompts
  3. Resources
  4. Server Configuration
  5. README.md

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
create_or_update_fileCreate or update a single file in a GitHub repository
search_repositoriesSearch for GitHub repositories
create_repositoryCreate a new GitHub repository in your account
get_file_contentsGet the contents of a file or directory from a GitHub repository
push_filesPush multiple files to a GitHub repository in a single commit
create_issueCreate a new issue in a GitHub repository
create_pull_requestCreate a new pull request in a GitHub repository
fork_repositoryFork a GitHub repository to your account or specified organization
create_branchCreate a new branch in a GitHub repository
list_commitsGet list of commits of a branch in a GitHub repository
list_issuesList issues in a GitHub repository with filtering options
update_issueUpdate an existing issue in a GitHub repository
add_issue_commentAdd a comment to an existing issue
search_codeSearch for code across GitHub repositories
search_issuesSearch for issues and pull requests across GitHub repositories
search_usersSearch for users on GitHub
get_issueGet details of a specific issue in a GitHub repository.

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
GITHUB_PERSONAL_ACCESS_TOKENYesYour GitHub Personal Access Token with appropriate permissions
README.md

GitHub MCP Server

MCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.

Features

  • Automatic Branch Creation: When creating/updating files or pushing changes, branches are automatically created if they don't exist
  • Comprehensive Error Handling: Clear error messages for common issues
  • Git History Preservation: Operations maintain proper Git history without force pushing
  • Batch Operations: Support for both single-file and multi-file operations
  • Advanced Search: Support for searching code, issues/PRs, and users

Tools

  1. create_or_update_file
    • Create or update a single file in a repository
    • Inputs:
      • owner (string): Repository owner (username or organization)
      • repo (string): Repository name
      • path (string): Path where to create/update the file
      • content (string): Content of the file
      • message (string): Commit message
      • branch (string): Branch to create/update the file in
      • sha (optional string): SHA of file being replaced (for updates)
    • Returns: File content and commit details
  2. push_files
    • Push multiple files in a single commit
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • branch (string): Branch to push to
      • files (array): Files to push, each with path and content
      • message (string): Commit message
    • Returns: Updated branch reference
  3. search_repositories
    • Search for GitHub repositories
    • Inputs:
      • query (string): Search query
      • page (optional number): Page number for pagination
      • perPage (optional number): Results per page (max 100)
    • Returns: Repository search results
  4. create_repository
    • Create a new GitHub repository
    • Inputs:
      • name (string): Repository name
      • description (optional string): Repository description
      • private (optional boolean): Whether repo should be private
      • autoInit (optional boolean): Initialize with README
    • Returns: Created repository details
  5. get_file_contents
    • Get contents of a file or directory
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • path (string): Path to file/directory
      • branch (optional string): Branch to get contents from
    • Returns: File/directory contents
  6. create_issue
    • Create a new issue
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • title (string): Issue title
      • body (optional string): Issue description
      • assignees (optional string[]): Usernames to assign
      • labels (optional string[]): Labels to add
      • milestone (optional number): Milestone number
    • Returns: Created issue details
  7. create_pull_request
    • Create a new pull request
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • title (string): PR title
      • body (optional string): PR description
      • head (string): Branch containing changes
      • base (string): Branch to merge into
      • draft (optional boolean): Create as draft PR
      • maintainer_can_modify (optional boolean): Allow maintainer edits
    • Returns: Created pull request details
  8. fork_repository
    • Fork a repository
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • organization (optional string): Organization to fork to
    • Returns: Forked repository details
  9. create_branch
    • Create a new branch
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • branch (string): Name for new branch
      • from_branch (optional string): Source branch (defaults to repo default)
    • Returns: Created branch reference
  10. list_issues
    • List and filter repository issues
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • state (optional string): Filter by state ('open', 'closed', 'all')
      • labels (optional string[]): Filter by labels
      • sort (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 number
      • per_page (optional number): Results per page
    • Returns: Array of issue details
  11. update_issue
    • Update an existing issue
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • issue_number (number): Issue number to update
      • title (optional string): New title
      • body (optional string): New description
      • state (optional string): New state ('open' or 'closed')
      • labels (optional string[]): New labels
      • assignees (optional string[]): New assignees
      • milestone (optional number): New milestone number
    • Returns: Updated issue details
  12. add_issue_comment
    • Add a comment to an issue
    • Inputs:
      • owner (string): Repository owner
      • repo (string): Repository name
      • issue_number (number): Issue number to comment on
      • body (string): Comment text
    • Returns: Created comment details
  13. search_code
    • Search for code across GitHub repositories
    • Inputs:
      • q (string): Search query using GitHub code search syntax
      • sort (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 number
    • Returns: Code search results with repository context
  14. search_issues
    • Search for issues and pull requests
    • Inputs:
      • q (string): Search query using GitHub issues search syntax
      • sort (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 number
    • Returns: Issue and pull request search results
  15. search_users
    • Search for GitHub users
    • Inputs:
      • q (string): Search query using GitHub users search syntax
      • sort (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 number
    • Returns: User search results
  16. list_commits
  • Gets commits of a branch in a repository
  • Inputs:
    • owner (string): Repository owner
    • repo (string): Repository name
    • page (optional string): page number
    • per_page (optional string): number of record per page
    • sha (optional string): branch name
  • Returns: List of commits
  1. get_issue
  • Gets the contents of an issue within a repository
  • Inputs:
    • owner (string): Repository owner
    • repo (string): Repository name
    • issue_number (number): Issue number to retrieve
  • Returns: Github Issue object & details

Search Query Syntax

Code Search

  • language:javascript: Search by programming language
  • repo:owner/name: Search in specific repository
  • path:app/src: Search in specific path
  • extension:js: Search by file extension
  • Example: q: "import express" language:typescript path:src/

Issues Search

  • is:issue or is:pr: Filter by type
  • is:open or is:closed: Filter by state
  • label:bug: Search by label
  • author:username: Search by author
  • Example: q: "memory leak" is:issue is:open label:bug

Users Search

  • type:user or type:org: Filter by account type
  • followers:>1000: Filter by followers
  • location:London: Search by location
  • Example: q: "fullstack developer" location:London followers:>100

For detailed search syntax, see GitHub's searching documentation.

Setup

Personal Access Token

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

Usage with Claude Desktop

To use this with Claude Desktop, add the following to your claude_desktop_config.json:

{ "mcpServers": { "github": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>" } } } }

License

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.

GitHub Badge

Glama performs regular codebase and documentation scans to:

  • Confirm that the MCP server is working as expected.
  • Confirm that there are no obvious security issues with dependencies of the server.
  • Extract server characteristics such as tools, resources, prompts, and required parameters.

Our directory badge helps users to quickly asses that the MCP server is safe, server capabilities, and instructions for installing the server.

Copy the following code to your README.md file:

Alternative MCP servers

  • -
    security
    A
    license
    -
    quality
    Provides comprehensive tools for managing GitHub projects, milestones, tasks, and sprints. This server integrates deeply with GitHub Projects V2, offering features like automated kanban workflows, sprint planning, and custom field management.
    MIT
  • A
    security
    F
    license
    A
    quality
    Helps AI read GitHub repository structure and important files. Want to quickly understand what a repo is about? Prompt it with "read https://github.com/adhikasp/mcp-git-ingest and determine how the code technically works".
  • -
    security
    A
    license
    -
    quality
    A Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.
    MIT
  • A
    security
    A
    license
    A
    quality
    MCP Server for the GitLab API, enabling project management, file operations, and more.
    MIT