GitHub MCP Server

by marvelouscypherman

244 downloads
Not rated
GitHub

About

GitHub MCP Server is a Model Context Protocol (MCP) server that provides a standardized interface for AI models to interact with the GitHub API. It enables repository operations, file management, issue and pull request handling, code search, branch management, and commit history…

Details

Author
marvelouscypherman
Downloads
244
Categories
Developer Tools, API

- Full GitHub API integration
- Repository operations: create, fork, search
- File operations: create, update, read
- Issue and pull request management
- Code search capabilities
- Branch management and commit history access
- Real-time updates via Server-Sent Events

Clone the repository, install dependencies with npm install, configure a GitHub Personal Access Token via config.json or the GITHUB_TOKEN environment variable, then build (npm run build) and start (npm start) the server (default port 3000). Use the endpoints POST /list-tools, POST /call-tool, GET /health, and GET /events to interact with the server.

GitHub MCP Server

A Model Context Protocol (MCP) server implementation for GitHub API integration. This server provides a standardized interface for AI models to interact with GitHub repositories, issues, pull requests, and more.

Features

- Full GitHub API integration
- Support for repository operations (create, fork, search)
- File operations (create, update, read)
- Issue and PR management
- Code search capabilities
- Branch management
- Commit history access

Setup

1. Clone the repository:

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

2. Install dependencies:

npm install

3. Configure GitHub token:
- Copy config.example.json to config.json
- Add your GitHub Personal Access Token:

{
"github": {
"token": "YOUR_GITHUB_TOKEN"
}
}

Alternatively, set the token via environment variable:
export GITHUB_TOKEN="your_token_here"

4. Build the server:

npm run build

5. Start the server:

npm start

The server will start on port 3000 by default. You can change this by setting the PORT environment variable.

Configuration

The server can be configured either through:
- Environment variables (GITHUB_TOKEN)
- Configuration file (config.json)

API Endpoints

- POST /list-tools - List available GitHub operations
- POST /call-tool - Execute a GitHub operation
- GET /health - Server health check
- GET /events - Server-Sent Events endpoint for real-time updates

Server-Sent Events (SSE)

The server supports real-time updates through Server-Sent Events. Connect to the /events endpoint to receive updates for various GitHub operations:

Available Events:

- repository_forked - When a repository is forked
- branch_created - When a new branch is created
- repository_created - When a new repository is created
- file_updated - When a file is created or updated
- files_pushed - When multiple files are pushed
- issue_created - When a new issue is created
- pull_request_created - When a new pull request is created

Example Usage:

const eventSource = new EventSource('http://localhost:3000/events');

eventSource.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log(data.type, data.data);
};

A complete example client implementation can be found in examples/sse-client.html.

License

MIT License

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.