๐Ÿ”ง GitHub MCP Tool Server

April 17, 2025 ยท View on GitHub

This repo contains a lightweight MCP (Model Context Protocol) server that exposes simple GitHub utilities โ€” allowing AI applications like Cursor or Claude to interact with GitHub repositories.

โœจ Features

  • โœ… get_repo_summary(repo_url) โ€” Fetches basic metadata of a GitHub repository
  • โœ… get_recent_commits(repo_url, count) โ€” Lists the most recent commits to a repo

๐Ÿš€ Getting Started

๐Ÿ“ฆ Requirements

  • Python 3.10+
  • uv package manager (recommended)
  • GitHub Personal Access Token (optional, but prevents rate limiting)

โš™๏ธ Installation

# Clone the repo
git clone https://github.com/rajpanjabi/MCP.git
cd MCP

# Create virtual environment
uv venv .venv
source .venv/bin/activate

# Install dependencies
uv pip install httpx mcp

๐Ÿ’ก Optionally, create a .env file or export your GitHub token:

export GITHUB_PAT=ghp_yourTokenHere

๐Ÿ› ๏ธ Usage with MCP

You can run this server using:

uv run github_tool_mcp_server.py

It will launch in stdio mode and wait for tool calls via an MCP-compatible orchestrator like Claude Desktop or Cursor.


๐Ÿ–ฅ๏ธ Cursor Integration (Optional)

Add the following to your cursor.config.json:

{
  "mcpServers": {
    "github": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/your/project",
        "run",
        "github.py"
      ]
    }
  }
}

Replace /absolute/path/to/your/project with your actual directory.


๐Ÿงช Example Tools

๐Ÿ” 1. get_repo_summary

{
  "name": "get_repo_summary",
  "arguments": {
    "repo_url": "https://github.com/username/repositoryname"
  }
}

Output:

**username/repositoryname**
Description: Lorem ipsum nhwjsrecv dweicdjv 
Stars: 10 | Forks: 2
Language: JavaScript | Open Issues: 1
Updated: 2024-11-22T18:22:33Z

๐Ÿ•ต๏ธ 2. get_recent_commits

{
  "name": "get_recent_commits",
  "arguments": {
    "repo_url": "https://github.com/username/repositoryname",
    "count": 3
  }
}

Output:

[abc1234] by Raj: Added README structure
[def5678] by Raj: Fixed deployment config
[xyz9999] by Raj: Initial commit