GitHub MCP Server
Enables AI assistants to analyze GitHub repositories, read file contents with syntax highlighting, explore directory structures, and understand project architectures across different branches
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub MCP Serveranalyze the structure of the microsoft/vscode repository"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🐙 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.
✨ Features
🔍 Repository Structure Analysis
Complete directory traversal with configurable depth
File type distribution analysis and statistics
Project architecture insights with framework detection
Important file detection (README, package.json, Dockerfile, etc.)
Visual tree structure representation
Size analysis and file counting
📖 File Content Reading
Multi-format support (UTF-8, Base64, Raw)
Syntax highlighting for 30+ programming languages
Code analysis with function/class counting
Pattern detection (TODO comments, async/await, etc.)
Smart content truncation for large files
Binary file handling with appropriate encoding
🚀 Advanced Capabilities
Rate limit optimization with GitHub token support
Branch-specific analysis (main, develop, feature branches)
Error handling with detailed troubleshooting
Session management for efficient API usage
Streamable HTTP transport for modern AI clients
Related MCP server: GitHub Repository Analyzer
🛠️ Installation
Quick Start
npm install -g @xingyuchen/github-mcp-serverFrom Source
git clone https://github.com/guangxiangdebizi/github-mcp-server.git
cd github-mcp-server
npm install
npm run build⚙️ Configuration
Environment Setup
Copy environment template:
cp .env.example .envConfigure your settings:
# GitHub Personal Access Token (recommended for higher rate limits) GITHUB_TOKEN=your_github_token_here # Server Configuration PORT=3000 # Optional: Default repository DEFAULT_REPO=owner/repository
GitHub Token Setup
For optimal performance and access to private repositories:
Go to GitHub Settings > Developer settings > Personal access tokens
Generate a new token with
reposcopeAdd it to your
.envfile
🚀 Usage
Starting the Server
# Production mode
npm start
# Development mode
npm run dev
# HTTP mode (recommended)
npm run start:httpThe server will start at http://localhost:3000 with the MCP endpoint at /mcp.
Client Configuration
Add to your AI client's MCP configuration:
{
"mcpServers": {
"github-analyzer": {
"type": "streamableHttp",
"url": "http://localhost:3000/mcp",
"timeout": 600
}
}
}🔧 Available Tools
1. analyze_repository_structure
Analyze the complete structure and architecture of a GitHub repository.
Parameters:
owner(required): Repository owner/organizationrepo(required): Repository namepath(optional): Specific directory to analyzebranch(optional): Branch name (default: main)max_depth(optional): Maximum traversal depth (1-5, default: 3)
Example:
{
"owner": "microsoft",
"repo": "vscode",
"branch": "main",
"max_depth": 3
}2. read_repository_file
Read and analyze the contents of a specific file from a GitHub repository.
Parameters:
owner(required): Repository owner/organizationrepo(required): Repository namepath(required): File path within the repositorybranch(optional): Branch name (default: main)encoding(optional): File encoding (utf8/base64/raw, default: utf8)max_size(optional): Maximum file size in bytes (default: 1MB, max: 5MB)
Example:
{
"owner": "microsoft",
"repo": "vscode",
"path": "src/vs/code/electron-main/main.ts",
"branch": "main"
}📊 Example Output
Repository Structure Analysis
# 📊 Repository Structure Analysis
## 📋 Repository Information
- **Repository:** microsoft/vscode
- **Description:** Visual Studio Code
- **Language:** TypeScript
- **Stars:** 150,000 ⭐
- **Forks:** 25,000 🍴
## 📁 Directory Structure
📁 src/
📁 vs/
📄 main.ts (15.2 KB)
📁 workbench/
📄 workbench.main.ts (8.5 KB)
## 📈 Statistics
- **Total Files:** 12,450
- **Total Directories:** 1,200
- **Total Size:** 145.2 MB
## 🏗️ Project Architecture Insights
🟨 **TypeScript Project** - Modern web development stack detected
📦 **Node.js Ecosystem** - Uses npm package management
🐳 **Containerized** - Docker deployment readyFile Content Analysis
# 📄 File Content Analysis
## 📋 File Information
- **Repository:** microsoft/vscode
- **File Path:** `src/main.ts`
- **Branch:** main
## 📊 Content Analysis
**File Type:** TypeScript
**Size:** 15.2 KB
**Lines:** 450
**Functions:** 12
**Classes:** 3
**Imports:** 25
## 📝 File Content
```typescript
import { app, BrowserWindow } from 'electron';
// ... (file content with syntax highlighting)🔍 Health Check
Monitor server status:
curl http://localhost:3000/healthResponse:
{
"status": "healthy",
"transport": "streamable-http",
"activeSessions": 2,
"serverInfo": {
"name": "GitHub-MCP",
"version": "1.0.0"
}
}🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
📝 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
👨💻 Author
Xingyu Chen
🌐 LinkedIn: Xingyu Chen
📧 Email: guangxiangdebizi@gmail.com
🐙 GitHub: @guangxiangdebizi
📦 NPM: @xingyuchen
🙏 Acknowledgments
Built with the Model Context Protocol SDK
Powered by GitHub REST API
Inspired by the need for better AI-repository integration
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables AI models to access GitHub repository contents as context, with features to fetch entire repositories, specific file contents, and repository structures for use in AI interactions.Last updated32002MIT
- Flicense-qualityDmaintenanceEnables Large Language Models to analyze GitHub repositories in real-time, providing tools for retrieving repository information, analyzing issues, accessing documentation, and visualizing activity.Last updated
- Alicense-qualityDmaintenanceEnables AI assistants to access live GitHub repository data without cloning, supporting repo summarization, file explanation, recent changes, and dependency analysis.Last updatedMIT
- Alicense-qualityDmaintenanceEnables AI assistants to analyze GitHub repositories, including fetching repository details, searching, and retrieving README content.Last updated5731ISC
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Screens public GitHub repos and PRs to generate risk maps, findings, and merge-readiness signals.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/guangxiangdebizi/github-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server