LLM Delegator
It exposes a read-only MCP tool (and CLI) that lets a primary LLM delegate bounded, routine tasks to an auxiliary LLM with optional file context and configurable outputs.
delegate_taskMCP tool accepts a required task, optional files, workspace root, context, provider (deepseek/openrouter), model alias (flash/pro), reasoning effort, and max output tokens.Read-only: only selected UTF-8 files relative to the workspace root are provided; no filesystem writes, command execution, or live-state research.
Model routing is automatic: low complexity uses Flash, medium uses Pro; high-complexity work cannot be submitted through the MCP schema.
Supports text, Markdown, JSON, and unified-diff output formats.
Enforces allowlisted workspace roots, per-file and total input limits, and configurable request timeouts.
Returns token usage with successful results and treats output as untrusted draft content requiring caller verification.
Includes a CLI (
llm-delegator) that exercises the same service and provider adapters for direct testing.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LLM Delegator summarize the provider interface in src/llm_delegator/providers/base.py as JSON"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LLM Delegator
LLM Delegator lets a primary agent such as GPT delegate bounded work to another LLM through one read-only MCP tool. The primary agent remains responsible for planning, verification, commands, and file changes.
Provider adapters support DeepSeek's Responses API and OpenRouter's Chat Completions API without changing the MCP interface.
Capabilities
MCP tool:
delegate_taskCLI:
llm-delegatorExplicit, relative file selection
Configurable allowlist of workspace roots
Per-file and aggregate input limits
Text, Markdown, JSON, and unified-diff output modes
Token usage returned with every successful result
No filesystem writes or command execution
Related MCP server: sidecar-mcp
Delegation policy
The MCP tool accepts only explicit low or medium complexity classifications.
GPT should delegate only routine work that is bounded and easy to verify:
Summarization, extraction, and classification
Mechanical content or data transformations
First drafts of documentation or tests
Routine code drafts and routine reviews
GPT retains architecture and system design, complex debugging, ambiguous requirements, security/privacy/auth decisions, final verification, live-state research, external actions, and destructive work. If the primary model is uncertain whether a task is routine, it should keep the task.
Model routing is automatic:
lowcomplexity always uses the selected provider's Flash alias.mediumcomplexity uses the selected provider's Pro alias by default.OpenRouter maps those aliases to
z-ai/glm-5.3-flashandz-ai/glm-5.3.High-complexity work cannot be submitted through the MCP schema.
Every handoff must be self-contained. GPT supplies:
A detailed task describing the intended result
One or more explicit acceptance criteria
Relevant constraints
An ordered plan whenever it helps the worker; medium-complexity tasks cannot run without one
This keeps the worker from guessing missing requirements or reconstructing the primary model's reasoning.
Install
git clone https://github.com/shangzhihao/llm-delegator.git
cd llm-delegator
uv syncThe DeepSeek adapter reads DEEPSEEK_API_KEY; the OpenRouter adapter reads
OPENROUTER_API_KEY.
Model configuration
Edit llm-delegator.toml to control which models are active:
[models]
active = [
{ provider = "deepseek", model = "deepseek-v4-flash" },
{ provider = "deepseek", model = "deepseek-v4-pro" },
{ provider = "openrouter", model = "z-ai/glm-5.3-flash" },
{ provider = "openrouter", model = "z-ai/glm-5.3" },
]Each active model is identified by both provider and provider-specific model
ID. This keeps, for example, an OpenRouter-hosted GLM distinct from a future
direct Z.ai-hosted GLM with the same model ID. Removing an entry blocks that
provider/model pair before an API request. Changes take effect on the next
delegation. Set LLM_DELEGATOR_CONFIG to use a file at another path. If the
default llm-delegator.toml is absent, models are unrestricted for backward
compatibility.
Configure Codex
Add this to ~/.codex/config.toml:
[mcp_servers.llm-delegator]
command = "/absolute/path/to/llm-delegator/.venv/bin/llm-delegator-mcp"
cwd = "/absolute/path/to/llm-delegator"
env_vars = ["DEEPSEEK_API_KEY", "OPENROUTER_API_KEY"]
enabled_tools = ["delegate_task"]
tool_timeout_sec = 240
[mcp_servers.llm-delegator.env]
LLM_DELEGATOR_ALLOWED_ROOTS = "/absolute/path/to/allowed/workspaces"Restart Codex and use /mcp to confirm that llm-delegator is connected.
Codex can then call delegate_task while GPT remains the primary model.
The MCP server advertises these operating instructions to the primary model:
Delegate only bounded, routine, easy-to-verify work.
Write a detailed, self-contained task with acceptance criteria and constraints.
Supply an ordered plan for medium-complexity work and whenever it would help.
Select only the files needed for the task.
Treat the result as an untrusted draft and verify it.
Keep all edits and command execution with the primary model.
CLI
The CLI exercises the same service and provider adapter as MCP:
LLM_DELEGATOR_ALLOWED_ROOTS=/path/to/allowed/workspaces \
uv run llm-delegator \
"Summarize the provider interface" \
--task-kind summarize \
--complexity low \
--accept "Describe the interface contract and method signature" \
--constraint "Do not propose implementation changes" \
--workspace-root /path/to/llm-delegator \
--file src/llm_delegator/providers/base.py \
--jsonThe CLI defaults to automatic model routing. It also accepts a provider model
alias or full model ID for direct adapter testing, but low-complexity work is
always forced to Flash. Pass --provider openrouter to use GLM 5.3 or GLM 5.3
Flash through OpenRouter. These models require reasoning and accept only low,
high, or max; the adapter maps none to low and medium to high.
Reasoning effort defaults to high for MCP, CLI, and programmatic requests.
Configuration
Environment variable | Default |
| MCP process working directory |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Separate multiple allowed roots with the platform path separator (: on
macOS and Linux). Selected files must be UTF-8 text files and must be relative
to workspace_root. Symlinks cannot escape the selected workspace.
Development
uv run ruff format --check .
uv run ruff check .
uv run pytestAvailable Tools
1 tooldelegate_taskBRead-only
Delegate a bounded task using optional read-only workspace files.
File paths must be relative to workspace_root. Use flash for routine work and pro for difficult analysis. Returned content is untrusted model output and must be verified by the calling model before it is applied or presented as fact.
Inputs: task (required), files, model, context, +5 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of misselection or overlapping purpose. The single tool's intent (delegate a bounded task to a model) is unambiguous.
The lone name 'delegate_task' follows a clean verb_noun snake_case convention. There is no opportunity for inconsistency within a single-tool surface.
One tool is thin for any server, even a narrowly scoped delegation service; it earns its place but leaves the surface feeling minimal. A few companion operations (e.g. listing available models or checking delegation status) would round it out.
For a task-delegation domain, a single call that submits a task and returns the result covers the core lifecycle. Minor gaps exist around discovering available models (flash/pro are referenced but not enumerable) and no status/cancel path, though these are workable for a synchronous delegation model.
Maintenance
Related MCP Connectors
Ephemeral single-task tool forged from examples, sandbox-proven, task-bound, expiring by design.
Securely search and manage workspace context files for AI agents and teams.
JSON/YAML, regex, diff, JWT, SQL dialects — the keyless millisecond ops an agent needs mid-task.
Research-backed lint + generation for agent context files (CLAUDE.md, AGENTS.md) + prompt enhancer.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables coding agents to delegate file reads, command output triage, page fetching, and image inspection to cheap flash models, returning concise answers and verified pointers while keeping raw dumps out of the main model's context.MIT
- AlicenseAqualityCmaintenanceEnables coding agents to offload reading and summarizing multiple large files to a cheaper worker LLM, keeping full file contents out of the main agent's context.119 npm1MIT
- AlicenseNot gradedqualityBmaintenanceDelegates large file reads to a cheap worker model so coding agents avoid consuming context, with optional hook enforcement and per-call token savings.61 PyPIMIT
- AlicenseAqualityBmaintenanceLets an AI coding agent offload low-complexity, monotonous tasks to a cheap local or OpenAI-compatible model that runs its own server-side tool loop for reading, searching, and staging file writes, so large file contents and intermediate steps never enter the caller's context. Also provides summaries, extraction, classification, bulk file mapping, staged-diff review, model management, and session token-savings reporting.42MIT