Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub MCP Server

A Python-based Model Context Protocol (MCP) server that lets AI agents interact with GitHub through structured tools. It connects the GitHub API with MCP clients such as GitHub Copilot Agent, enabling natural-language access to repositories, pull requests, and commits.

Overview

This project demonstrates how MCP can connect an AI agent to GitHub without putting GitHub API logic directly inside the agent.

Demo

GitHub MCP Server Demo

Architecture

flowchart LR
    A[User] --> B[GitHub Copilot<br/>Agent]
    B -->|MCP| C[Python<br/>GitHub MCP Server]
    C -->|GitHub API| D[GitHub]

    D --> E[Repositories]
    D --> F[Pull Requests]
    D --> G[Commits]
Loading

Features

  • GitHub API integration through MCP
  • Repository, pull request, and commit tools
  • GitHub Copilot Agent integration
  • MCP Inspector support
  • Environment-based authentication

Available Tools

Tool Description
list_repositories List available repositories
list_pull_requests List repository pull requests
list_commits List repository commits
get_issues Get open repository issues

Example Requests

With the server connected to Copilot Agent:

List my GitHub repositories.
Show me the open pull requests in alibro005/CardioPredict.
Show me the latest 5 commits in alibro005/CardioPredict.

Copilot selects the appropriate MCP tool, retrieves the data through the server, and returns the result in natural language.

Tech Stack

  • Python
  • Model Context Protocol (MCP)
  • GitHub REST API
  • GitHub Copilot
  • MCP Inspector
  • VS Code

Project Structure

github-mcp-server/
│
├── .vscode/
│   └── mcp.json
│
├── assets/
│   └── demo.gif
│
├── tools/
│   ├── repos.py
│   ├── pulls.py
│   ├── commits.py
│   └── issues.py
│
├── server.py
├── requirements.txt
├── .env
├── .gitignore
└── README.md

Setup

1. Clone the repository

git clone https://github.com/alibro005/github-mcp-server.git
cd github-mcp-server

2. Create a virtual environment

python -m venv .venv

Windows:

.venv\Scripts\activate

Linux/macOS:

source .venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Configure GitHub authentication

Create a .env file:

GITHUB_TOKEN=your_github_token

Keep your token private and add .env to .gitignore:

.env
.venv/
__pycache__/

Testing

MCP Inspector

Test the server independently with:

npx @modelcontextprotocol/inspector python server.py

This verifies tool discovery, execution, and GitHub API responses.

GitHub Copilot Agent

The server was also tested with GitHub Copilot Agent in VS Code to verify the complete workflow:

User → Copilot Agent → MCP Server → GitHub API → Response

Future Improvements

  • GitHub issue management
  • Pull request creation and updates
  • Automated PR reviews
  • Commit and diff analysis
  • Repository search
  • AI-generated PR summaries
  • GitHub Actions integration

Project Outcome

A working MCP integration that allows an AI agent to interact with GitHub using reusable, structured tools instead of directly handling GitHub API operations.

License

This project is licensed under the MIT License.

About

A GitHub MCP (Model Context Protocol) server that gives agent tools to check GitHub repository issues, pull requests, commits, and repositories listings on request.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages