GitHub MCP Server logo

GitHub MCP Server

by peterparker57

The GitHub MCP Server provides integration capabilities with GitHub repositories through the Model Context Protocol (MCP). It supports operations like repository management, file operations, and commit handling.

View on GitHub

Last updated: N/A

What is GitHub MCP Server?

The GitHub MCP Server is a Model Context Protocol server that allows users to interact with GitHub repositories programmatically. It provides a set of tools to manage repositories, manipulate files, and handle commits via MCP.

How to use GitHub MCP Server?

To use the server, install the package using npm (npm install @modelcontextprotocol/server-github). Then, configure the server in your MCP settings file (cline_mcp_settings.json) by providing the path to the server's index.js, your GitHub token, and your GitHub username. Use the available tools like create_repository, push_file, and create_commit through the MCP interface.

Key features of GitHub MCP Server

  • Account management and authentication

  • Repository creation and management

  • File operations (read, write, push, pull)

  • Commit operations

  • Directory synchronization

  • Repository comparison and diffing

Use cases of GitHub MCP Server

  • Automated repository creation and configuration

  • Programmatic file updates and deployments to GitHub repositories

  • Automated commit creation and management

  • Synchronization of local and remote directories

  • Integrating GitHub repositories with other MCP-compatible tools

FAQ from GitHub MCP Server

How do I configure multiple GitHub accounts?

You can configure multiple accounts by incrementing the number N in the environment variables GITHUB_TOKEN_N and GITHUB_OWNER_N (e.g., GITHUB_TOKEN_1, GITHUB_OWNER_1, GITHUB_TOKEN_2, GITHUB_OWNER_2).

What is the purpose of the DEFAULT_OWNER environment variable?

The DEFAULT_OWNER environment variable specifies the default GitHub account to use if no owner is specified in the tool's input.

How do I clone a repository?

Use the clone_repository tool, providing the owner, repository name, branch (optional), and the local directory to clone into.

How do I push a file to a repository?

Use the push_file tool, providing the owner, repository name, target path in the repository, commit message, and the local file path.

How do I create a commit with multiple file changes?

Use the create_commit tool, providing the owner, repository name, branch, commit message, and an array of changes, where each change specifies the file path, local file path (for add/modify), and the operation (add, modify, or delete).