home / mcp / github mcp server
A powerful Model Context Protocol (MCP) server that enables AI assistants to analyze and read GitHub repositories with ease. Perfect for code analysis, repository exploration, and understanding project structures.
Configuration
View docs{
"mcpServers": {
"guangxiangdebizi-github-mcp-server": {
"url": "http://localhost:3000/mcp",
"headers": {
"PORT": "3000",
"DEFAULT_REPO": "owner/repository",
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN_HERE"
}
}
}
}You can run a capable MCP server that analyzes GitHub repositories, exploring their structure and contents to help AI assistants understand codebases, project layouts, and file-level details. It supports depth-controlled traversal, file content reading across formats, and practical insights for rapid repository comprehension.
Connect your AI client to the MCP endpoint at the serverβs /mcp path to start analyzing GitHub repositories. You can request repository structure analysis to map directories, file types, and project architecture, or read specific files to inspect their contents with language-aware highlighting. Use the HTTP endpoint for remote access or run a local stdio instance to host the MCP server on your machine.
Prerequisites: make sure you have Node.js and npm installed on your system.
npm install -g @xingyuchen/github-mcp-serverIf you prefer to run from source, clone the project, install dependencies, and build before starting the server.
git clone https://github.com/guangxiangdebizi/github-mcp-server.git
cd github-mcp-server
npm install
npm run buildStart options include a production start, development mode, or HTTP mode. Choose the command that fits your workflow.
# Production mode
npm start
# Development mode
npm run dev
# HTTP mode (recommended for MCP clients)
npm run start:httpEnvironment setup creates a shared configuration that the MCP server reads on startup. Do the following to prepare your environment:
cp .env.example .env
```
Configure these values in your .env file:
- GITHUB_TOKEN: Your GitHub Personal Access Token with repo scope for higher rate limits
- PORT: Server port to listen on (default is 3000)
- DEFAULT_REPO: Optional default repository in the form owner/repoFor optimal access to GitHub resources, generate a personal access token and place it in your environment file. Use the token in the GITHUB_TOKEN variable.
# Go to GitHub Settings > Developer settings > Personal access tokens
# Generate a token with the repo scope, then add it to .envAnalyzes the complete structure and architecture of a GitHub repository, including directory traversal depth, file type distribution, and project insights.
Reads and analyzes the contents of a specific file from a GitHub repository, with options for branch and encoding.