Skip to content
Conduit

mcp server

github-code-research

πŸ” AI-powered GitHub code research with MCP - Search, map, and extract code with intelligence

ohadnisim/github-code-researchcommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

Before you start

  • uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "github-code-research": {
      "command": "uvx",
      "args": [
        "github-code-research"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 23, 2026

πŸ” GitHub Code Research MCP Server

Supercharge your GitHub code exploration with AI-powered search, repository mapping, and intelligent code extraction

Python 3.10+ MCP License: MIT Tests

A powerful Model Context Protocol (MCP) server that brings intelligent GitHub code research capabilities to Claude and other MCP-compatible AI assistants. Search millions of repositories, understand codebases with PageRank-based mapping, extract functions with AST precision, and check licensesβ€”all with automatic secret redaction.


✨ Features

πŸ” Intelligent Code Search

Search GitHub's vast codebase with natural language queries. Automatically filters, ranks, and redacts secrets from results.

πŸ—ΊοΈ Repository Mapping

Generate Aider-style repository maps using PageRank algorithm to identify the most important functions and classesβ€”reducing 100K+ tokens to just 2-3K.

πŸ“ Precise Function Extraction

Extract functions with tree-sitter AST parsing for pixel-perfect accuracy, including full documentation and context lines.

πŸ”’ License Safety Checker

Instantly verify if repositories are safe to use with automatic license detection and categorization (SAFE_TO_USE, VIRAL_LICENSE_WARNING, REVIEW_REQUIRED).

πŸ›‘οΈ Automatic Secret Redaction

14+ secret patterns detected and redacted automatically, including AWS keys, GitHub tokens, API keys, and more.

⚑ Performance Optimized

  • Multi-tier caching (1hr for search, 24hr for repo maps, 7 days for licenses)
  • Smart rate limiting (respects GitHub's 5000/hr and 30/min limits)
  • First query: 1-15 seconds | Cached: <100ms

πŸš€ Quick Start

Prerequisites

  • Python 3.10 or higher
  • GitHub Personal Access Token (Get one here)
  • MCP-compatible AI assistant (Claude Desktop, etc.)

Installation

# Clone the repository
git clone https://github.com/yourusername/github-code-research.git
cd github-code-research

# Install dependencies
pip install -e .

# Set your GitHub token
export GITHUB_TOKEN=ghp_your_token_here

Configuration

Add to your MCP client configuration file.

For Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "github-code-research": {
      "command": "/path/to/venv/bin/python3",
      "args": ["-m", "github_code_research"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

First Use

Restart your AI assistant and try:

"Search GitHub for authentication patterns in Python"
"Check if tensorflow/tensorflow is safe to use"
"Show me the repo map for django/django"

🎯 Use Cases

Learning New Frameworks

User: "I want to learn FastAPI"
β†’ Search for "fastapi route decorator examples"
β†’ Check license: MIT (SAFE_TO_USE βœ“)
β†’ Generate repo map showing key classes
β†’ Extract specific decorator implementations

Code Security Research

User: "Find secure authentication patterns"
β†’ Search for "jwt authentication python"
β†’ Secrets automatically redacted
β†’ License check on top results
β†’ Extract implementation details

Understanding Libraries

User: "How does requests library work?"
β†’ Generate repo map (448 symbols analyzed)
β†’ Top 20 most important components identified
β†’ Extract key functions like request()

πŸ› οΈ Available Tools

1. search_patterns

Search GitHub code with intelligent filtering and secret redaction.

Parameters:

  • query (required): Search query
  • language (optional): Filter by programming language
  • max_results (optional): Number of results (1-30, default: 10)

Example:

"Search for 'fastapi route decorator' in Python with 5 results"

2. check_license

Verify repository license and get safety categorization.

Parameters:

  • owner (required): Repository owner
  • repo (required): Repository name

Example:

"Check if django/django is safe to use"

Returns:

  • License type (MIT, Apache, GPL, etc.)
  • Safety level (SAFE_TO_USE, VIRAL_LICENSE_WARNING, REVIEW_REQUIRED)
  • Source (GitHub API or file detection)

3. get_repo_map

Generate repository map with PageRank-ranked symbols.

Parameters:

  • owner (required): Repository owner
  • repo (required): Repository name
  • max_symbols (optional): Maximum symbols to show (default: 50)

Example:

"Generate a repo map for fastapi/fastapi showing top 30 symbols"

4. extract_function

Extract specific functions with AST precision.

Parameters:

  • file_url (required): GitHub file URL
  • function_name (required): Function name to extract

Example:

"Extract the 'request' function from https://github.com/psf/requests/blob/main/src/requests/api.py"

πŸ—οΈ Architecture

github-code-research/
β”œβ”€β”€ src/github_code_research/
β”‚   β”œβ”€β”€ config/          # Configuration management
β”‚   β”œβ”€β”€ github/          # GitHub API client with rate limiting
β”‚   β”œβ”€β”€ tools/           # 4 MCP tools
β”‚   β”œβ”€β”€ parsers/         # Tree-sitter AST parsers
β”‚   β”‚   β”œβ”€β”€ python_parser.py
β”‚   β”‚   β”œβ”€β”€ javascript_parser.py
β”‚   β”‚   β”œβ”€β”€ typescript_parser.py
β”‚   β”‚   └── pagerank.py     # PageRank algorithm
β”‚   β”œβ”€β”€ security/        # Secret scanner (14+ patterns)
β”‚   └── utils/           # Cache, errors, logging
└── tests/               # Comprehensive test suite

Key Technologies

  • MCP SDK: Official Model Context Protocol implementation
  • tree-sitter: AST-based code parsing for Python, JavaScript, TypeScript
  • NetworkX: PageRank algorithm for symbol importance
  • Pydantic: Type-safe configuration and validation
  • requests: GitHub REST API integration with rate limiting

πŸ”’ Security Features

Automatic Secret Detection

The server scans all code before display and automatically redacts:

  • βœ… AWS Access Keys (AKIA...)
  • βœ… GitHub Personal Access Tokens (ghp_...)
  • βœ… API Keys (generic patterns)
  • βœ… Private Keys (PEM format)
  • βœ… JWT Tokens
  • βœ… Bearer Tokens
  • βœ… Slack Tokens
  • βœ… Stripe Keys
  • βœ… Google API Keys
  • ...and more

Format: [REDACTED (Secret Type)]

Token Security

  • GitHub token stored securely in config
  • Token never exposed in logs or outputs
  • Read-only operations only
  • Token validation on startup

πŸ“Š Performance

OperationFirst CallCachedCache TTL
Code Search2-6 sec<100ms1 hour
License Check1-2 sec<100ms7 days
Repo Map5-15 sec<100ms24 hours
Function Extract1-3 secN/ANone

Speed Improvement: 15-20x faster than manual GitHub browsing


πŸ§ͺ Testing

All tests passing: 9/9 βœ…

# Run tests
pip install -e ".[dev]"
pytest

# Run integration tests
export GITHUB_TOKEN=your_token
python3 test_integration.py

Test coverage:

  • βœ… Configuration loading
  • βœ… GitHub authentication
  • βœ… API client with rate limiting
  • βœ… Secret scanner (2 secrets detected in tests)
  • βœ… Tree-sitter parsers (448 symbols from real repo)
  • βœ… All 4 MCP tools
  • βœ… License detection
  • βœ… Function extraction
  • βœ… Repository mapping

πŸ“ˆ Rate Limits

The server respects GitHub's rate limits:

  • General API: 5000 requests/hour
  • Code Search: 30 requests/minute

Automatic handling:

  • βœ… Persistent rate limit tracking
  • βœ… Updates from response headers
  • βœ… Prevents 429 errors
  • βœ… Aggressive caching to minimize API calls

🌍 Supported Languages

Tree-sitter parsing for:

  • Python (.py)
  • JavaScript (.js, .jsx, .mjs, .cjs)
  • TypeScript (.ts, .tsx, .mts, .cts)

Regex fallback for unsupported languages.


πŸ“š Documentation


🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Add tests for new features
  4. Ensure all tests pass (pytest)
  5. Submit a pull request

Adding Language Support

To add support for a new language:

  1. Create a new parser in src/github_code_research/parsers/
  2. Extend BaseParser class
  3. Implement parse() and extract_signatures() methods
  4. Add to ParserFactory.LANGUAGE_MAP
  5. Add tests

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments


πŸ“ž Support


πŸŽ‰ Success Stories

"Reduced my GitHub research time from 1 hour to 3 minutes!"

"The automatic secret redaction saved me from accidentally exposing an API key."

"Repository maps helped me understand Django's architecture in minutes."


πŸš€ Roadmap

  • Support for more languages (Go, Rust, Java)
  • GraphQL API support for better performance
  • Dependency graph visualization
  • Code quality metrics
  • Diff analysis between commits
  • PR and issue analysis tools
  • Parallel file parsing
  • Redis cache backend option

↑↓ navigate openesc close