multi-model-companion
Allows routing bounded, read-only analysis and review requests to local OpenAI-compatible models served by Ollama as one of the supported local model backends.
Allows delegation of bounded, read-only analysis, review, and model comparison tasks to OpenAI Codex models via CLIProxyAPI using OAuth subscription.
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., "@multi-model-companion Compare Codex and Grok on this stack trace and explain the root cause"
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.
multi-model-companion
Local MCP server that lets Claude Code delegate bounded, read-only tasks to external models through CLIProxyAPI:
OpenAI Codex (ChatGPT / Codex subscription via OAuth)
xAI Grok (Grok subscription via OAuth)
Local OpenAI-compatible models (vLLM, Ollama, LM Studio, llama.cpp, …)
Optionally any other backend CLIProxyAPI exposes (Kimi, OpenRouter, API keys, …)
Claude stays the coordinator: it decomposes work, selects models and context, verifies output, edits files, and runs tests. Companion models receive only the context you send and return text — they cannot run shell, read your disk, modify the repo, or use your credentials.
Native Claude Code
│ MCP (stdio)
▼
multi-model-companion
│ OpenAI-compatible HTTP
▼
CLIProxyAPI (127.0.0.1:8317)
├── Codex OAuth → GPT / Codex models
├── xAI OAuth → Grok models
├── Kimi OAuth → Kimi models (optional)
└── openai-compatibility → local vLLM / Ollama / …Why MCP instead of the official Codex Claude Code plugin?
Short version: one uniform multi-provider bridge beats one CLI wrapper per vendor for everyday review, analysis, local-model routing, and multi-model compare. Keep a CLI plugin (or bare Codex CLI) only for rare write-mode “go implement this yourself” rescue tasks.
Full write-up (rephrased from a real migration off a Codex/Grok plugin stack):
docs/06-mcp-vs-plugin.md — architecture contrast, trust surface, data governance, and the recommended split.
Upstream plugin reference: openai/codex-plugin-cc.
Related MCP server: mcp-local-llm
Requirements
Python ≥ 3.12
CLIProxyAPI running locally
At least one configured backend (OAuth login and/or local OpenAI-compatible server)
Claude Code CLI
Quickstart
git clone https://github.com/<you>/multi-model-companion.git
cd multi-model-companion
cp .env.example .env # set CLIPROXY_API_KEY and model IDs
uv sync --extra devInstall and start CLIProxyAPI — docs/01-cliproxyapi-setup.md
Log in to subscriptions you want — docs/02-subscription-logins.md
Optionally wire a local model — docs/03-local-models.md
Register the MCP server with Claude Code — docs/04-claude-code-mcp.md
Confirm models from the proxy:
curl -s \
-H "Authorization: Bearer $CLIPROXY_API_KEY" \
"${CLIPROXY_BASE_URL:-http://127.0.0.1:8317/v1}/models" \
| jq -r '.data[].id' | sortSet CODEX_MODEL, GROK_MODEL, and DEEPSEEK_MODEL in .env to IDs that
actually appear in that list.
MCP tools
Tool | Purpose |
| Debugging hypotheses, architecture, research synthesis |
| Read-only code review of a supplied diff/excerpt |
| Propose a minimal unified diff (never applies it) |
| Same question to 2–3 providers in parallel |
| Configured IDs vs what CLIProxyAPI currently exposes |
| Connectivity check (no inference) |
Providers in this package: codex, grok, deepseek (the third slot is
intended for your local OpenAI-compatible model; rename via env).
Model routing (house defaults)
Drop-in agent guidance: CLAUDE.md
Longer rationale: MODEL_ROUTING.md
Core policy:
Prefer a local / cheap model (
deepseekslot) for anything that fits supplied context.Escalate to Codex / Grok only on evidence (thin output, fuzzy spec, high blast radius).
Claude verifies every material claim and applies every change itself.
Never put secrets,
.env, or key material in delegated context.
Configuration
See .env.example. Required:
CLIPROXY_API_KEY=replace-with-a-long-random-client-keyOptional model overrides (examples — use IDs from your /v1/models list):
CLIPROXY_BASE_URL=http://127.0.0.1:8317/v1
CODEX_MODEL=gpt-5.6-codex
GROK_MODEL=grok-4
DEEPSEEK_MODEL=local/my-local-modelExample CLIProxyAPI + MCP snippets:
Security model
Read-only delegation — no tool runs shell or writes files.
Outbound context is redacted for common secret patterns and truncated.
Repository content is wrapped as untrusted data in the prompt.
Logs are metadata-only (provider, model, mode, sizes, status) — never full prompts, keys, or responses.
Keep CLIProxyAPI bound to
127.0.0.1.
Details: docs/05-security.md.
Validation
uv sync --extra dev
uv run pytest -v
uv run ruff check src tests scripts
uv run python scripts/smoke_stdio.py # no live models requiredLive path (CLIProxyAPI + backends up):
export CLIPROXY_API_KEY=...
uv run python scripts/e2e_live.pyOptional independent audit prompt: docs/validation-prompt.md.
Project layout
src/multi_model_companion/ # MCP server + CLIProxy client
tests/ # unit tests (httpx mocked)
scripts/ # smoke + optional live e2e
docs/ # setup guides + MCP vs plugin rationale
examples/ # sample CLIProxyAPI + MCP configs
CLAUDE.md # drop into a project for routing defaults
MODEL_ROUTING.md # longer routing rationaleDocs index
Doc | Topic |
Install / run the proxy | |
Codex, Grok, Kimi OAuth | |
vLLM, Ollama, tunnels | |
Wire MCP into Claude Code | |
Threat model and controls | |
Why MCP over CLI plugins |
Contributing
See CONTRIBUTING.md. Please read SECURITY.md before reporting vulnerabilities, and CODE_OF_CONDUCT.md for community expectations.
Release notes: CHANGELOG.md.
Related projects
openai/codex-plugin-cc (plugin alternative)
License
MIT — see LICENSE.
Available Tools
6 toolscompare_modelsA
Ask two or three external models the same question in parallel.
Use when independent opinions materially improve confidence. Claude must compare the outputs, verify claims against the repository, and synthesize the final conclusion.
Inputs: task (required), mode, context, providers, +2 more. Returns: task, results
delegate_analysisA
Ask Codex, Grok, or local DeepSeek for independent analysis.
Use for debugging hypotheses, architecture evaluation, repository reasoning, or a second opinion. The external model cannot inspect files beyond the supplied context and cannot modify the workspace.
Inputs: task (required), provider (required), context, reasoning_effort, +1 more. Returns: error, model, status, content, +6 more
delegate_patchA
Ask an external model to propose a minimal unified diff.
This tool does not apply changes. Claude must inspect, validate, apply, format, test, and review any proposed patch.
Inputs: task (required), context (required), provider (required), reasoning_effort, +1 more. Returns: error, model, status, content, +6 more
delegate_reviewA
Request a read-only code review from one external model.
Use for correctness, regression, security, concurrency, data-loss, or missing-test review. Claude must verify each material finding.
Inputs: task (required), provider (required), diff_or_context (required), reasoning_effort, +1 more. Returns: error, model, status, content, +6 more
health_checkA
Verify connectivity to CLIProxyAPI and availability of configured companion models. This performs no model inference.
Inputs: no named parameters. Returns: object
list_companion_modelsA
List model IDs exposed by CLIProxyAPI and show whether the configured Codex, Grok, and DeepSeek models are currently available.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a distinct primary purpose: analysis, review, patch, comparison, listing, and health checking. The slight overlap between delegate_analysis and delegate_review is mitigated by clear use-case descriptions, and list_companion_models/health_check serve different aspects of availability.
Most names follow a verb_noun pattern (delegate_*, compare_models, list_companion_models), but health_check deviates from the verb-first convention and could be check_health. Overall the pattern is consistent enough to be predictable.
Six tools is a well-scoped set for a multi-model companion server. Each tool covers a distinct capability without redundancy or bloat.
The server covers the primary workflows: delegating analysis, review, patch generation, multi-model comparison, and status checks. Minor gaps exist, such as no explicit tool for configuring models or retrieving detailed model metadata, but the core functionality is complete.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseAqualityBmaintenanceLocal MCP server that wraps the headless Claude Code CLI as MCP tools, providing stateless access to Claude's coding capabilities through prompt-based interactions. It enables users to execute Claude Code commands with various prompt formats and structured outputs directly from MCP clients.3MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that lets Claude Code delegate mechanical tasks to a local LLM for summarization, classification, extraction, and drafting.19 npm15MIT
- FlicenseNot gradedqualityCmaintenanceZero-dependency MCP server that provides AI models with secure read/write/exec access to local files and directories over HTTP and SSE, designed to be tunneled via ngrok for integration with Claude Web.-
- AlicenseAqualityFmaintenanceMCP server for running external coding agents as background tasks inside Claude Code. Supports multiple backends including Codex, Grok, GLM, DeepSeek, and more.7MIT