Skip to main content
Glama

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.


Related MCP server: Grafyx

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.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides code intelligence for AI coding agents by indexing repositories into a hybrid knowledge graph, enabling agents to query dependencies, impact, and context through 28 MCP tools.
      4
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI coding assistants to understand codebase architecture in real time by parsing source code into a relationship graph and exposing call chains, dependencies, class hierarchies, and conventions via MCP tools.
      14
      4
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to perform hybrid semantic and lexical code search across multiple repositories, retrieve symbol definitions and call hierarchies, and manage repository relations through MCP tools.
      Apache 2.0