MCP Client for GitHub Advanced Search (mcp-git-gas in short)

Link to repository

https://github.com/louiscklaw/mcp-github-advanced-search

A powerful Model Context Protocol (MCP) server that enables LLM to perform advanced GitHub code searches with filtering and content retrieval capabilities, optimized for DeepSeek integration.

πŸ” Overview

The GitHub Advanced Search (G.A.S.) MCP client 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

youtube link to demo

Example workflow

#prompt

# step1: init gas
gas_init

# step2: feed context
gas_search_code
file_name: clinerules

# step3: go ahead with your prompt
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

πŸ—οΈ Architecture

under heavy development

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 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->>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

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

step4 depends, add below configuration to your agent

βš™οΈ 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_init

caution: under heavy development

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 --> c

gas_search_code

caution: under heavy development

Search GitHub repositories with advanced filters.

Parameters:

Returns: Array of search results with: T.B.A.

[
  {
    "REPOSITORY_LINK": "https://github.com/owner/repo",
    "FILE_LINK": "https://github.com/owner/repo/blob/main/file.py",
    "RAW_USER_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:

Returns: Next batch of search results with the same structure as gas_search_code.

πŸ’‘ Usage Examples

step1

# prompt

gas_init

step2

# prompt

Hi,

please use `gas_search_code` with below json

{
  "keyword": "mermaid",
  "file_name": "README.md"
}

and understand the content returned, i will send you the task afterwards.

step3

# prompt

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.md` file.

βš™οΈ Configuration & Environment

Browser Configuration

The server uses Playwright with persistent browser context for:

Browser data is stored in: <USER_HOME>/mcp/mcp-git-gas/_user_data_dir

🚧 Development

Local Development Setup

# Clone the repository
git clone <repository-url>
cd mcp-server-git-gas

# Install dependencies
pip install -e .

# start mcp debugging tools
npx @modelcontextprotocol/inspector uvx mcp-server-git-gas

Project Structure

src/mcp_server_git_gas       # source code folder
  - __main__.py              # entry point
docs                         # documentation folder
tests                        # tests folder

Key Components

Testing with MCP Inspector

# Test the server with MCP inspector
npx @modelcontextprotocol/inspector uvx mcp-server-git-gas

πŸ‹ Docker Development (NOT IMPLEMENTED)

it supposed to be able to handle the github user a/c within docker for better security

# 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

  1. Search Initiation: LLM calls gas_search_code with search parameters
  2. Query Building: Server constructs GitHub search URL with filters
  3. Web Automation: Playwright navigates GitHub search pages
  4. Result Extraction: JavaScript execution extracts repository and file links
  5. Content Retrieval: Parallel HTTP requests fetch file contents

updated at: 2025-Jul-18

louis portfolio