GitHub Code Explorer using Model Context Protocol
An example to demonstrate how to build and run an MCP server
Overview
GitHub File Search is a web application that allows users to search for code across GitHub repositories and view file contents. It implements a Model Context Protocol for standardized function calling between client and server.
To use GitHub File Search, clone the repository, install dependencies, set up a GitHub API token, start the server, and navigate to the application in your browser. Enter a search query to find code across repositories.
- Search for code across public GitHub repositories using GitHub's search API - View file contents directly in the browser - Simple, responsive, and intuitive user interface - Secure implementation with proper error handling - Customizable search parameters for targeted results
- Finding specific functions or code snippets in large repositories.
- Browsing file contents of public GitHub projects for learning purposes.
- Conducting code reviews by searching for specific implementations across multiple repositories.
Add to your AI client
Use these steps to connect GitHub Code Explorer using Model Context Protocol in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"github-file-search-mcp-anupj": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github-file-search-mcp-anupj"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"github-file-search-mcp-anupj": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github-file-search-mcp-anupj"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"github-file-search-mcp-anupj": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github-file-search-mcp-anupj"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"github-file-search-mcp-anupj": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github-file-search-mcp-anupj"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"github-file-search-mcp-anupj": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github-file-search-mcp-anupj"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"github-file-search-mcp-anupj": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-github-file-search-mcp-anupj"
]
}
}
}FAQ
Can I search for private repositories?
Yes, if you provide a GitHub API token with the appropriate scopes.
Is there a limit to the number of search results?
Yes, the default is 30 results per page, but you can customize this.
How do I set up the GitHub API token?
You can set it as an environment variable to avoid rate limits.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":3820,"uuid":"82f6565a-6565-4b1c-bd0a-93ab98bec944","name":"github-file-search-mcp-","title":"GitHub Code Explorer using Model Context Protocol","description":"An example to demonstrate how to build and run an MCP server","avatar_url":"https://avatars.githubusercontent.com/u/177374?v=4","created_at":"2025-03-21T20:41:01.241Z","updated_at":"2025-03-21T20:56:35.169Z","status":"created","author_name":"anupj","author_avatar_url":"https://avatars.githubusercontent.com/u/177374?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/anupj/github-file-search-mcp-","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"0\",\"license\":\"\",\"language\":\"JavaScript\",\"is_official\":false,\"latest_commit_time\":\"2025-03-22 12:46:03\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]