Skip to main content

Local repository intelligence for coding agents

Project description

RepoCtx

Local repository intelligence for coding agents.

What It Does

repoctx inspects a local repository and returns a compact task context pack:

  • relevant docs and agent guidance files
  • relevant source files
  • likely related tests
  • nearby graph neighbors from local imports
  • a readable markdown pack plus structured JSON

Installation

Install the published package from PyPI:

python3 -m pip install repoctx-mcp

The installed CLI command remains repoctx.

Install MCP support from PyPI when you want to run the MCP server:

python3 -m pip install "repoctx-mcp[mcp]"

Install the package from the standalone repository root:

python3 -m pip install -e .

This installs the core CLI without MCP server support.

Install MCP support when you want to run the MCP server:

python3 -m pip install -e ".[mcp]"

Install development dependencies for tests, including the MCP-related test coverage:

python3 -m pip install -e ".[dev]"

CLI

Run the CLI against any local repository by passing its path with --repo:

repoctx "add retry jitter to webhook delivery" --repo /path/to/target-repo --format markdown

The module entry point stays available too:

python3 -m repoctx "Sync local env with Vercel" --repo /path/to/target-repo --format json

MCP Server

Install the MCP extra first, then start the MCP server and point it at the repository you want to inspect:

python3 -m pip install -e ".[mcp]"
python3 -m repoctx.mcp_server --repo /path/to/target-repo

The server exposes get_task_context(task: string).

Telemetry

repoctx writes local JSONL telemetry to ~/.repoctx/telemetry by default. CLI and MCP usage record repoctx_invocation events automatically. The default telemetry payload stores hashed free-form task text and hashed repo identifiers. CLI runs can also preserve explicit experiment keys such as session_id, task_id, and variant; MCP runs currently generate those identifiers automatically.

Use the CLI flags below to keep paired experiments aligned across control and treatment runs:

repoctx "add retry jitter to webhook delivery" \
  --repo /path/to/target-repo \
  --format json \
  --session-id bench-001 \
  --task-id task-001 \
  --variant repoctx

External experiment harnesses can record downstream agent costs with the Python helper:

from pathlib import Path

from repoctx.telemetry import record_agent_run

record_agent_run(
    session_id="bench-001",
    task_id="task-001",
    variant="control",
    surface="cli",
    query="add retry jitter to webhook delivery",
    repo_root=Path("/path/to/target-repo"),
    runner="cursor-agent",
    success=True,
    completion_status="completed",
    agent_duration_ms=18420,
    tool_calls=6,
    prompt_tokens=12450,
    completion_tokens=1730,
    total_tokens=14180,
    estimated_cost_usd=0.19,
    task_completed=True,
    quality_score=0.9,
)

Use the same session_id and task_id for both control and repoctx runs so you can compare token, cost, and latency deltas later.

Tests

python3 -m pytest -q

PyPI Publishing

This repository is set up to publish to PyPI from GitHub Actions using trusted publishing.

One-Time PyPI Setup

In PyPI, add a trusted publisher with these values:

  • project name: repoctx-mcp
  • owner: gald33
  • repository: repoctx
  • workflow file: publish-pypi.yml

No PyPI API token needs to be stored in GitHub when trusted publishing is configured.

Release Flow

  1. Bump version in pyproject.toml.
  2. Commit and push the version change to main.
  3. Create and push a version tag that matches project.version, like v0.1.1.
git tag v0.1.1
git push origin v0.1.1

Pushing the tag triggers .github/workflows/publish-pypi.yml, which builds the sdist and wheel and publishes them to PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repoctx_mcp-0.1.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repoctx_mcp-0.1.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file repoctx_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: repoctx_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repoctx_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b210355eca2a1f1f6ce1565fbe76388b5bedd540216cc58ba178d700bd991c50
MD5 675b801558991ae03dd92d570ef71f90
BLAKE2b-256 c1b1c6e0b55ce16e0d3547d9a2bf17be94e13cc1c395ec63bd2262f9ac52ae57

See more details on using hashes here.

Provenance

The following attestation bundles were made for repoctx_mcp-0.1.1.tar.gz:

Publisher: publish-pypi.yml on gald33/repoctx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repoctx_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: repoctx_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repoctx_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b5d4f6f863b415ace17e520fe56fed21e5fc67e2c0750d179d3cdaf71e734ad
MD5 af9a5c9c2350454dc97027cf21edd5f8
BLAKE2b-256 4e2c87bd3046b0663b6ad80622f92c7e7a83d88e17a4ba5fb09dcceaae9dbc9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for repoctx_mcp-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on gald33/repoctx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page