local-llm-delegator
MCP server that enables delegation of small coding implementations to a cheaper language model with propose_patch and apply_patch tools, while the primary agent retains architecture, review, and approval.
README
Local LLM Delegator
Local LLM Delegator is an installable Codex and Claude Code plugin that shifts small coding implementations to a cheaper model while the primary agent keeps architecture, scoping, review, and final acceptance.
The bundle contains:
- A dependency-free Python MCP server with
propose_patchandapply_patch. - A delegation skill that triggers before the primary model reads broad source context.
- Templates for Hugging Face GPT-OSS, llama.cpp, and OpenRouter.
- Exact-patch SHA-256 approval, path limits, stale-source checks, validation, partial-failure restoration, and one bounded repair.
Requirements
- Python 3.11+
- POSIX
shand thepatchutility - Codex with plugin support or Claude Code
- An OpenAI-compatible model endpoint
No Python package installation is required.
Install in Codex
Clone this repository, add it as a local marketplace, and install the plugin:
git clone https://github.com/tushrv/local-llm-delegator.git
codex plugin marketplace add ./local-llm-delegator
codex plugin add local-llm-delegator@local-llm-delegator
Restart Codex and begin a new thread so the skill and MCP tools are discovered.
Install in Claude Code
Add the cloned repository as a marketplace and install the plugin:
/plugin marketplace add /absolute/path/to/local-llm-delegator
/plugin install local-llm-delegator@local-llm-delegator
Restart Claude Code after installation.
Configure a project
From the target repository, create a policy:
python3 /absolute/path/to/local-llm-delegator/plugins/local-llm-delegator/scripts/init_project.py \
--provider huggingface
Supported provider values are huggingface, llamacpp, and openrouter.
Review the generated local-llm-worker.toml; narrow allowed_paths and replace
the example validation command with the project's actual checks.
For Hugging Face, export the credential before launching Codex or Claude:
export HF_INFERENCE_TOKEN=your-token
For OpenRouter, export OPENROUTER_API_KEY. llama.cpp needs no token by default.
The plugin inherits these variables but never stores or returns them.
The skill passes the target repository as workspace_root on each proposal, so
one installed MCP server can work across projects without re-registration.
LOCAL_LLM_CONFIG may optionally force a policy file outside each project.
Use it
In Codex, ask:
Use $delegate-local-worker to implement this focused bug fix.
In Claude Code, invoke:
/local-llm-delegator:delegate-local-worker
The skill is explicit-invocation-only on both hosts. Codex sets
allow_implicit_invocation: false. Claude uses a separate mirrored skill with
disable-model-invocation: true, which also keeps its description out of
Claude's context until manual invocation.
The full SKILL.md is therefore not loaded on every prompt. While the plugin is
enabled, the host may still advertise or discover the two MCP tool schemas; that
small, host-dependent overhead exists even when the skill is idle. Invoke the
skill only when the source context and implementation work being offloaded is
larger than that overhead.
The primary model scopes the task and calls propose_patch. The worker reads
only allowed files, asks the cheaper model for a diff, validates it without
mutating the project, and returns the patch plus its digest. After full review,
the primary model calls apply_patch, which applies those exact bytes and runs
configured checks.
The MCP reduces primary-model context only when delegation happens before the primary model reads and solves the implementation itself. Returned patches and validation results still consume review context. The plugin does not persist Codex or Claude conversation memory.
Security
- Never place tokens in TOML, plugin JSON, prompts, or supporting context.
- Treat project validation commands as trusted code.
- Review the complete patch before approving its digest.
- Hosted models receive the source files inside the delegated scope.
- Proposal state is process-memory-only and expires after 15 minutes by default.
- The worker does not commit, push, or execute commands proposed by the model.
Development
cd plugins/local-llm-delegator/mcp
PYTHONPATH=src python3 -m unittest discover -s tests -v
ruff check .
mypy src
Validate the skill and plugin with the validation scripts from Codex's built-in
skill-creator and plugin-creator skills.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.