Skip to main content
Glama
louiscklaw

mcp-github-advanced-search

by louiscklaw

MCP Server for GitHub Advanced Search (G.A.S.)

Python Version License: MIT MCP

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.

Related MCP server: GitHub Search MCP Server

Demo

tested using vscode + cline + openrouter:deepseek/deepseek-r1-0528:free

youtube link to demo

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

  1. Install the package:

    pip install mcp-server-git-gas
  2. Install Playwright browsers:

    playwright install chromium
  3. 💀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": []
        }
      }
    }

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

  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

  6. Response Formatting: Results structured as JSON for LLM consumption

🐛 Troubleshooting

Common Issues

  1. "Not logged in" errors

    • Solution: run seedChromeUserDataDir.sh to start a browser and perform login

  2. No results found

    • Check search keywords for typos

    • Try broader search criteria

    • Verify GitHub is accessible

  3. Browser launch failures

    • Run: playwright install chromium

    • Check system requirements for Playwright

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

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Make your changes

  4. Add tests for new functionality

  5. Run the test suite

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

📞 Support


Note: This server requires a GitHub account for optimal functionality. Some features may be limited when used without authentication.

Available Tools

4 tools
gas_entrypointB

initialize git-gas, no parameters required

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. 'initialize' implies a state-changing operation, but the description does not mention side effects, idempotency, permissions, or expected output. The only disclosed constraint, 'no parameters required', merely restates the schema and adds no behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence with the primary action front-loaded before the parametric note. It is appropriately sized for a parameterless tool and contains no redundant fluff, though 'no parameters required' is already evident from the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the tool's simplicity, the description omits important contextual details: what initialization produces, whether it must be run before other commands, and what a successful call returns. There is no output schema to cover return values, so the description should have supplied this context but does not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema already documents an empty properties object, so the baseline of 4 applies. The phrase 'no parameters required' adds no new meaning but is consistent with the schema. There is no parameter coverage gap to compensate for.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action, 'initialize git-gas', with a clear verb and resource. It distinguishes the tool from its siblings (gas_search_code, get_remaining_result, git_helloworld) by indicating a setup operation rather than a search or retrieval. It lacks detail on what 'initialize' entails, but the core purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, no prerequisites, and no indication that initialization is required before using sibling tools. 'no parameters required' addresses invocation constraints but not usage context. An agent has to infer that this is a setup step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

gas_search_codeA

SEARCH_CODE_EXPLAIN

INTRODUCTION

This is a utilities that search github with advanced filters (e.g. keyword)

the result is in json format with below fields"

[
    {
        "REPOSITORY_LINK": "<repository-found>",
        "FILE_LINK": "<file-found>",
        "RAW_USER_CONTENT_LINK": "<download-link-to-the-file>",
        "FILE_CONTENT": "<downloaded-content>"
    },
    {...},
    {...},
    {...},
    {"next_instructions_md": "<contains-the-instruction-to-get-the-remaining-result>"}
]

when you receive this, please ensure you follow the next_instructions_md to collect all results.

You can use memory, sequential-thinking, structured-argumentation to help solving problems.

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordNothe keyword user interested, e.g. `helloworld()` * Please limit the keyword to one single word only (e.g. `helloworld` and not `hello word`) default('')
file_nameNothe file name user interested e.g. `.clinerules` default('')

TDQS

A3.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are absent, so the description carries the full behavioral burden. It discloses the exact JSON output fields, the presence of next_instructions_md, and the need to follow it for remaining results. This is meaningful behavioral detail, even though auth and rate limits are not mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is cluttered with headings, a large JSON example, and an unrelated suggestion to use memory/sequential-thinking/structured-argumentation. It is structured but not front-loaded and contains non-essential content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description usefully provides the response format and next-step instructions. However, it does not explain how gas_search_code relates to sibling tools gas_entrypoint and get_remaining_result, nor does it mention error or edge-case behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with keyword and file_name already described with examples and constraints. The description adds no additional parameter semantics beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool searches GitHub with filters (keyword, file_name) and specifies the JSON response shape. It is clear about verb and resource, but it does not explicitly differentiate itself from siblings like gas_entrypoint or get_remaining_result.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through 'search github with advanced filters' and instructs the agent to follow next_instructions_md to collect all results. However, it lacks explicit guidance on when to prefer this tool over siblings or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_remaining_resultA

GET_REMAINING_RESULT

INTRODUCTION

This is a tools to get the remaining data searched by gas_search_code. the result is in json format with below fields.

[
    {
        "REPOSITORY_LINK": "<repository-found>",
        "FILE_LINK": "<file-found>",
        "RAW_USER_CONTENT_LINK": "<download-link-to-the-file>",
        "FILE_CONTENT": "<downloaded-content>"
    },
    {...},
    {...},
    {...},
    {"next_instructions_md": "<contains-the-instruction-to-get-the-remaining-result>"}
]

When you receive this, please ensure you follow the next_instructions_md to collect all results.

You can also use memory, sequential-thinking, structured-argumentation to help solving problems.

ParametersJSON Schema
NameRequiredDescriptionDefault
start_idNostart pointer for return the remaining result default('0')0

TDQS

A3.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the transparency burden and does a good job by specifying the exact JSON result shape, the fields returned, and the role of next_instructions_md in chaining further calls. It does not mention failure modes or rate limits, but for a read-style continuation tool this is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The JSON example is useful and the structure is readable, but the description includes minor fluff and a typo ('This is a tools'), and the closing sentence about memory/sequential-thinking is not directly relevant to tool invocation. It is adequate but not tightly edited.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output format is described in detail, compensating for the missing output schema and making return values predictable. However, the description leaves the pagination termination condition and the relationship between start_id and next_instructions_md implicit, so an agent may not know exactly when to stop or what value to pass.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already documents start_id as a 'start pointer' with a default of 0 and has 100% description coverage, so the description does not need to restate it. The description adds context about remaining data and next_instructions_md but not concrete guidance on how to derive or increment start_id.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool gets 'remaining data' from a prior gas_search_code search, naming the source tool and implying a continuation role. It does not explicitly contrast sibling tools, but 'remaining data searched by' is specific enough to distinguish it from the initial search tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool should be used after gas_search_code to collect remaining results, and instructs the agent to follow next_instructions_md. However, it never gives an explicit when-to-use versus when-not-to-use rule nor names an alternative tool, leaving the pagination workflow to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

git_helloworldD

my helloworld call

ParametersJSON Schema
NameRequiredDescriptionDefault
test_inputYes

TDQS

D1/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations and a description that reveals nothing about side effects, permissions, return values, or any behavioral traits, an agent is completely blind to what happens when this tool is invoked. The description adds zero value beyond the tool name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While short, this is under-specification rather than conciseness. The sentence 'my helloworld call' carries no operational information and does not earn the little space it occupies.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with a required parameter and no output schema or annotations, the description should compensate. It provides nothing, making the tool unusable for an agent without external knowledge.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one required parameter test_input with no description, and schema description coverage is 0%. The description does not explain what test_input means, its format, or its purpose, leaving the agent entirely unguided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'my helloworld call' is essentially a tautology of the tool name git_helloworld. It provides no specific verb, resource, or scope, and gives an agent no way to understand what the tool actually does or how it differs from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool vs. alternatives. Sibling tools like gas_entrypoint and gas_search_code exist, but there is no mention of them or any conditions for selecting this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.6.2
    • First observedgas_entrypoint
    • First observedgas_search_code
    • First observedget_remaining_result
    • First observedgit_helloworld

TDQS

C2.2/5.0

Scored across 4 tools

Disambiguation2/5

The core tools gas_search_code and get_remaining_result are clearly paired, but git_helloworld is a placeholder and gas_entrypoint's purpose relative to searching is vague. An agent could waste calls trying to determine which tool actually serves the search workflow.

Naming Consistency2/5

Names mix prefixes like git_ and gas_ with a verb-first name like get_remaining_result, and gas_entrypoint does not follow the same pattern as gas_search_code. git_helloworld also feels unrelated to the domain, making the naming set inconsistent.

Tool Count3/5

Four tools is a reasonable count, but one is a hello-world stub and another is an unclear initializer, leaving only two tools that actually support the advanced-search purpose. The total count is acceptable, but the composition is weak.

Completeness3/5

Search plus pagination covers the basic GitHub search and result-retrieval workflow, which is good. However, the gas_entrypoint setup step is unexplained and the search surface seems limited to keyword matching, leaving minor gaps around options and workflow clarity.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables intelligent web scraping through a browser automation tool that can search Google, navigate to webpages, and extract content from various websites including GitHub, Stack Overflow, and documentation sites.
    1
    -
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables Google search automation and web content extraction using Playwright. Performs Google searches and fetches main content from web pages, returning structured results in JSON format.
    31 npm
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables powerful code search across millions of public GitHub repositories using grep.app API, with capabilities to discover code examples, retrieve specific files, and batch fetch multiple files for learning from open source projects.
    75
    -