Skip to main content
Glama
README.md
# LiveRepoMCP

[![M8ven Verified](https://m8ven.ai/badge/mcp/umsuitdoy-rmr-eesvjs?v=004315c8add9b5d87216a7d8e6f27331&variant=verified)](https://m8ven.ai/mcp/umsuitdoy-rmr-eesvjs?s=readme)

Connect your local Git repositories to web-based AI with live code intelligence, structural search, call graphs, Git diffs, and guarded editing.

Web AI clients like Claude, ChatGPT, and Gemini normally only see uploaded snippets or stale GitHub commits—missing your uncommitted edits, active branches, and cross-file dependencies. **LiveRepoMCP** (`live-repo-mcp`) links one local Git repository on your machine over a secure OAuth 2.1 HTTPS tunnel—read-only by default, with optional guarded writes you can switch on or off live:

- **Live working-tree visibility:** Browse repository files, uncommitted changes, and Git diffs without manual copy-pasting.
- **Smart code search:** Search text, code structure, symbol definitions, and references across your local codebase.
- **Call graphs & change impact:** Trace callers, callees, and downstream dependencies before making edits.
- **Read-only by default, guarded writes when enabled:** Unlock multi-file edits live from your terminal or desktop window behind path and syntax guardrails.

## Updates

Highlights in `v2.2.0`:

- **PyPI package (`live-repo-mcp`) & `live-repo doctor`:** Install globally with `uv tool install live-repo-mcp` (or run a one-shot check with `uvx live-repo-mcp doctor`) and use `live-repo`, `live-repo-web`, `live-repo-desktop`, and `live-repo-server` from any Git repository.
- **Zero-flag interactive `live-repo-web` & live Hot Toggle:** `live-repo-web` automatically resolves `--repo` (current Git root or last saved repo) and saved `--domain`, supports live write toggling without restarting, and adds interactive TTY slash commands (`/write`, `/status`, `/copy`, `/rotate`, `/repo`, `/stop`) while preserving non-TTY pipe mode.
- **Cross-platform Desktop launchers:** Native desktop launchers live in [`launchers/`](launchers) with consistent UX across Windows ([`start_live_repo.vbs`](launchers/start_live_repo.vbs)), macOS ([`start_live_repo.command`](launchers/start_live_repo.command)), and Linux ([`start_live_repo.sh`](launchers/start_live_repo.sh)).
- **OAuth 2.1 authentication & clean `/mcp` endpoint:** Protected `/mcp` with PKCE `S256` + Bearer tokens, interactive `/oauth/consent` approval via a local **Owner Passcode**, Dynamic Client Registration (`/register`), strict `redirect_uri` allowlisting, and ngrok Traffic Policy route filtering.
- **Opt-in guarded atomic writes (`apply_edits`):** Supports up to 15 `replace` (unique exact-match `old_text`) or `create` edits per batch with `.py`/`.json` syntax checking, path/secret protection, optional worktree conflict checks, and compact unified diffs.

## Quickstart

### 1. Install LiveRepoMCP

**Option 1 — One-command install (recommended):**

```sh
uv tool install live-repo-mcp
```

Update later with `uv tool upgrade live-repo-mcp`, or run a one-shot environment check without installing via `uvx live-repo-mcp doctor`.

> **Note:** Before the PyPI release—or to install the latest `main` branch directly from GitHub—install with:
>
> ```sh
> uv tool install git+https://github.com/umsuitdoy/live-repo-mcp
> ```

Once installed, these global commands work from any Git repository directory:

- `live-repo` *(short alias for `live-repo-mcp`)* — Unified CLI (`live-repo doctor`, `live-repo web`, `live-repo desktop`, `live-repo server`)
- `live-repo-web` — Terminal OAuth 2.1 + ngrok session runner
- `live-repo-desktop` — Cross-platform Desktop GUI (Tkinter)
- `live-repo-server` — Direct FastMCP server entrypoint

**Option 2 — Run from source (`git clone` + `launchers/`):**

```sh
git clone https://github.com/umsuitdoy/live-repo-mcp.git
cd live-repo-mcp
```

Run one of the native desktop launchers in `launchers/`—[`launchers/start_live_repo.vbs`](launchers/start_live_repo.vbs) (Windows), [`launchers/start_live_repo.command`](launchers/start_live_repo.command) (macOS), or [`launchers/start_live_repo.sh`](launchers/start_live_repo.sh) (Linux)—or run `uv run live-repo-web` directly from the repository.

### 2. Verify environment (`live-repo doctor`)

```sh
live-repo doctor
```

*(Or `uv run live-repo doctor` when running from source.)* Checks required tools (`git`, `ngrok`) and optional integrations (`rg`, `sg`, `codegraph`, `tkinter`) so you can spot missing dependencies before starting a session.

### 3. Start & connect

1. Start a session using **Terminal (`live-repo-web`)** or **LiveRepoMCP Desktop (`live-repo-desktop`)** (expand the setup sections below).
2. In Gemini on the web (or another MCP-compatible web client), open **Settings → Connected Apps → Custom apps → Add MCP server** and enter `https://<your-domain>/mcp`.
3. Complete OAuth 2.1 authorization (via Dynamic Client Registration or your pre-registered **OAuth Client ID** and **OAuth Client Secret**), then enter your local **Owner Passcode** at `/oauth/consent` to approve access.

**NOTICE:** Tool results reach your web AI client through ngrok. Choose only repositories you have permission to share through those services.

<details>
<summary><strong>Requirements</strong></summary>

- **Core:** Python 3.11+, Git, and [uv](https://docs.astral.sh/uv/getting-started/installation/).
- **Tunnel:** Install the [ngrok CLI](https://ngrok.com/download) on `PATH`, configure your authtoken, and assign a static domain to your ngrok account. See [ngrok agent setup](https://ngrok.com/docs/start).
- **LiveRepoMCP Desktop GUI (optional):** Python with Tkinter (`tkinter`). Included in standard Windows/macOS Python installers; on Linux install your distribution package (e.g., `python3-tk` on Debian/Ubuntu).
- **Optional search tools:** `ripgrep` (`rg`) accelerates text search (LiveRepoMCP falls back to Python when unavailable). `ast-grep` (`sg`) is required for structural AST pattern search.
- **Optional CodeGraph integration:** CodeGraph **1.6.2** is required for call tracing (`callers`, `callees`) and `impact` analysis. See [CodeGraph 1.6.2 release](https://github.com/colbymchenry/codegraph/releases/tag/v1.6.2).

Run `live-repo doctor` at any time to inspect the status of all required and optional dependencies.

</details>

<details>
<summary><strong>Terminal setup (<code>live-repo-web</code> — Windows, macOS, Linux)</strong></summary>

1. From any Git repository directory, start a session with smart defaults (or pass explicit flags):

   ```sh
   live-repo-web
   ```

   *(From a source checkout without `uv tool install`, use `uv run live-repo-web`.)*

   - `--repo` defaults to the current Git repository root (or your last used repo if run outside a repo).
   - `--domain` defaults to your saved ngrok domain, or prompts interactively on first run in a terminal.
   - To specify options explicitly:

     ```sh
     live-repo-web --repo "/path/to/your/repo" --domain your-domain.ngrok-free.app --port 8000
     ```

2. **Interactive mode (TTY):** When running in an interactive terminal, `live-repo-web` enables live `WriteGate` Hot Toggle (`hot_toggle=True`, OFF by default) and provides slash commands without restarting the tunnel:
   - `/help` — Show available slash commands and aliases
   - `/status` — Show repository, MCP URL, server/tunnel state, write mode, and OAuth info
   - `/write [on|off]` — Hot-toggle `apply_edits` live (OFF by default; persisted once turned ON)
   - `/show` — Toggle showing/hiding OAuth credentials (`Client ID`, `Client Secret`, `Owner Passcode`)
   - `/copy <url|id|secret|pass>` *(aliases `/curl`, `/cid`, `/csec`, `/cpass`)* — Copy a value to the system clipboard
   - `/pass [value]` — Set or regenerate the Owner Passcode (restarts session)
   - `/rotate` — Rotate OAuth credentials, revoke existing tokens, and restart session
   - `/repo <path>` — Switch the active Git repository and restart session
   - `/stop` *(or `/quit`)* — Stop the tunnel and server cleanly

3. **Non-TTY / pipe mode:** When stdin/stdout is redirected (scripts or automation), `live-repo-web` prints the clean HTTPS MCP URL (`https://<your-domain>/mcp`) to stdout, prints OAuth credentials and write mode to stderr, and waits for `Ctrl+C` / `SIGTERM`.

4. **CLI flags:**
   - `--repo <path>` — Root of a Git worktree (defaults to current Git repo or last saved repo)
   - `--domain <host>` — Your assigned ngrok domain (defaults to saved domain or prompts interactively)
   - `--port <port>` — Local loopback port (default: `8000`)
   - `--allow-write` — Enable guarded `apply_edits` on startup and remember ON for future runs
   - `--read-only` — Force read-only mode (OFF) and remember for future runs
   - `--rotate-auth` — Rotate OAuth client secret and owner passcode and revoke previously issued tokens
   - `--redirect-uri <pattern>` *(repeatable)* — Allow additional OAuth callback URIs beyond the built-in Google whitelist (`https://vertexaisearch.cloud.google.com/oauth-redirect`, `https://oauth-redirect.googleusercontent.com/r/*`, `https://*.googleusercontent.com/*`)

</details>

<details>
<summary><strong>LiveRepoMCP Desktop setup (Windows, macOS, Linux)</strong></summary>

1. Launch LiveRepoMCP Desktop:
   - **Installed globally (`uv tool install`):** Run `live-repo-desktop` (or `live-repo desktop`) from any terminal.
   - **Running from a cloned repo:** Use the native launcher for your OS in [`launchers/`](launchers):
     - **Windows:** Double-click [`launchers/start_live_repo.vbs`](launchers/start_live_repo.vbs)
     - **macOS:** Double-click [`launchers/start_live_repo.command`](launchers/start_live_repo.command) *(if Gatekeeper warns on first open, right-click → **Open**)*
     - **Linux:** Run [`launchers/start_live_repo.sh`](launchers/start_live_repo.sh)

   Each launcher verifies `uv` is installed, runs `uv sync` automatically when `.venv` or lockfiles change (via `.venv/.live-repo-ready`), and starts `uv run --no-sync live-repo-desktop`.

2. Select your repository, enter your [ngrok domain](https://dashboard.ngrok.com/domains), and click **Start**.
3. Use **Copy URL** next to `MCP URL` (`https://<domain>/mcp`) and the **Copy** buttons next to `OAuth Client ID`, `OAuth Client Secret`, and `Owner Passcode`—all copy buttons stay enabled while the server is Online (even when secrets are masked).
4. Toggle **Show OAuth secrets** to inspect values, or click **Rotate OAuth** to generate new credentials and revoke existing tokens on the next Start.
5. Use the **Allow Write (`apply_edits`)** Hot Toggle (OFF by default; remembered once turned ON) to lock or unlock writes live without restarting the tunnel or reconnecting your web client.
6. Sanitized OAuth diagnostics (without secrets, tokens, or codes) are written to `%LOCALAPPDATA%\LiveRepoMCP\oauth.log` on Windows and `~/.local/share/LiveRepoMCP/oauth.log` on macOS/Linux so you can inspect the exact `redirect_uri` used by your client and tighten `allowed_redirect_uris` in settings if desired.

</details>

<details>
<summary><strong>How it works &amp; MCP tools</strong></summary>

```text
Web MCP client (e.g. Gemini)
   │  OAuth 2.1 (PKCE S256 + Bearer)
   ▼
ngrok (Traffic Policy route allowlist)
   │  Streamable HTTP on loopback (/mcp + OAuth routes)
   ▼
FastMCP + LiveRepoOAuthProvider
   ├── Read tools: get_project_overview, investigate_codebase, inspect_evidence
   └── Write tool (opt-in): apply_edits ── WriteGate + write_guard + atomic patch engine
                                              │
                                       selected repository
                                         ├── source files and Git
                                         └── CodeGraph index
```

Each session creates an isolated one-repo registry (project ID `project`). All paths are validated against the selected repository root:

- **Terminal (`live-repo-web`):** Registers `apply_edits` behind `WriteGate` (`hot_toggle=True`, OFF by default; persisted once enabled) so you can toggle write permission live with `/write on` or `/write off` without restarting (or pass `--allow-write` / `--read-only`).
- **Desktop (`live-repo-desktop`):** Registers `apply_edits` behind `WriteGate` (OFF by default) so you can toggle write permission live via **Allow Write (`apply_edits`)** without reconnecting.

### Tools

- **`get_project_overview`** — Lists the active repository when called without `project_id`. For a specific project, returns the file listing, previews of entry documents (`README.md`, `AGENTS.md`, `docs/architecture.md` if present), architecture decision records (`.live-repo-mcp/adr/*.md`), and Git `tree_state`.
- **`investigate_codebase`** — Locates code and relationships by `mode`:
  - `outline` — Lists Python classes and functions using Python's AST.
  - `symbol` — Finds Python definitions and references with Jedi.
  - `grep` — Searches text or regular expressions with ripgrep (or Python fallback).
  - `ast` — Searches structural syntax patterns with ast-grep.
  - `callers` / `callees` — Finds direct incoming or outgoing calls via CodeGraph.
  - `impact` — Follows affected dependents across multiple steps via CodeGraph.
- **`inspect_evidence`** — Returns a line range (`file_lines`), a symbol's source (`symbol`), or a Git diff (`git_diff`). File excerpts include a SHA-256 content hash.
- **`apply_edits`** *(opt-in via `/write on`, `--allow-write`, or Desktop Hot Toggle)* — Atomically applies up to 15 edits (`replace` with unique exact-match `old_text`, or `create` for new files) in a single all-or-nothing batch. Validates every edit in memory first (including `.py` AST and `.json` syntax checks), writes via temporary file + `fsync` + atomic replace, supports optional `expected_worktree_fingerprint` conflict checks, and returns the updated `tree_state` plus a compact unified diff.

</details>

<details>
<summary><strong>Security &amp; write guardrails</strong></summary>

- **OAuth 2.1 authentication:** Clean `/mcp` endpoint protected by Bearer tokens (no secret in URLs), PKCE (`S256`), interactive `/oauth/consent` Owner Passcode approval, strict `redirect_uri` allowlist, and SHA-256 hashed persisted token state (`oauth-state.json`).
- **Route allowlist:** Both ngrok Traffic Policy (`req.url.raw_path`) and the ASGI app reject any path outside `/mcp` and the canonical OAuth/discovery routes (`/.well-known/oauth-*`, `/.well-known/openid-configuration`, `/authorize`, `/token`, `/register`, `/revoke`, `/oauth/consent`).
- **Write guard (`write_guard`):** Blocks path traversal (`..`), absolute/drive paths, symlinks and Windows junctions on targets or parent directories, `.git/`, `.env*` (except `.env.example` and `.env.sample`), and private key/certificate files (`*.pem`, `*.key`, `*.p12`, `*.pfx`, `id_rsa*`, `id_ed25519*`).
- **Batch &amp; size caps:** Enforces a maximum of **256 KB per file**, **1 MB total per batch**, and **15 edits per batch**.

</details>

<details>
<summary><strong>CodeGraph integration</strong></summary>

Install CodeGraph 1.6.2 and run `codegraph init` from the root of the repository you want to analyze. LiveRepoMCP opens that repo's `.codegraph/codegraph.db` in read-only mode. Run `codegraph sync` in the same repo to refresh the index after code changes.

For `callers`, `callees`, and `impact`, pass the symbol name in `query`. Use `subpath` to select the exact definition file when names overlap. If that file has no matching definition, the result is empty. For calls, `line` identifies the definition and `call_line` identifies the call site in the caller's file when the index has it.

For example, after indexing this repository and sharing it in a session, call `investigate_codebase` with these arguments to see which symbols depend on `get_project`:

```json
{
  "project_id": "project",
  "mode": "impact",
  "query": "get_project",
  "subpath": "src/live_repo_mcp/core/registry.py",
  "depth": 2,
  "max_results": 10
}
```

Impact results group affected symbols by definition and show the shortest dependency path to each. If a group contains overloads, its `definition` is representative and each path starts at the overload it follows. `depth` controls the number of dependency steps (1–5, default 2). `max_results` caps the number of groups and the total number of affected symbols (default 30, maximum 50). `ambiguous` signals multiple matching definition groups, and `truncated` signals that a limit omitted results.

</details>

<details>
<summary><strong>Development &amp; verification</strong></summary>

Run the automated test suite:

```sh
uv run --extra dev pytest -q
```

To manually verify a web session with a sample repository:

- Run `live-repo doctor` (or `uv run live-repo doctor`) and verify `git` and `ngrok` checks pass.
- Confirm unauthenticated `POST /mcp` returns `401` and unknown paths return `404`.
- Complete the OAuth 2.1 flow through `/oauth/consent` using the local Owner Passcode.
- Call `get_project_overview`, `investigate_codebase`, and `inspect_evidence` in order and confirm all results stay within the selected repository.
- Confirm `apply_edits` is blocked while write mode is OFF, then enable writes live via `/write on` (in `live-repo-web`) or **Allow Write** (in LiveRepoMCP Desktop) and verify a `create` / `replace` edit succeeds atomically.
- Stop the session (`/stop`, `Ctrl+C`, or **Stop**) and confirm the URL stops serving requests.
- Rotate credentials (`/rotate`, `--rotate-auth`, or **Rotate OAuth**), restart, and confirm previously issued tokens are rejected until re-authorized.

</details>

## License

LiveRepoMCP is released under the [MIT License](LICENSE). Third-party tools (`ngrok`, `ripgrep`, `ast-grep`, and [CodeGraph](https://github.com/colbymchenry/codegraph)) are not bundled with LiveRepoMCP; they are installed separately by the user and governed by their own licenses.

TDQS

A3.6/5.0

Scored across 4 tools

Disambiguation4/5

The four tools map cleanly to a tiered model (health check, Tier 1 overview, Tier 2 investigation, Tier 3 evidence), so the primary boundaries are clear. However, there is real overlap at the edges: 'symbol' appears both in investigate_codebase (definition + references) and inspect_evidence (read symbol with SHA-256 hash), and file listing in get_project_overview vs. file reading in inspect_evidence can be confused.

Naming Consistency4/5

Three tools follow a verb-first snake_case pattern (get_project_overview, investigate_codebase, inspect_evidence), giving a predictable read/query convention. 'ping' is a bare verb and breaks the noun-phrase pattern, but as a single conventional health-check name it is a minor deviation.

Tool Count3/5

Four tools is thin on the surface, and the real complexity is hidden inside investigate_codebase, which multiplexes seven modes (outline, symbol, grep, ast, callers, callees, impact) behind one name. This is efficient but pushes mode selection into parameters, making the effective toolset larger than four and harder to discover.

Completeness3/5

The read/investigation lifecycle is covered end to end, but the descriptions state that callers/callees/impact require a local CodeGraph index and no tool exists to build, refresh, or inspect that index — a dead end for an agent on a cold workspace. All tools are read-only, with no way to record findings, ADRs, or state.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues