Diffcontext logo

Diffcontext

by trakshan-mishra

Compiles focused Python code context for coding agents from dependency analysis, changes, and token budgets.

Install Diffcontext

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "trakshan-mishra-diffcontext": {
      "command": "uvx",
      "args": [
        "diffcontext"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

trakshan-mishra/Diffcontext parses Python repositories into dependency graphs and compiles the functions relevant to a proposed change. It accepts a git reference, branch, diff, or function target, then combines graph relationships, text retrieval, and file signals within a token limit. The output includes a disclosure header describing omitted context. Use it when an agent needs more surrounding code than a single function but cannot fit an entire repository into its prompt.

Use cases

  • Compile focused context for an agent changing a Python function
  • Retrieve callers, callees, subclasses, and tests around a git change
  • Fit repository context to a fixed token budget
  • Evaluate retrieval quality against a repository's commit history

Key features

  • Python dependency-graph indexing
  • Hybrid graph, BM25, and file retrieval
  • Token-budgeted context compilation
  • Git-history retrieval verification
  • Optional bug-report retrieval bias
  • MCP support for coding clients

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

7/7 checks healthy over the last 45d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 7d ago via OSV.dev · diffcontext (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars4Stargazers on the source repository.
Last commit23d agoMost recent push to the default branch.

How Diffcontext works

What trakshan-mishra/Diffcontext does

trakshan-mishra/Diffcontext is a context compiler for coding agents working against Python repositories. It identifies code related to a change rather than asking an agent to consume the whole project. Depending on the supplied target, the workflow can include callers, callees, overriding subclasses, tests, and other retrieved functions.

The result is formatted as model-ready context and constrained by a requested token budget. A metadata header records what was excluded, so the receiving agent can distinguish unavailable context from code that was not relevant to the selection. The project selects context; it does not generate or modify source code.

How it works

The repository is indexed into a dependency graph. A change can be represented by a git diff, a branch or reference, or a function location such as a file-and-symbol target. Retrieval then combines graph relationships with BM25 text matching and file-level signals. The selected candidates are ranked and packed using limits such as top_k and max_tokens.

A bug report or other issue text can optionally influence retrieval. The verify workflow uses a repository's git history to create co-change cases, evaluates whether related functions are found, and reports NULL RESULT when the requested retrieval does not fit. This provides a way to test suitability on the target repository instead of relying only on published measurements.

Setup and configuration

Install the base package with pip install diffcontext. The package requires Python 3.9 or newer and has no runtime dependencies. Add the MCP extra with pip install "diffcontext[mcp]" when connecting the workflow to Claude Code, Cursor, or Windsurf. The repository also supports editable installation from a local clone.

A typical command sequence indexes a project, compiles context from a recent reference, and evaluates retrieval from history:

bash
diffcontext index /path/to/project
diffcontext compile --ref HEAD~1 --max-tokens 8000
diffcontext verify --from-history 20 --calibrate

The repository's MCP documentation contains the server configuration details.

Tools and capabilities

The trakshan-mishra/Diffcontext workflow provides these documented operations:

  • Index a repository and maintain an incremental index.
  • Analyze impact from function targets such as ./src/auth.py:validate_jwt.
  • Compile selected context with token and result-count limits.
  • Verify retrieval against cases mined from git history.
  • Produce structured output and use a pluggable tokenizer through the library API.

The Python API exposes index_repository, analyze_impact, and compile. The command-line interface covers indexing, compilation, and verification. Python is fully supported.

Limitations and notes

trakshan-mishra/Diffcontext is not a precision-first selector: at the default top-k, many retrieved symbols may be supporting context rather than exact co-change partners. The gap cutoff can reduce the amount selected at a recall cost. Static analysis can miss thematic relationships without calls, conceptual links across subsystems, and dynamic dispatch. The documentation recommends checking with grep when a result reports no callers.

Published ContextBench results are qualified by oracle localization and a strong Django concentration, so they should not be treated as end-to-end issue-solving results for every codebase. The repository's own verification command is the appropriate way to assess retrieval behavior on a particular project.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Diffcontext

trakshan-mishra/Diffcontext is an MCP server that connects coding agents to indexed Python repositories and git history. Its main capabilities are repository indexing, change-focused context compilation, and retrieval verification. It selects related functions such as callers, callees, subclasses, and tests, then fits the result to a specified token budget.

Install it with `pip install "diffcontext[mcp]"`. The MCP extra provides the integration needed for Claude Code, Cursor, or Windsurf, while the base package is available with `pip install diffcontext`.

Yes, trakshan-mishra/Diffcontext documents Cursor as an MCP integration target. Install the package with the `mcp` extra, then follow the repository's MCP configuration documentation.

Python is fully supported. TypeScript and JavaScript using ESM have prototype support with recall that varies by code style, while JavaScript using CommonJS is marked unsupported. The documented analysis, benchmarks, and primary workflow focus on Python repositories.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDiffcontext AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/trakshan-mishra-diffcontext?style=directory)](https://allmcps.com/mcp/trakshan-mishra-diffcontext)
HTML Embed
<a href="https://allmcps.com/mcp/trakshan-mishra-diffcontext"><img src="https://allmcps.com/api/badge/trakshan-mishra-diffcontext?style=directory" alt="Diffcontext on AllMCPs" /></a>