GitHub MCP Server
by loidodev
The GitHub MCP Server is a Model Context Protocol server designed to interact with the GitHub API. It provides a set of tools for managing repositories, creating commits, and pushing/pulling changes.
View on GitHub
Last updated: N/A
GitHub MCP Server
A Model Context Protocol server for interacting with the GitHub API.
Features
Tools
-
list_user_repos
: List repositories for the authenticated user- Parameters:
type
(optional): "owner", "all", or "member" (default: "owner")sort
(optional): "created", "updated", "pushed", or "full_name" (default: "full_name")direction
(optional): "asc" or "desc" (default: "asc")per_page
(optional): Number of results per page (default: 30, max: 100)page
(optional): Page number (default: 1)
- Parameters:
-
get_repo
: Get details about a specific repository- Parameters:
repo
(required): The name of the repositoryowner
(optional): The account owner. If not provided, uses authenticated user.
- Parameters:
-
create_repo
: Create a new repository- Parameters:
name
(required): The name of the repositorydescription
(optional): A short descriptionprivate
(optional): Whether the repository is private (default: false)auto_init
(optional): Create initial commit with empty README (default: false)
- Parameters:
-
create_commit
: Create a new commit with file changes- Parameters:
repo
(required): The name of the repositoryowner
(optional): The account owner. If not provided, uses authenticated user.branch
(optional): The branch name (default: "main")message
(required): The commit messagefiles
(required): Array of files to include in commit- Each file requires:
path
: File path relative to repository rootcontent
: File content
- Each file requires:
- Parameters:
-
push
: Push changes to a remote repository- Parameters:
repo
(required): The name of the repositoryowner
(optional): The account owner. If not provided, uses authenticated user.branch
(optional): The branch name (default: "main")
- Parameters:
-
pull
: Pull changes from a remote repository- Parameters:
repo
(required): The name of the repositoryowner
(optional): The account owner. If not provided, uses authenticated user.branch
(required): The branch name
- Parameters:
Requirements
- Node.js 18+
- GitHub personal access token with appropriate permissions
- Set
GITHUB_TOKEN
environment variable
Installation
npm install
npm run build
Configuration
Set your GitHub token as an environment variable:
export GITHUB_TOKEN=your_token_here
Usage
Run the server:
npm start
Development
For development with auto-rebuild:
npm run watch
Debugging
Use the MCP Inspector:
npm run inspector