GitHub MCP Server
GitHub MCP Server š
A custom Model Context Protocol (MCP) server built with Node.js and TypeScript. This server allows any MCP-compatible AI Assistant (like Gemini Code Assist, Claude Desktop, Roo Code, etc.) to interact directly with your GitHub account.
⨠Features (Available Tools)
This server exposes 7 powerful tools to your AI assistant:
create_repository: Create a new public or private repository.get_my_repositories: List the authenticated user's most recently updated repositories.get_repository: Fetch details of a specific repository.get_file_content: Read the exact content of any file inside a repository for code analysis.search_code: Search for functions, keywords, or syntax across repositories.create_issue: Open a new issue in a specific repository.list_issues: View open issues for a repository.
š ļø Installation & Setup
Clone the repository:
git clone [https://github.com/YOUR_USERNAME/mcp-github-server.git](https://github.com/YOUR_USERNAME/mcp-github-server.git) cd mcp-github-server Install dependencies:
Bash npm install Build the project:
Bash npm run build
š How to Get Your GitHub Token
To allow this server to act on your behalf, you need a Personal Access Token (PAT) from GitHub.
Go to your GitHub account settings.
Navigate to Developer settings (at the bottom of the left sidebar).
Click on Personal access tokens -> Tokens (classic).
Click Generate new token (classic).
Give your token a note (e.g., "MCP Server").
Required Scopes:
Check the repo box (This grants full control of private repositories, which is required to create repos, read files, and manage issues).
Scroll down and click Generate token.
Copy the token immediately (it starts with ghp_...).
Setting up the Environment Create a .env file in the root directory of this project:
Bash touch .env Add your token to the .env file:
Ł ŁŲŖŲ·Ł Ų§ŁŲ±Ł Ų² GITHUB_TOKEN=your_generated_token_here š Connecting to Your IDE / AI Client To use this server with an MCP-supported IDE or extension, you need to configure your client's MCP settings (usually a mcp.json or mcp_config.json file) to point to the built index.js file.
Example configuration:
JSON { "mcpServers": { "github-mcp": { "command": "node", "args": [ "--no-warnings", "ABSOLUTE_PATH_TO_YOUR_PROJECT/dist/index.js" ], "env": { "GITHUB_TOKEN": "your_generated_token_here" } } } }
Note: Make sure to replace ABSOLUTE_PATH_TO_YOUR_PROJECT with the actual path on your machine.
š¤ Contributing This is a small educational project! If you'd like to add more tools (like pull request management, or commit reading), feel free to fork the repository and submit a Pull Request.