# local-delegate

An MCP server that hands mechanical text jobs to a local OpenAI-compatible LLM. Large files are read server-side, so they never fill Claude's context window.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6
- Author: ZahiriNatZuke
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/ZahiriNatZuke/local-delegate
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/mcp/local-delegate

## What it does

\`local-delegate` talks to any OpenAI-compatible endpoint: llama-swap, Ollama, LM Studio, vLLM. You call an MCP tool and pass `path` instead of `text`, so the file is read on the server. Only the short answer comes back, which keeps the document out of your context window and off Claude's plate.

Two ways to run it: `stdio`, or a shared HTTP daemon. The daemon serves MCP at `http://127.0.0.1:9393/mcp` and a dashboard at `http://127.0.0.1:9393/` showing backend state, RAM and VRAM use, context tokens saved, and recent delegations. With several sessions or clients on one machine, a single daemon avoids duplicate MCP processes.

\`local-delegate install` writes the MCP entry, hooks, a skill and a delegation rule into `CLAUDE.md` or `AGENTS.md`. It is idempotent, keeps `.bak` copies, and `local-delegate uninstall` reverts it. Watch the client timeouts: Codex kills an MCP tool call at 60 s, and Claude drops an HTTP call after 5 minutes of silence. The `tool_timeout_sec` value in `config.toml` has to be restored after every `install` or `update`, since both rewrite that block.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `LOCAL_DELEGATE_BASE_URL`, `LOCAL_DELEGATE_API_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env LOCAL_DELEGATE_BASE_URL=<LOCAL_DELEGATE_BASE_URL> --env LOCAL_DELEGATE_API_KEY=<LOCAL_DELEGATE_API_KEY> --transport stdio local-delegate -- uvx local-delegate-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from local-delegate-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add local-delegate --env LOCAL_DELEGATE_BASE_URL=<LOCAL_DELEGATE_BASE_URL> --env LOCAL_DELEGATE_API_KEY=<LOCAL_DELEGATE_API_KEY> -- uvx local-delegate-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from local-delegate-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "local-delegate": {
            "command": "uvx",
            "args": [
                "local-delegate-mcp"
            ],
            "env": {
                "LOCAL_DELEGATE_BASE_URL": "<LOCAL_DELEGATE_BASE_URL>",
                "LOCAL_DELEGATE_API_KEY": "<LOCAL_DELEGATE_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from local-delegate-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "local-delegate": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "local-delegate-mcp"
            ],
            "env": {
                "LOCAL_DELEGATE_BASE_URL": "<LOCAL_DELEGATE_BASE_URL>",
                "LOCAL_DELEGATE_API_KEY": "<LOCAL_DELEGATE_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from local-delegate-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e LOCAL_DELEGATE_BASE_URL=<LOCAL_DELEGATE_BASE_URL> -e LOCAL_DELEGATE_API_KEY=<LOCAL_DELEGATE_API_KEY> local-delegate uvx local-delegate-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from local-delegate-mcp <command>

## When to use it
- summarise a huge log without burning Claude context
- classify a batch of texts on a local model
- pull fields out of documents into a fixed schema
- generate repetitive boilerplate off the subscription quota
- share one local GPU across several MCP clients

## Example prompts
- Read `logs/build.log` and list only the error lines
- Extract invoice number, date and total from `invoices/` into a table
- Tag these texts by category using the local model

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
