@zhixuan92/multi-model-agent-mcp 0.4.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  **Delegate work from your expensive parent-session model to a fleet of cheaper sub-agents, in parallel, from a single MCP tool call.**
4
4
 
5
- This is the MCP stdio server for [`multi-model-agent`](https://github.com/zhixuan312/multi-model-agent). Your MCP client (Claude Code, Claude Desktop, Codex CLI, Cursor, …) spawns it on demand and gets six tools: `delegate_tasks`, `register_context_block`, `retry_tasks`, `get_task_output`, `get_task_detail`, and `get_batch_telemetry`. Each `delegate_tasks` call runs the supplied tasks in parallel across the providers you configured, auto-routing each to the cheapest one that has the required capabilities and quality tier — or pinning to a specific provider when you want control. Every response envelope carries a pre-computed `headline` field so the calling agent can narrate the ROI story in one line without any arithmetic.
5
+ This is the MCP stdio server for [`multi-model-agent`](https://github.com/zhixuan312/multi-model-agent). Your MCP client (Claude Code, Claude Desktop, Codex CLI, Cursor, …) spawns it on demand and gets nine tools: `delegate_tasks`, `register_context_block`, `retry_tasks`, `get_batch_slice`, `execute_plan_task`, `audit_document`, `debug_task`, `review_code`, and `verify_work`. Each `delegate_tasks` call runs the supplied tasks in parallel across the agents you configured, auto-routing each to the cheapest one that has the required capabilities and agent type — or pinning to a specific agent when you want control. Every response envelope carries a pre-computed `headline` field so the calling agent can narrate the ROI story in one line without any arithmetic.
6
6
 
7
7
  ## Why use it
8
8
 
9
- - **Cut cost and context.** Mechanical work (file edits, search, doc lookups) runs on cheap providers in a clean worker context. Your parent session's window stays lean and its judgment unblocked.
9
+ - **Cut cost and context.** Mechanical work (file edits, search, doc lookups) runs on cheap agents in a clean worker context. Your parent session's window stays lean and its judgment unblocked.
10
10
  - **Run tasks in parallel.** Independent tasks in one call execute concurrently; wall-clock time drops with task count.
11
- - **Mix providers in one config.** Claude, Codex, and any OpenAI-compatible endpoint (MiniMax, DeepSeek, Groq, local vLLM, …) live side-by-side.
12
- - **Auto-route and escalate.** Capability filter → tier filter → cheapest qualifying provider; on failure the chain is walked automatically, stopping at the first success.
11
+ - **Mix agents in one config.** Claude, Codex, and any OpenAI-compatible endpoint (MiniMax, DeepSeek, Groq, local vLLM, …) live side-by-side.
12
+ - **Auto-route and escalate.** Capability filter → agent type routing; on failure the chain is walked automatically, stopping at the first success.
13
13
  - **No bare failures.** Every termination path (incomplete, max_turns, timeout, error) populates `output` from the runner's scratchpad.
14
14
  - **Sandboxed by default.** `cwd-only` file tool confinement and shell-disabled by default. Opt out per-task only when needed.
15
15
  - **Pre-computed ROI headline**: every `delegate_tasks` response carries a `headline` field — a one-line summary of tasks, success rate, wall-clock, serial savings, cost, and ROI. Quote it verbatim; no arithmetic required.
@@ -27,24 +27,16 @@ Create `~/.multi-model/config.json`:
27
27
 
28
28
  ```json
29
29
  {
30
- "providers": {
31
- "claude": {
32
- "type": "claude",
30
+ "agents": {
31
+ "standard": {
32
+ "type": "openai-compatible",
33
33
  "model": "claude-sonnet-4-6",
34
- "costTier": "medium"
35
- },
36
- "codex": {
37
- "type": "codex",
38
- "model": "gpt-5-codex",
39
- "costTier": "medium"
34
+ "baseUrl": "https://api.claude.ai/v1"
40
35
  },
41
- "minimax": {
36
+ "complex": {
42
37
  "type": "openai-compatible",
43
- "model": "MiniMax-M2",
44
- "baseUrl": "https://api.minimax.io/v1",
45
- "apiKeyEnv": "MINIMAX_API_KEY",
46
- "costTier": "free",
47
- "hostedTools": ["web_search"]
38
+ "model": "claude-opus-4-6",
39
+ "baseUrl": "https://api.claude.ai/v1"
48
40
  }
49
41
  },
50
42
  "defaults": {
@@ -57,11 +49,10 @@ Create `~/.multi-model/config.json`:
57
49
 
58
50
  Config lookup order: `--config <path>` → `MULTI_MODEL_CONFIG` env var → `~/.multi-model/config.json`.
59
51
 
60
- Provider auth:
52
+ Agent auth:
61
53
 
62
- - **`codex`** uses `codex login` if available, otherwise `OPENAI_API_KEY`
63
- - **`claude`** uses `ANTHROPIC_API_KEY` if set, otherwise the local Claude auth flow
64
- - **`openai-compatible`** uses `apiKeyEnv` (preferred) or inline `apiKey`
54
+ - **OpenAI-compatible** agents use `apiKeyEnv` (preferred) or inline `apiKey`
55
+ - **Claude** agents use `ANTHROPIC_API_KEY` if set, otherwise the local Claude auth flow
65
56
 
66
57
  ## Setup
67
58
 
@@ -73,7 +64,7 @@ One command — the client will spawn the server on demand. Use `-s user` so the
73
64
  claude mcp add multi-model-agent -s user -- npx -y @zhixuan92/multi-model-agent-mcp serve
74
65
  ```
75
66
 
76
- If your providers need environment variables:
67
+ If your agents need environment variables:
77
68
 
78
69
  ```bash
79
70
  claude mcp add multi-model-agent -s user \
@@ -100,7 +91,7 @@ ANTHROPIC_API_KEY = "sk-ant-..."
100
91
  MINIMAX_API_KEY = "..."
101
92
  ```
102
93
 
103
- Only set the env keys for the providers you actually configured. If you use `codex login`, the `codex` provider inside `multi-model-agent` reuses that auth automatically — but Claude, MiniMax, and other API-key providers still need to be passed through `[mcp_servers.multi-model-agent.env]` because the spawned MCP process does not inherit your shell environment. Restart `codex` after editing the file.
94
+ Only set the env keys for the agents you actually configured. If you use `codex login`, the `codex` agent inside `multi-model-agent` reuses that auth automatically — but Claude, MiniMax, and other API-key agents still need to be passed through `[mcp_servers.multi-model-agent.env]` because the spawned MCP process does not inherit your shell environment. Restart `codex` after editing the file.
104
95
 
105
96
  ### Claude Desktop
106
97
 
@@ -146,7 +137,7 @@ args = ["-y", "@zhixuan92/multi-model-agent-mcp@0.3.0", "serve"]
146
137
 
147
138
  ## Recommended: delegation rule for Claude Code
148
139
 
149
- Claude Code's native `Task` / `Agent` subagents inherit your parent session's expensive model and eat its context window. We ship a drop-in rule file that teaches Claude Code **when** to delegate work through `delegate_tasks` instead — mechanical edits go to free providers, reasoning-tier work escalates only when needed, and independent tasks run in parallel.
140
+ Claude Code's native `Task` / `Agent` subagents inherit your parent session's expensive model and eat its context window. We ship a drop-in rule file that teaches Claude Code **when** to delegate work through `delegate_tasks` instead — mechanical edits go to free agents, reasoning-tier work escalates only when needed, and independent tasks run in parallel.
150
141
 
151
142
  Install globally:
152
143
 
@@ -205,7 +196,7 @@ Every `delegate_tasks` response envelope — both `full` mode and `summary` mode
205
196
 
206
197
  When a batch declares mixed parent models across its tasks, the ROI multiplier is suppressed (because a single ratio across different baselines is not coherent) and the cost clause reads `$X actual / $Y saved vs multiple baselines`. When no `parentModel` is declared, the cost clause collapses to `$X actual`.
207
198
 
208
- If the primary response came back via summary mode or a client-side limit obscured the envelope, call `get_batch_telemetry(batchId)` — it returns the same `headline` plus the envelope with a ~600-byte header and ~200 bytes per task in `results[]`. A typical 10–30-task batch comes back at 2–7 KB, well under the client's tool-result size limit; very large batches (100+ tasks) scale linearly and may approach the limit.
199
+ If the primary response came back via summary mode or a client-side limit obscured the envelope, call `get_batch_slice({ batchId, slice: 'telemetry' })` — it returns the same `headline` plus the envelope with a ~600-byte header and ~200 bytes per task in `results[]`. A typical 10–30-task batch comes back at 2–7 KB, well under the client's tool-result size limit; very large batches (100+ tasks) scale linearly and may approach the limit.
209
200
 
210
201
  ## Security
211
202
 
package/dist/cli.d.ts CHANGED
@@ -8,25 +8,11 @@ export declare function computeTimings(wallClockMs: number, results: RunResult[]
8
8
  export declare function computeBatchProgress(results: RunResult[]): BatchProgress;
9
9
  export declare function computeAggregateCost(results: RunResult[]): BatchAggregateCost;
10
10
  export declare const SERVER_VERSION: string;
11
- export declare function buildTaskSchema(availableProviders: [string, ...string[]]): z.ZodObject<{
11
+ export declare function buildTaskSchema(availableAgents: [string, ...string[]]): z.ZodObject<{
12
12
  prompt: z.ZodString;
13
- provider: z.ZodOptional<z.ZodEnum<{
13
+ agentType: z.ZodOptional<z.ZodEnum<{
14
14
  [x: string]: string;
15
15
  }>>;
16
- tier: z.ZodEnum<{
17
- reasoning: "reasoning";
18
- standard: "standard";
19
- trivial: "trivial";
20
- }>;
21
- requiredCapabilities: z.ZodArray<z.ZodEnum<{
22
- file_read: "file_read";
23
- file_write: "file_write";
24
- grep: "grep";
25
- glob: "glob";
26
- shell: "shell";
27
- web_search: "web_search";
28
- web_fetch: "web_fetch";
29
- }>>;
30
16
  tools: z.ZodOptional<z.ZodEnum<{
31
17
  full: "full";
32
18
  none: "none";
@@ -44,6 +30,7 @@ export declare function buildTaskSchema(availableProviders: [string, ...string[]
44
30
  none: "none";
45
31
  "cwd-only": "cwd-only";
46
32
  }>>;
33
+ requiredCapabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
34
  contextBlockIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
35
  expectedCoverage: z.ZodOptional<z.ZodObject<{
49
36
  minSections: z.ZodOptional<z.ZodNumber>;
@@ -51,8 +38,20 @@ export declare function buildTaskSchema(availableProviders: [string, ...string[]
51
38
  requiredMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
39
  }, z.core.$strip>>;
53
40
  skipCompletionHeuristic: z.ZodOptional<z.ZodBoolean>;
54
- includeProgressTrace: z.ZodOptional<z.ZodBoolean>;
55
41
  parentModel: z.ZodOptional<z.ZodString>;
42
+ maxCostUSD: z.ZodOptional<z.ZodNumber>;
43
+ reviewPolicy: z.ZodOptional<z.ZodEnum<{
44
+ full: "full";
45
+ spec_only: "spec_only";
46
+ off: "off";
47
+ }>>;
48
+ maxReviewRounds: z.ZodOptional<z.ZodNumber>;
49
+ briefQualityPolicy: z.ZodOptional<z.ZodEnum<{
50
+ off: "off";
51
+ normalize: "normalize";
52
+ strict: "strict";
53
+ warn: "warn";
54
+ }>>;
56
55
  }, z.core.$strip>;
57
56
  export declare function buildMcpServer(config: Parameters<typeof runTasks>[1], options?: {
58
57
  /** Character threshold that triggers auto-switch from 'full' to
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,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