GitHub MCP Server

Model Context Protocol server for GitHub repository management and interaction.

README.md

GitHub MCP Server

Model Context Protocol server for GitHub repository management and interaction.

Overview

This MCP server enables AI agents to interact with GitHub repositories via the GitHub REST API. Built with TypeScript using the official MCP SDK and Octokit.

Version: 0.3.0 (Phase 3 In Progress)
Author: Pip (@pipseedai)
License: MIT

Features

Phase 1: Read Operations ✅

  • github_list_repos - List repositories for a user or organization
  • github_get_repo - Get detailed repository information
  • github_get_file - Read file contents from a repository
  • github_list_issues - List repository issues with filters
  • github_search_code - Search code across GitHub repositories

Phase 2: Write Operations ✅

  • github_create_repo - Create a new repository
  • github_create_issue - Create an issue with title, body, labels, assignees
  • github_update_issue - Update issue (title, body, state, labels, assignees)
  • github_create_comment - Add comments to issues or pull requests

Phase 3: Webhook Monitoring 🚧

Real-time GitHub event monitoring with Discord notifications.

Components:

  • Phase 3.1: HTTP server with SSE transport for MCP tools
  • Phase 3.2: Webhook signature verification (HMAC SHA-256)
  • Phase 3.3: Discord delivery via webhooks
  • 🔲 Phase 3.4: Production deployment and GitHub webhook configuration

Supported Events:

  • Issues (opened, closed, reopened)
  • Pull requests (opened, closed, merged)
  • Releases (published, created)
  • Stars, watches, forks
  • Commits, branches, tags

Event Filtering: Automatically filters noisy events (individual watch/unwatch, repetitive actions)

Phase 4: Advanced Features (Future)

  • Pull request creation and management
  • Branch and commit operations
  • Repository forking and starring
  • Workflow management

Installation

cd ~/.openclaw/workspace/mcp-servers/github
npm install
npm run build

Configuration

Authentication

Requires a GitHub Personal Access Token stored in ~/.openclaw/secrets/github.env:

GITHUB_TOKEN=ghp_your_token_here

Webhook Server (Phase 3)

For real-time GitHub event monitoring, configure webhook secrets and Discord delivery in ~/.openclaw/secrets/github.env:

# Required: GitHub webhook secret (set when creating webhook)
GITHUB_WEBHOOK_SECRET=your_webhook_secret_here

# Required: Discord webhook URL for notifications
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

# Optional: HTTP server port (default: 9999)
PORT=9999

Start the HTTP server:

source ~/.openclaw/secrets/github.env
npm run build
node dist/server-http.js

Endpoints:

  • GET /health - Server health check
  • GET /sse - MCP SSE transport (tools still available)
  • POST /webhooks/github - GitHub webhook receiver

GitHub Webhook Configuration:

  1. Go to repository Settings → Webhooks → Add webhook
  2. Payload URL: https://your-domain.com/webhooks/github
  3. Content type: application/json
  4. Secret: Same as GITHUB_WEBHOOK_SECRET
  5. Events: Choose events to monitor (or "Send me everything")

Usage

Via mcporter CLI

Note: Make sure GITHUB_TOKEN is set in your environment before running these commands.

export GITHUB_TOKEN=ghp_your_token_here
# List repositories for authenticated user
npx mcporter call --stdio "./path/to/github-mcp/dist/index.js" \
  'github.github_list_repos()'

# Get repository information
npx mcporter call --stdio "./path/to/github-mcp/dist/index.js" \
  'github.github_get_repo(owner: "modelcontextprotocol", repo: "servers")'

# Read file contents
npx mcporter call --stdio "./path/to/github-mcp/dist/index.js" \
  'github.github_get_file(owner: "owner", repo: "repo", path: "README.md")'

# List repository issues
npx mcporter call --stdio "./path/to/github-mcp/dist/index.js" \
  'github.github_list_issues(owner: "owner", repo: "repo", state: "open")'

# Search code
npx mcporter call --stdio "./path/to/github-mcp/dist/index.js" \
  'github.github_search_code(query: "addClass in:file language:js")'

Available Tools

github_list_repos

List repositories for a user or organization.

Parameters:

  • username (optional) - GitHub username/org (defaults to authenticated user)
  • type (optional) - Filter: "all", "owner", "member" (default: "owner")
  • sort (optional) - Sort by: "created", "updated", "pushed", "full_name" (default: "updated")
  • per_page (optional) - Results per page (default: 30, max: 100)

github_get_repo

Get detailed information about a repository.

Parameters:

  • owner (required) - Repository owner
  • repo (required) - Repository name

Returns: Repository metadata including description, stars, forks, language, topics, etc.

github_get_file

Read file contents from a repository.

Parameters:

  • owner (required) - Repository owner
  • repo (required) - Repository name
  • path (required)

Tools 9

github_list_reposList repositories for a user or organization.
github_get_repoGet detailed information about a repository.
github_get_fileRead file contents from a repository.
github_list_issuesList repository issues with filters.
github_search_codeSearch code across GitHub repositories.
github_create_repoCreate a new repository.
github_create_issueCreate an issue with title, body, labels, assignees.
github_update_issueUpdate issue (title, body, state, labels, assignees).
github_create_commentAdd comments to issues or pull requests.

Environment Variables

GITHUB_TOKENrequiredGitHub Personal Access Token for authentication.
GITHUB_WEBHOOK_SECRETSecret for GitHub webhook signature verification.
DISCORD_WEBHOOK_URLDiscord webhook URL for event notifications.
PORTHTTP server port for webhook monitoring.

Try it

List all repositories owned by the user 'modelcontextprotocol'.
Get the README.md file content from the 'pipseedai/github-mcp' repository.
Search for 'addClass' in JavaScript files across my repositories.
Create a new issue in the 'my-org/my-repo' repository titled 'Fix bug' with the body 'Details about the bug'.
List all open issues for the 'modelcontextprotocol/servers' repository.

Frequently Asked Questions

What are the key features of GitHub MCP Server?

Read repository metadata and file contents. List and filter repository issues. Create and update GitHub issues and comments. Search code across repositories. Real-time GitHub event monitoring with Discord notifications.

What can I use GitHub MCP Server for?

Automating issue tracking and management for development teams. Searching through large codebases using natural language queries. Integrating GitHub repository events with Discord for real-time team updates. Programmatically creating new repositories and managing project documentation.

How do I install GitHub MCP Server?

Install GitHub MCP Server by running: cd ~/.openclaw/workspace/mcp-servers/github && npm install && npm run build

What MCP clients work with GitHub MCP Server?

GitHub MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep GitHub MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare