Enables AI assistants to analyze GitHub repositories, read file contents with syntax highlighting, explore directory structures, and understand project architectures across different branches
🐙 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
🛠️ Installation
Quick Start
From Source
⚙️ Configuration
Environment Setup
- Copy environment template:
- Configure your settings:
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
repo
scope - Add it to your
.env
file
🚀 Usage
Starting the Server
The server will start at http://localhost:3000
with the MCP endpoint at /mcp
.
Client Configuration
Add to your AI client's MCP configuration:
🔧 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:
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:
📊 Example Output
Repository Structure Analysis
File Content Analysis
🔍 Health Check
Monitor server status:
Response:
🤝 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
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables AI assistants to analyze GitHub repository structures and read file contents with features like directory traversal, file type analysis, syntax highlighting, and code pattern detection. Supports both public and private repositories through GitHub API integration.
Related MCP Servers
- AsecurityFlicenseAqualityProvides tools for mapping and analyzing GitHub repositories. It allows users to set a GitHub Personal Access Token and retrieve detailed information about a specified repository, including its structure and summary statistics.Last updated -218
- AsecurityAlicenseAqualityProvides GitHub data analysis for repositories, developers, and organizations, enabling insights into open source ecosystems through API calls and natural language queries.Last updated -513MIT License
- -securityAlicense-qualityEnables interaction with GitHub repositories through the GitHub API, allowing file operations, repository management, issue tracking, and code search through natural language commands.Last updated -102MIT License
- -securityFlicense-qualityA set of tools allowing AI assistants to interact directly with GitHub, enabling automation of tasks like fetching user profiles, creating repositories, and managing pull requests.Last updated -