github-mcp-server
GitHub MCP Server
A Python-based Model Context Protocol (MCP) server that allows AI assistants and MCP clients to interact with GitHub through tools.
The server uses the GitHub REST API and provides tools for repository management, issue management, file operations, branches, and pull requests.
šļø Architecture
User
|
v
AI Assistant / MCP Client
|
v
GitHub MCP Server
(FastMCP)
|
v
MCP Tool Selection
|
+------------+------------+
| | |
v v v
Repository Issues Files
Tools Tools Tools
| | |
+------------+------------+
|
+------------+------------+
| |
v v
Branches Pull Requests
Tools Tools
| |
+------------+------------+
|
v
GitHub REST API
|
v
GitHub Repositories
|
v
API Response / Data
|
v
GitHub MCP Server
|
v
Final Response
|
v
User
Features
Get GitHub repository information
List a user's repositories
Get open issues from a repository
Create GitHub issues
Create GitHub repositories
Search GitHub repositories
Add comments to issues
Close GitHub issues
List repository files and folders
Read repository file contents
Create or update repository files
Create GitHub branches
Create pull requests
Merge pull requests
Delete repository files
Technologies Used
Python
Model Context Protocol (MCP)
FastMCP
GitHub REST API
Requests
python-dotenv
MCP Inspector
Installation
1. Clone the repository
git clone https://github.com/Shru4241/github-mcp-server.git
2. Create a Virtual Environment
python -m venv venv3. Activate the Virtual Environment
Windows PowerShell:
venv\Scripts\Activate.ps1Windows Command Prompt:
venv\Scripts\activate4. Install Dependencies
pip install -r requirements.txtEnvironment Variables
Create a .env file in the project root:
GITHUB_TOKEN=your_github_personal_access_tokenReplace your_github_personal_access_token with your own GitHub Personal Access Token.
Never share your GitHub token or commit the .env file to GitHub.
Running the Server
Activate the virtual environment and run:
python server.pyThe MCP server uses STDIO communication and waits for an MCP client to connect.
MCP Inspector
You can test the server using MCP Inspector.
Use:
npx @modelcontextprotocol/inspector@latestThen configure the server with:
Command:
C:\path\to\github-mcp-server\venv\Scripts\python.exeArguments:
C:\path\to\github-mcp-server\server.pyWorking Directory:
C:\path\to\github-mcp-serverAvailable Tools
Tool | Description |
| Get repository information |
| List repositories for a user |
| Get open issues |
| Create a new issue |
| Create a GitHub repository |
| Search GitHub repositories |
| Add a comment to an issue |
| Close an issue |
| List repository files and folders |
| Read a repository file |
| Create or update a repository file |
| Create a new branch |
| Create a pull request |
| Merge a pull request |
| Delete a repository file |
Project Structure
github-mcp-server/
ā
āāā server.py
āāā requirements.txt
āāā README.md
āāā .gitignore
āāā .envNote:
.envcontains your GitHub token and must not be uploaded to GitHub.
Example Workflow
The server can perform a complete GitHub development workflow:
Create Branch
ā
Create / Update File
ā
Commit Changes
ā
Create Pull Request
ā
Merge Pull RequestAuthor
Created as a Python-based GitHub MCP Server project.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Shru4241/github-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server