claude-code-delegate-local
English · Español

Table of contents
What it solves
delegate-local is an MCP server for Claude Code. Keep Claude Code as the orchestrator and send individual tasks to a local model, a cloud API, Codex CLI, Google Antigravity CLI, or a DeepSeek Harness launcher.
Features
- Run Markdown agents with file tools and optional shell execution through an HTTP backend.
- Run independent Markdown agents in a synchronous batch, or submit CLI jobs and watch them in the background.
- Check backend health and discover agent definitions from the orchestrator.
Quick install
Use Python 3.11 or later, uv, and Claude Code. Choose a gateway below, then run these commands from the repository checkout with the gateway environment flags added to the registration command.
uv sync --locked
claude mcp add delegate-local \
--scope user \
-- uv run --directory "$(pwd)" python server.py
Restart Claude Code after registration or changes to the MCP server. Install the watcher on your PATH with uv tool install --force .. Check that the shell used by Claude Code can run delegate-wait --help.
Choose a gateway
| Gateway | When to choose it | What to configure |
|---|
| Bifrost (recommended) | Go gateway designed for low latency. This project uses Bifrost in production. | Base URL, optional local URL, API mode, and virtual keys if required. |
| LiteLLM (code default) | Python proxy with a wide provider list. | Messages endpoint and proxy key if required. Start with the LiteLLM YAML example. |
Set the variables below in the Claude Code MCP server environment using --env NAME=value when registering the server. Set DELEGATE_LOCAL_MODEL if you need to select a different default model alias. The alias must exist on the configured backend.
Bifrost
DELEGATE_GATEWAY=bifrost
DELEGATE_BIFROST_URL=https://bifrost.example.invalid
DELEGATE_BIFROST_API=litellm
DELEGATE_BIFROST_URL is required. Both URL variables accept HTTP(S) URLs with a host and no embedded credentials.
local-* and ornith* aliases use DELEGATE_BIFROST_LOCAL_URL when set, otherwise they use DELEGATE_BIFROST_URL. They use DELEGATE_BIFROST_VK_LOCAL for authentication. All other aliases use DELEGATE_BIFROST_URL and DELEGATE_BIFROST_VK_CODE. Set the relevant virtual keys if your gateway requires them. Requests send a configured key as both a Bearer token and x-api-key.
- With a base URL, the default
DELEGATE_BIFROST_API=litellm sends Anthropic messages to /litellm/v1/messages and OpenAI-format aliases to /litellm/v1/chat/completions. A base ending in /litellm gets /v1/messages appended, and a full /v1/messages endpoint is used as supplied for Anthropic messages. Set DELEGATE_BIFROST_API=openai to send all gateway-routed models to /v1/chat/completions on the selected base, with compatibility suffixes removed.
DELEGATE_BIFROST_LOCAL_MAX_TOKENS caps output tokens for local aliases. It defaults to 16384 and accepts integers from 1 to 1000000.
Use the Bifrost environment example for optional settings. The companion Bifrost kit provides ready-made configuration and installers for macOS and WSL2.
LiteLLM
DELEGATE_GATEWAY=litellm
DELEGATE_LOCAL_URL=http://localhost:4000/v1/messages
# DELEGATE_LOCAL_KEY=<proxy-key>
LiteLLM is selected when the selector is unset or blank. DELEGATE_LOCAL_URL defaults to the endpoint above. Anthropic-format requests use that endpoint directly. OpenAI-format aliases use /v1/chat/completions on the base derived from it. Set DELEGATE_LOCAL_KEY if your proxy requires authentication. Requests send it as both a Bearer token and x-api-key. Configure provider credentials in the proxy environment.
Startup selection and health checks
Optionally set DELEGATE_GATEWAY_FILE to a nonempty path to override DELEGATE_GATEWAY at startup. Use a regular file owned by the MCP process user with mode 0600, no symlink, and at most 4096 bytes of UTF-8 JSON, such as {"selector":"bifrost"} or {"selector":"litellm"}. An invalid file or an unknown active selector stops startup.
Run local_backend_status to check liveness and available models for the default alias. LiteLLM checks /health/liveliness and /v1/models on the derived base. Bifrost checks /health with a trailing /litellm removed from that base and queries /v1/models on the derived base. With a plain Bifrost base URL, the model query goes to /litellm/v1/models in either API mode.
Configuration
Set these variables in the Claude Code MCP environment.