github-mcp-server
The GitHub MCP Server Integration project allows AI assistants to interact with GitHub through MCP standards. It provides an MCP-compliant server that supports fetching user details, listing repositories, and creating issues in GitHub repositories. Deployed using FastAPI, it ensures secure and documented API access.
GitHub MCP Server Integration
This project demonstrates a Model Context Protocol (MCP) Server that integrates with the GitHub API. It allows AI Assistants like Claude or OpenAI GPT to interact with GitHub using MCP.
š Live Demo
š Deployed Server Link
š .well-known/ai-plugin.json
endpoint:
https://github-mcp-server-production.up.railway.app/.well-known/ai-plugin.json
š Project Overview
This MCP Server exposes a REST API that allows AI Assistants to:
- Get user GitHub profile information
- List repositories for a user
- Create an issue in a repository
The server follows Model Context Protocol (MCP) standards to ensure interoperability with AI systems.
š§ Tech Stack
- FastAPI (Python framework for building APIs)
- OpenAPI (Standard for describing REST APIs)
- ai-plugin.json (MCP metadata configuration)
- GitHub REST API v3
- Deployed on Railway
⨠Features
- MCP-compliant server with OpenAPI documentation
- Secure interaction with GitHub using a personal access token
- AI Assistants can:
- Fetch GitHub user details
- List repositories by username
- Create issues on repositories
š Project Structure
āāā ai-plugin.json # MCP Plugin metadata for AI Assistants
āāā openapi.yaml # OpenAPI spec describing the available endpoints
āāā main.py # FastAPI MCP server code
āāā requirements.txt # Python dependencies
āāā README.md # Project documentation (this file)
š How It Works
1. FastAPI Server
- Exposes REST API endpoints like:
/github/user
/github/repos/{username}
/github/repos/{owner}/{repo}/issues
2. ai-plugin.json
- Metadata for AI assistants to understand the MCP server:
- Plugin name, description
- Authentication method
- OpenAPI URL reference
3. openapi.yaml
- Defines all routes and parameters for the AI assistant to interact with.
š Authentication
- GitHub Personal Access Token (PAT)
- Set as an environment variable:
GITHUB_TOKEN
- Use in your
.env
file or directly in Railway's environment settings.
- Set as an environment variable:
āļø Setup Instructions (Local Development)
Prerequisites:
- Python 3.9+
- GitHub Personal Access Token (PAT) with
repo
permissions
Clone the repo:
git clone https://github.com/yourusername/github-mcp-server.git
cd github-mcp-server
Install dependencies:
pip install -r requirements.txt
Create .env
file:
GITHUB_TOKEN=your_personal_access_token
Run the FastAPI server:
uvicorn main:app --reload
Visit: http://localhost:8000/docs
for the Swagger UI
š Deployment (Railway)
- Login at Railway
- Create a new project ā Deploy from GitHub ā Select your MCP repo
- Add the
GITHUB_TOKEN
as an environment variable in Railway - Confirm the start command:
uvicorn main:app --host 0.0.0.0 --port 8000
- Deploy & get your production URL (e.g.,
https://github-mcp-server-production.up.railway.app
)
š¤ Demonstration with AI Assistants
Claude AI / OpenAI GPT Plugin (optional based on access)
- Register your
.well-known/ai-plugin.json
URL in the AI assistant settings. - Interact using natural language prompts:
"List my GitHub repositories." "Create an issue in my repo named 'sample-repo'."
š OpenAPI Endpoints
Endpoint | Method | Description |
---|---|---|
/github/user | GET | Get authenticated user info |
/github/repos/{username} | GET | List repositories of a user |
/github/repos/{owner}/{repo}/issues | POST | Create an issue in a repo |
š Example Requests
Get user info
curl -X GET https://github-mcp-server-production.up.railway.app/github/user
List repos
curl -X GET https://github-mcp-server-production.up.railway.app/github/repos/<username>
Create an issue
curl -X POST https://github-mcp-server-production.up.railway.app/github/repos/<owner>/<repo>/issues \
-H "Content-Type: application/json" \
-d '{"title": "Bug found!", "body": "Please fix this bug."}'