GitHub MCP Server
by Sami-07
A custom-built MCP server that provides GitHub integration features. It offers various tools and resources to interact with GitHub data.
View on GitHub
Last updated: N/A
GitHub MCP Server
A Simple custom-built MCP server that provides GitHub integration features through various tools and resources.
Demo
https://github.com/user-attachments/assets/63b92a95-56f3-4290-9c73-acc4ad407246
Features
- Get user information and profile details
- List user repositories and followers
- Get repository issues
- Create new issues
- Get commit statuses
- Get owner information
- Resource-based access to GitHub data
Setup
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the project root and add your GitHub token:
GITHUB_TOKEN=your_github_token_here
You can create a GitHub token at: https://github.com/settings/personal-access-tokens with the following permissions:
repo
(Full control of private repositories)read:user
(Read user profile data)user:follow
(Follow and unfollow users)
Available Tools
owner_info()
: Get information about the authenticated GitHub userget_user_info(username)
: Get information about a GitHub userlist_followers(username, limit=10)
: List followers for a GitHub userlist_repositories(username, limit=5)
: List repositories for a GitHub userget_repo_issues(owner, repo, state="open")
: Get issues for a repositorycreate_issue(owner, repo, title, body, labels=None)
: Create a new issueget_commit_statuses(owner, repo, sha)
: Get commit statuses for a specific commit SHA
Available Resources
github://user/{username}
: Get a user's GitHub profilegithub://followers/{username}
: List a user's followersgithub://repos/{username}
: List a user's repositoriesgithub://issues/{owner}/{repo}
: Get issues for a repositorygithub://commit-status/{owner}/{repo}/{sha}
: Get commit statuses for a specific commit
Running the Server
python server.py
Example Usage
# Get authenticated user information
user_info = owner_info()
# Get user information
user_info = get_user_info("octocat")
# List followers
followers = list_followers("octocat", limit=5)
# List repositories
repos = list_repositories("octocat", limit=3)
# Get repository issues
issues = get_repo_issues("octocat", "Hello-World")
# Create a new issue
new_issue = create_issue(
"octocat",
"Hello-World",
"Bug Report",
"Found a bug in the code",
labels=["bug"]
)
# Get commit statuses
statuses = get_commit_statuses("octocat", "Hello-World", "abc123")
Response Format Examples
User Information
{
"name": "The Octocat",
"login": "octocat",
"bio": "GitHub's mascot",
"public_repos": 8,
"followers": 1000,
"following": 9
}
Repository Information
{
"name": "Hello-World",
"description": "My first repository",
"stars": 100,
"forks": 50,
"language": "Python"
}
Issue Information
{
"number": 1,
"title": "Bug Report",
"state": "open",
"created_at": "2024-05-04T14:35:40.784Z",
"user": "octocat"
}