A powerful Model Context Protocol (MCP) server that enables ChatGPT and other AI assistants to crawl and interact with GitHub repositories - both public and private. Built with FastMCP.
🔍 Comprehensive GitHub API Integration - 10 specialized tools for repository exploration:
- Search repositories by query with advanced filtering
- Get repository details including stars, forks, topics, and license
- List user/org repositories with sorting options
- Browse repository contents - files and directories
- Get complete repository structure as a tree
- Read README files in markdown format
- List commits with author and message details
- Analyze programming languages used in repositories
- Browse issues with state filtering
- Download file contents with automatic decoding
🔐 Private Repository Access - Full support for private repositories using GitHub Personal Access Tokens
⚡ High Rate Limits - 5,000 requests/hour with authentication (vs 60 without)
🚀 Easy Deployment - Deploy to FastMCP Cloud and connect directly to ChatGPT
mkdir github-crawler-mcp
cd github-crawler-mcpPlace the github_crawler_server.py file in this directory.
pip install -r requirements.txtThis will install:
fastmcp- MCP server frameworkhttpx- Async HTTP client for GitHub APIpython-dotenv- Environment variable management
Create a .env file in the project root:
cp .env.example .envEdit .env and add your GitHub Personal Access Token:
GITHUB_TOKEN=ghp_your_actual_token_here- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Give it a descriptive name (e.g., "MCP GitHub Crawler")
- Select scopes:
- ✅
repo- Full control of private repositories - ✅
read:org- Read org and team membership
- ✅
- Click "Generate token"
- Copy the token immediately (you won't see it again!)
- Paste it in your
.envfile
python github_crawler_server.pyThis starts the server in stdio mode, which is useful for testing with MCP-compatible clients.
fastmcp run github_crawler_server.py:mcpfastmcp run github_crawler_server.py:mcp --transport http --port 8000The server will be available at http://localhost:8000/mcp
Run the test script to verify all tools are working:
python test_server.pyThis will test each tool with real GitHub API calls.
Search for repositories by query.
# Example: Search for FastMCP repositories
search_repositories(query="fastmcp language:python", sort="stars", order="desc", per_page=10)Get comprehensive details about a specific repository.
# Example: Get details for jlowin/fastmcp
get_repository_details(owner="jlowin", repo="fastmcp")List all repositories for a user or organization.
# Example: List all repos for a user
list_user_repositories(username="octocat", type="all", sort="updated")Browse files and directories in a repository.
# Example: List root directory contents
get_repository_contents(owner="jlowin", repo="fastmcp", path="")
# Example: Get a specific file
get_repository_contents(owner="jlowin", repo="fastmcp", path="README.md")Get the complete directory tree of a repository.
# Example: Get full structure
get_repository_structure(owner="jlowin", repo="fastmcp", branch="main")Get the README content in markdown format.
# Example: Read README
get_repository_readme(owner="jlowin", repo="fastmcp")List recent commits with details.
# Example: Get last 20 commits
list_repository_commits(owner="jlowin", repo="fastmcp", per_page=20)Analyze programming languages used.
# Example: Get language breakdown
get_repository_languages(owner="jlowin", repo="fastmcp")Browse repository issues.
# Example: List open issues
list_repository_issues(owner="jlowin", repo="fastmcp", state="open", per_page=10)Download and decode a specific file.
# Example: Get file content
get_file_content(owner="jlowin", repo="fastmcp", path="src/main.py")git init
git add .
git commit -m "Initial commit: GitHub Crawler MCP Server"
git remote add origin https://github.com/yourusername/github-crawler-mcp.git
git push -u origin main- Go to FastMCP Cloud
- Sign in with your GitHub account
- Click "Create New Project"
- Select your
github-crawler-mcprepository - Set the server entrypoint:
github_crawler_server.py:mcp - Add environment variable:
GITHUB_TOKENwith your token value - Click "Deploy"
Your server will be deployed and you'll get a URL like:
https://your-project.fastmcp.app/mcp
- Open ChatGPT
- Go to Settings → Custom Instructions or MCP Settings
- Add your FastMCP Cloud server URL
- Save and start using GitHub crawler tools in ChatGPT!
Once connected, you can ask ChatGPT questions like:
- "Search for popular Python web frameworks on GitHub"
- "Show me the README for the FastMCP repository"
- "What programming languages are used in the langchain repository?"
- "List the recent commits in the openai/openai-python repository"
- "Get me the structure of the react repository"
- "Show me open issues in the tensorflow/tensorflow repository"
| Authentication | Rate Limit |
|---|---|
| Without token | 60 requests/hour |
| With token | 5,000 requests/hour |
Recommendation: Always use a GitHub token for production use to ensure you have sufficient rate limits.
- Never commit your
.envfile to version control (it's in.gitignore) - When deploying to FastMCP Cloud, add
GITHUB_TOKENas a secure environment variable - Use tokens with minimal required scopes for security
- Rotate tokens periodically
- Your GitHub token is invalid or expired
- Generate a new token and update your
.envfile
- You've exceeded the rate limit
- Wait for the limit to reset (check
X-RateLimit-Resetheader) - If using without authentication, add a GitHub token
- Repository doesn't exist or is private (and you don't have access)
- Check the owner and repo names
- Ensure your token has access to private repos if needed
- Check your search query syntax
- Verify the repository/user exists
- Some queries may genuinely return no results
github-crawler-mcp/
├── github_crawler_server.py # Main MCP server
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── .env # Your config (not in git)
├── .gitignore # Git ignore rules
├── test_server.py # Test script
└── README.md # This file
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
MIT License - feel free to use this in your own projects!
Built with ❤️ using FastMCP