GitHub Code Search MCP Server
Provides tools for searching code across all of GitHub and reading file contents from any repository, with filters for repository, language, filename, path, and line ranges.
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 Code Search MCP Serversearch for 'rate limit' in repo 'octocat/Hello-World'"
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 Code Search MCP Server
基于官方 MCP Python SDK 的 GitHub 代码搜索服务器,可通过任何 MCP 客户端(Claude Code、Claude Desktop 等)搜索全 GitHub 的代码并读取任意文件内容。
功能
Tool | 说明 |
| 全 GitHub 代码搜索:关键词 + 任意仓库/语言/文件名/路径过滤,返回文件路径和匹配源码片段 |
| 读取任意仓库任意文件:支持分支/标签/commit 指定、按行范围读取(任意一行代码) |
Related MCP server: GitHub MCP Server
快速开始(Docker Compose)
cp .env.example .env
# 编辑 .env,填入你的 GITHUB_TOKEN
docker compose up --build -d
# 验证
docker compose ps
curl http://localhost:8000/mcp # 应返回 MCP endpoint 信息接入 AI 工具
MCP 服务器使用 Streamable HTTP 传输协议。任何支持 MCP 的客户端通过以下地址接入:
http://localhost:8000/mcp示例(Claude Code):
# 全局生效,所有项目可用
claude mcp add --scope user --transport http github-code-search http://localhost:8000/mcp
# 仅当前项目生效
claude mcp add --transport http github-code-search http://localhost:8000/mcp可用工具
工具 | 用途 |
| 全 GitHub 代码搜索, |
| 读取任意仓库任意文件, |
环境变量
变量 | 必填 | 说明 |
| 是 | GitHub 访问令牌(只需只读权限),code search API 必须认证 |
| 否 | 监听地址,默认 |
| 否 | 监听端口,默认 |
| 否 | 代理。由 compose 启动时从宿主 shell 环境自动透传( |
本地运行(非 Docker)
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
GITHUB_TOKEN=<你的 GitHub token> .venv/bin/python server.py说明
GitHub code search 只索引仓库的默认分支
读取大文件(>1 MiB)时自动回退到
raw.githubusercontent.com无
GITHUB_TOKEN时搜索会返回 401 错误提示
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
- -license-qualityAmaintenanceMCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.128,88689,405MIT
- Alicense-qualityDmaintenanceEnables GitHub API integration via MCP, allowing search, repository details, file contents, and issue management.570ISC
- Flicense-qualityDmaintenanceEnables managing GitHub repositories, files, and user information through MCP, with support for creating, updating, and deleting repository contents, as well as fetching user profiles.1
- Alicense-qualityDmaintenanceEnables AI-powered GitHub interactions including repository analysis, code search, PR reviews, and more through the MCP protocol.4MIT
Related MCP Connectors
GitHub Private MCP Pack — access private repos, org data via OAuth.
An MCP server that gives your AI access to the source code and docs of all public github repos
Scan any public GitHub MCP-server repo for security issues. 37 MCP-specific L1 rules, 8 languages.
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/WhiteElephant-abc/github-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server