Enables searching and exploring GitHub repositories with tools for cloning repositories, searching code with grep and regex, displaying directory structures, reading file contents with line range support, and extracting code outlines showing classes and functions.
GitHub Search MCP Server
A Model Context Protocol (MCP) server for searching and exploring GitHub repositories. Compatible with OpenAI's ChatGPT and Responses API.
Features
5 MCP Tools with
readOnlyHintannotations:clone_repository- Clone repositories from a whitelisted GitHub usersearch_code- Fast grep-based code search with regex supportget_tree- Display repository directory structureread_file- Read file contents with line range supportget_outline- Extract code structure (classes, functions, methods)
No Authentication Required - Server handles GitHub PAT internally
Streamable HTTP Transport - Compatible with OpenAI's MCP integration
MCP Protocol 2025-06-18 - Latest specification compliance
Quick Start
1. Install Dependencies
2. Configure Environment
3. Run the Server
The server will start on http://localhost:8000.
Docker
API Endpoints
Endpoint | Method | Description |
| GET | Server info and available endpoints |
| POST | MCP protocol endpoint (JSON-RPC) |
| GET | Health check |
| GET | Server capabilities |
MCP Tools
clone_repository
Clone a GitHub repository from the whitelisted user.
search_code
Search for code patterns using grep.
get_tree
Display repository directory tree.
read_file
Read file contents with optional line ranges.
get_outline
Get code outline showing classes and functions.
Connecting to ChatGPT
Deploy the server to a public URL (e.g., Railway, Render, or AWS)
In ChatGPT, go to Settings > Connectors > Add Connector
Enter your server URL (e.g.,
https://your-server.com/mcp)Select "No authentication required"
Security
Whitelisted User: Only repositories from the configured
ALLOWED_USERNAMEcan be clonedPath Traversal Prevention: All file paths are validated
No Secrets in Responses: GitHub PAT is server-side only
Environment Variables
Variable | Description | Default |
| GitHub Personal Access Token | (empty) |
| Server host |
|
| Server port |
|
| Path for cloned repos |
|
| Whitelisted GitHub username |
|
License
MIT