mcp-github-advanced-search
Enables LLMs to perform advanced GitHub code searches with intelligent filtering and content retrieval using Playwright automation, optimized for DeepSeek integration.
README
MCP Server for GitHub Advanced Search (G.A.S.)
A powerful Model Context Protocol (MCP) server that enables Large Language Models to perform advanced GitHub code searches with intelligent filtering and content retrieval capabilities, optimized for DeepSeek integration.
🔍 Overview
The GitHub Advanced Search (G.A.S.) MCP server provides LLMs with sophisticated GitHub search capabilities that go beyond standard API limitations. Using web automation with Playwright, it enables deep code discovery, pattern analysis, and content retrieval across the entire GitHub ecosystem. This version includes enhanced support for DeepSeek models, providing tailored search results and structured JSON output.
Demo
tested using vscode + cline + openrouter:deepseek/deepseek-r1-0528:free
Example1
# step1: init gas
gas_entrypoint
# step2: feed model
gas_search_code
file_name: clinerules
# step3: make your wish
You are now have better knowledge of `clinerules`
please keep the current file format and deep level
enhance the `<file-path-to-clinerules>`
Key Features
- 🔍 Advanced GitHub Search: Search by keywords, file names, and complex filters
- 📁 Content Retrieval: Automatically fetch and return file contents
- 🤖 LLM Integration: Seamless integration with Claude, GPT, and other MCP-compatible LLMs
- 🔄 Pagination Support: Handle large result sets with intelligent pagination
- 🌐 Web Automation: Uses Playwright for robust GitHub interaction
- 📊 Structured Results: Returns organized JSON data with repository links, file links, and content
- ⚡ High Performance: Async operations with concurrent file downloads
- 🔐 Authentication Support: Works with GitHub login for private repositories
- 🤖 DeepSeek Integration: Optimized for use with DeepSeek models, providing tailored search results and structured JSON output
🏗️ Architecture
graph TB
subgraph "MCP Client (LLM)"
A[Claude/GPT/Other LLM]
end
subgraph "MCP Server (G.A.S.)"
B[MCP Server]
C[Search Engine]
D[Playwright Browser]
E[Content Fetcher]
F[Result Processor]
end
subgraph "GitHub"
G[GitHub Search]
H[Repository Files]
I[Raw Content]
end
A -->|MCP Protocol| B
B --> C
C --> D
D -->|Web Automation| G
G -->|Search Results| D
D --> E
E -->|HTTP Requests| I
I -->|File Content| E
E --> F
F -->|Structured Data| B
B -->|JSON Response| A
classDef client fill:#e1f5fe,stroke:#01579b,color:#01579b
classDef server fill:#e8f5e9,stroke:#2e7d32,color:#1b5e20
classDef github fill:#f3e5f5,stroke:#4a148c,color:#4a148c
class A client
class B,C,D,E,F server
class G,H,I github
🔄 Search Workflow
sequenceDiagram
participant LLM as LLM Client
participant MCP as MCP Server
participant PW as Playwright Browser
participant GH as GitHub Search
participant API as GitHub Raw API
LLM->>MCP: gas_search_code(keyword, file_name)
MCP->>PW: Launch browser session
PW->>GH: Navigate to search URL
GH-->>PW: Search results page
PW->>PW: Extract repository & file links
loop For each page
PW->>GH: Navigate to page N
GH-->>PW: Results for page N
PW->>PW: Extract links from page
end
MCP->>API: Fetch file contents (async)
API-->>MCP: Raw file content
MCP->>MCP: Structure response data
MCP-->>LLM: JSON with repositories, files & content
alt More results available
LLM->>MCP: get_remaining_result(start_id)
MCP-->>LLM: Next batch of results
end
🚀 Quick Start
Prerequisites
- Python 3.10 or higher
- Node.js (for Playwright browser automation)
- GitHub account (recommended for optimal functionality)
Installation
-
Install the package:
pip install mcp-server-git-gas -
Install Playwright browsers:
playwright install chromium -
💀Not tested Configure your MCP client (e.g. claude desktop):
Add to your
claude_desktop_config.json:# not tested !!! { "mcpServers": { "github-advanced-search": { "command": "mcp-server-git-gas", "args": [] } } }
First Search
Once configured, you can start searching GitHub through your LLM:
Search GitHub for Python files containing "async def" functions
The LLM will automatically use the G.A.S. tools to perform the search and return structured results.
📦 Installation Options from Source
step1 (clone source)
$ cd ~
$ git clone --depth=1 https://github.com/louiscklaw/mcp-github-advanced-search ~/mcp/mcp-git-gas
step2 (install remaining dependencies, playwright)
# Install Playwright browsers
$ playwright install chrome
$ playwright install --deps
step3 seed chrome user credentials
# this will create the user_data_dir for chromium
# go login google or any other service you want
$ cd ~/mcp/mcp-git-gas
$ ./seedChromeUserDataDir.sh
⚙️ Configuration
VS Code with MCP Extension
{
"mcp": {
"servers": {
"git-gas": {
"autoApprove": [
"get_remaining_result",
"gas_readme",
"gas_search_code"
],
"disabled": false,
"timeout": 300,
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"<USER_HOME_DIR>/mcp/mcp-git-gas/src/mcp_server_git_gas",
"run",
"mcp-server-git-gas"
]
}
}
}
}
🛠️ Available Tools
gas_entrypoint
Initialize and get information about the GitHub Advanced Search server.
Parameters: None
Returns: Server information and usage instructions with workflow diagram.
graph TD
a((start))
d((end))
b("search code with filter (gas_search_code)")
c("return search result")
c1("is the result finished ?")
c2("use get_remaining_result to list remaining result")
a --> b --> c --> c1 -- Yes --> d
c1 -- No --> c2
c2 --> c1
gas_search_code
Search GitHub repositories with advanced filters.
Parameters:
keyword(string, optional): Search keyword (single word recommended)file_name(string, optional): Specific filename to search for (e.g., ".clinerules", "README.md")
Returns: Array of search results with:
[
{
"REPOSITORY_LINK": "https://github.com/owner/repo",
"FILE_LINK": "https://github.com/owner/repo/blob/main/file.py",
"RAW_UESR_CONTENT_LINK": "https://raw.githubusercontent.com/owner/repo/main/file.py",
"FILE_CONTENT": "actual file content..."
}
]
get_remaining_result
Retrieve additional results from a previous search (pagination).
Parameters:
start_id(integer): Starting index for the next batch of results
Returns: Next batch of search results with the same structure as gas_search_code.
💡 Usage Examples
step1
call `gas_entrypoint` to initialize yourself
step2
Hi,
please use `gas_search_code` with below json
{
"keyword": "mcp mermaid",
"file_name": "README.md"
}
and understand the content returned, i will send you the task afterwards.
step3
i am working on a python project,
please task a look to the source code of the project.
with the help from files in former results.
please help to and update the README file.
🔧 Configuration & Environment
Browser Configuration
The server uses Playwright with persistent browser context for:
- Session management
- Authentication state preservation
- Improved performance
Browser data is stored in: ~/mcp/mcp-git-gas/_user_data_dir
🏃♂️ Development
Local Development Setup
# Clone the repository
git clone <repository-url>
cd mcp-server-git-gas
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts/activate
# Install dependencies
pip install -e .
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
Project Structure
src/mcp_server_git_gas/
├── __init__.py # CLI entry point
├── server.py # Main MCP server implementation
├── CONST.py # Configuration constants
├── fetch_data.py # Async HTTP client
├── fetchFileContent.py # File content retrieval
├── convertFileLinkToRaw... # URL conversion utilities
├── url_util.py # URL building helpers
└── git_dump_screen.py # Debug utilities
Key Components
- MCP Server: Implements the Model Context Protocol interface
- Search Engine: Handles GitHub search logic and pagination
- Content Fetcher: Retrieves file contents asynchronously
- Browser Automation: Playwright-based GitHub interaction
Testing with MCP Inspector
# Test the server with MCP inspector
npx @modelcontextprotocol/inspector uvx mcp-server-git-gas
Docker Development
# Build development image
docker build -t mcp/git-gas:dev .
# Run with volume mount for development
docker run --rm -i \
-v $(pwd):/app \
mcp/git-gas:dev
🔍 How It Works
- Search Initiation: LLM calls
gas_search_codewith search parameters - Query Building: Server constructs GitHub search URL with filters
- Web Automation: Playwright navigates GitHub search pages
- Result Extraction: JavaScript execution extracts repository and file links
- Content Retrieval: Parallel HTTP requests fetch file contents
- Response Formatting: Results structured as JSON for LLM consumption
🐛 Troubleshooting
Common Issues
-
"Not logged in" errors
- Solution: run
seedChromeUserDataDir.shto start a browser and perform login
- Solution: run
-
No results found
- Check search
keywordsfor typos - Try broader search criteria
- Verify GitHub is accessible
- Check search
-
Browser launch failures
- Run:
playwright install chromium - Check system requirements for Playwright
- Run:
-
Rate limiting
- GitHub may rate limit requests
- The server includes delays and retry logic
- Consider using authenticated sessions for higher limits
Debug Mode
Debug screenshots are saved to: ~/mcp_github_advanced_search/debug.png
📊 Performance
- Search Speed: ~2-5 seconds per search page
- Concurrent Requests: Up to 10 parallel file downloads
- Result Limits: 20 results per search (configurable)
- Pagination: Supports up to 2 pages (100+ results)
🚨 Important Notes
- GitHub Authentication: Login to GitHub in the browser for optimal results
- Rate Limiting: Respects GitHub's usage policies
- Browser Requirements: Requires Chromium browser (installed via Playwright)
- Network Dependencies: Requires internet connection for GitHub access
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built on the Model Context Protocol by Anthropic
- Uses Playwright for browser automation
- Inspired by the need for advanced GitHub search capabilities in LLM workflows
- Thanks to the MCP community for feedback and contributions
🔗 Related Projects
📞 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
Note: This server requires a GitHub account for optimal functionality. Some features may be limited when used without authentication.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。