Repo Context

•

Empowers AI assistants with deep, searchable access to any Git repository through real symbol extraction, dependency graphs, and architecture analysis across multiple languages.

AI coding assistants often struggle with understanding large or unfamiliar codebases beyond the immediate file. Repo Context solves this by serving as a Model Context Protocol (MCP) server, indexing Git repositories to provide AI assistants like Claude Code, Cursor, and VS Code Copilot with structured, comprehensive access. It goes beyond simple text search, offering deep code understanding through symbol extraction, dependency graphing, and architecture analysis across 12+ programming languages, including optional integration with Joern CPG for advanced call and data flow tracking. This enables AI assistants to provide accurate answers, navigate codebases effectively, and analyze software architecture across single or multiple repositories from GitHub, GitLab, or local sources.

Key Features

01Built as an MCP server for direct AI assistant tool calls
02Indexes and searches across multiple repositories (GitHub, GitLab, local)
03Deep code understanding with symbol extraction for 12+ languages
040 GitHub stars
05Optional Joern CPG integration for advanced call graphs and data flow tracking
06Generates dependency graphs and performs architectural analysis (DSM, cycle detection)

Use Cases

01Analyze software architecture, detect cycles, and identify layers across an entire organization's repositories with AI assistance.
02Enable AI assistants to understand complex authentication flows and system architecture across various services.
03Quickly navigate and comprehend unfamiliar codebases with AI-powered insights into dependencies and structure.

repo-ctx

PyPI Python License

Give your AI assistant deep understanding of any codebase.

Your AI assistant can only help with code it can see. repo-ctx gives it searchable access to any Git repository — with real symbol extraction, dependency graphs, and architecture analysis across 12+ languages. Set up in one command.


The Problem

AI coding assistants are powerful — but blind. They only know what's in the current file or what you paste in. When you need help understanding a dependency, navigating an unfamiliar codebase, or analyzing architecture across repositories, you're on your own.

repo-ctx solves this. It indexes Git repositories and exposes them to AI assistants through the Model Context Protocol (MCP), giving tools like Claude Code, Cursor, and VS Code Copilot real, structured access to codebases.


What Makes repo-ctx Different

1. Built for AI Assistants

repo-ctx isn't a code browser you query manually. It's an MCP server — your AI assistant calls its tools directly when it needs to understand code.

You: "How does the authentication flow work in our API?"

Claude (using repo-ctx):
  → ctx-search "authentication" across 3 indexed repos
  → ctx-analyze auth_service.py → extracts 12 symbols, 4 dependencies
  → ctx-graph ./src/auth → maps the full dependency chain
  → Gives you a complete, accurate answer

2. Multi-Repo, Multi-Provider

Index everything in one place. GitHub, GitLab, and local repositories — search across all of them.

repo-ctx index ./my-project              # Local repo
repo-ctx index fastapi/fastapi           # GitHub
repo-ctx index my-company/backend        # GitLab
repo-ctx index --group my-org            # Entire GitHub org

Then your AI assistant can search, analyze, and cross-reference all of them simultaneously.

3. Deep Code Understanding

Not just text search — real structural analysis:

  • Symbol extraction — functions, classes, methods, interfaces across Python, Java, JavaScript, TypeScript, Kotlin, Go, Rust, C/C++, Ruby, PHP, C#, Bash
  • Dependency graphs — who calls what, import chains, coupling analysis
  • Architecture analysis — Design Structure Matrix, cycle detection, layer identification, complexity metrics
  • Joern CPG — optional deep analysis with call graphs, data flow tracking, and CPGQL queries

Quick Start

# Install
pip install repo-ctx

# Index a repository
repo-ctx index fastapi/fastapi

# Search it
repo-ctx search "middleware"

# Analyze code locally
repo-ctx analyze ./src --language python

MCP Setup

Add to your MCP configuration (~/.config/claude/mcp.json for Claude Code):

{
  "mcpServers": {
    "repo-ctx": {
      "command": "uvx",
      "args": ["repo-ctx", "-m"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}

Works immediately with local and public GitHub repos — no tokens required for those.

For private repos: set GITHUB_TOKEN or GITLAB_TOKEN + GITLAB_URL.

18 MCP Tools

Category Tools
Repository ctx-index, ctx-list, ctx-search, ctx-docs
Code Analysis ctx-analyze, ctx-symbol, ctx-symbols, ctx-graph
Architecture ctx-dsm, ctx-cycles, ctx-layers, ctx-architecture, ctx-metrics
Export ctx-llmstxt, ctx-dump
CPG (Joern) ctx-query, ctx-export, ctx-status

Full reference: MCP Tools Reference


Also Works As

CLI — standalone searching, indexing, and analysis from the terminal.

Python library — embed repo-ctx in your own tools and workflows.

from repo_ctx.client import RepoCtxClient

async with RepoCtxClient() as client:
    await client.index_repository("fastapi/fastapi", provider="github")
    results = await client.search("middleware")

Documentation


License

Apache 2.0 — see LICENSE.