mcp-agents 0.3.2 → 0.3.6
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 +43 -5
- package/package.json +1 -1
- package/server.js +66 -16
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ Each `--provider` flag maps to a single exposed tool:
|
|
|
36
36
|
|----------|-----------|-------------|
|
|
37
37
|
| `claude` | `claude_code` | `claude -p <prompt>` |
|
|
38
38
|
| `gemini` | `gemini` | `gemini [-s] -p <prompt>` |
|
|
39
|
+
| `codex` | *(pass-through)* | `codex mcp-server` |
|
|
39
40
|
|
|
40
41
|
### `claude_code` parameters
|
|
41
42
|
|
|
@@ -52,12 +53,49 @@ Each `--provider` flag maps to a single exposed tool:
|
|
|
52
53
|
| `sandbox` | `boolean` | no | Run in sandbox mode (`-s` flag) |
|
|
53
54
|
| `timeout_ms` | `integer` | no | Timeout in ms (default: 120 000) |
|
|
54
55
|
|
|
55
|
-
### `codex`
|
|
56
|
+
### `codex` (pass-through)
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
|
58
|
+
The codex provider passes through to Codex's native MCP server (`codex mcp-server`)
|
|
59
|
+
with configurable flags:
|
|
60
|
+
|
|
61
|
+
| CLI Flag | Default | Codex flag |
|
|
62
|
+
|----------|---------|------------|
|
|
63
|
+
| `--model` | `gpt-5.3-codex` | `-m <model>` |
|
|
64
|
+
| `--model_reasoning_effort` | `high` | `-c model_reasoning_effort=<value>` |
|
|
65
|
+
|
|
66
|
+
Hardcoded defaults: `-s read-only -a never` (safe for MCP server mode).
|
|
67
|
+
|
|
68
|
+
## Integration with Claude Code
|
|
69
|
+
|
|
70
|
+
Add entries to your project's `.mcp.json`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"codex": {
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": ["-y", "mcp-agents@latest", "--provider", "codex"]
|
|
78
|
+
},
|
|
79
|
+
"gemini": {
|
|
80
|
+
"command": "npx",
|
|
81
|
+
"args": ["-y", "mcp-agents@latest", "--provider", "gemini"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Override codex defaults:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcpServers": {
|
|
92
|
+
"codex": {
|
|
93
|
+
"command": "npx",
|
|
94
|
+
"args": ["-y", "mcp-agents@latest", "--provider", "codex", "--model", "o3-pro", "--model_reasoning_effort", "medium"]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
61
99
|
|
|
62
100
|
## Integration with OpenAI Codex
|
|
63
101
|
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
-
import { execFile } from "node:child_process";
|
|
4
|
+
import { execFile, spawn } from "node:child_process";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
@@ -52,11 +52,7 @@ const CLI_BACKENDS = {
|
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
codex: {
|
|
55
|
-
|
|
56
|
-
toolName: "codex",
|
|
57
|
-
description: "Run Codex CLI (codex exec) with a prompt.",
|
|
58
|
-
buildArgs: (prompt) => ["exec", prompt],
|
|
59
|
-
extraProperties: {},
|
|
55
|
+
passthrough: true,
|
|
60
56
|
},
|
|
61
57
|
};
|
|
62
58
|
|
|
@@ -93,19 +89,23 @@ function printHelp() {
|
|
|
93
89
|
Usage: mcp-agents [options]
|
|
94
90
|
|
|
95
91
|
Options:
|
|
96
|
-
--provider <name>
|
|
97
|
-
--
|
|
98
|
-
--
|
|
92
|
+
--provider <name> CLI backend to use (${providers}) [default: codex]
|
|
93
|
+
--model <model> Model to use (codex) [default: gpt-5.3-codex]
|
|
94
|
+
--model_reasoning_effort <e> Reasoning effort (codex) [default: high]
|
|
95
|
+
--help, -h Show this help message
|
|
96
|
+
--version, -v Show version number`);
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
/**
|
|
102
100
|
* Parse CLI flags from process.argv.
|
|
103
|
-
* Handles --help, --version, --provider, and unknown flags.
|
|
104
|
-
* @returns {
|
|
101
|
+
* Handles --help, --version, --provider, --model, --model_reasoning_effort, and unknown flags.
|
|
102
|
+
* @returns {{ provider: string, model?: string, modelReasoningEffort?: string }}
|
|
105
103
|
*/
|
|
106
104
|
function parseArgs() {
|
|
107
105
|
const args = process.argv.slice(2);
|
|
108
106
|
let provider = "codex";
|
|
107
|
+
let model;
|
|
108
|
+
let modelReasoningEffort;
|
|
109
109
|
|
|
110
110
|
for (let i = 0; i < args.length; i++) {
|
|
111
111
|
switch (args[i]) {
|
|
@@ -126,13 +126,29 @@ function parseArgs() {
|
|
|
126
126
|
}
|
|
127
127
|
provider = args[++i];
|
|
128
128
|
break;
|
|
129
|
+
case "--model":
|
|
130
|
+
if (i + 1 >= args.length) {
|
|
131
|
+
process.stderr.write("error: --model requires a value\n");
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
model = args[++i];
|
|
135
|
+
break;
|
|
136
|
+
case "--model_reasoning_effort":
|
|
137
|
+
if (i + 1 >= args.length) {
|
|
138
|
+
process.stderr.write(
|
|
139
|
+
"error: --model_reasoning_effort requires a value\n",
|
|
140
|
+
);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
modelReasoningEffort = args[++i];
|
|
144
|
+
break;
|
|
129
145
|
default:
|
|
130
146
|
process.stderr.write(`error: unknown option: ${args[i]}\n`);
|
|
131
147
|
process.exit(1);
|
|
132
148
|
}
|
|
133
149
|
}
|
|
134
150
|
|
|
135
|
-
return provider;
|
|
151
|
+
return { provider, model, modelReasoningEffort };
|
|
136
152
|
}
|
|
137
153
|
|
|
138
154
|
/**
|
|
@@ -183,23 +199,57 @@ function runCli(command, args, opts = {}) {
|
|
|
183
199
|
});
|
|
184
200
|
}
|
|
185
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Spawn codex mcp-server as a pass-through, piping stdio directly.
|
|
204
|
+
* @param {{ model?: string, modelReasoningEffort?: string }} opts
|
|
205
|
+
*/
|
|
206
|
+
function runCodexPassthrough({ model, modelReasoningEffort }) {
|
|
207
|
+
const args = [
|
|
208
|
+
"-m",
|
|
209
|
+
model || "gpt-5.3-codex",
|
|
210
|
+
"-s",
|
|
211
|
+
"read-only",
|
|
212
|
+
"-a",
|
|
213
|
+
"never",
|
|
214
|
+
"-c",
|
|
215
|
+
`model_reasoning_effort=${modelReasoningEffort || "high"}`,
|
|
216
|
+
"mcp-server",
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
logErr(`[mcp-agents] passthrough: codex ${args.join(" ")}`);
|
|
220
|
+
|
|
221
|
+
const child = spawn("codex", args, { stdio: "inherit" });
|
|
222
|
+
|
|
223
|
+
child.on("error", (err) => {
|
|
224
|
+
logErr(`[mcp-agents] failed to start codex: ${err.message}`);
|
|
225
|
+
process.exitCode = 1;
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
child.on("exit", (code) => {
|
|
229
|
+
process.exitCode = code ?? 1;
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
186
233
|
// ---------------------------------------------------------------------------
|
|
187
234
|
// Main
|
|
188
235
|
// ---------------------------------------------------------------------------
|
|
189
236
|
|
|
190
237
|
async function main() {
|
|
191
|
-
const providerName = parseArgs();
|
|
238
|
+
const { provider: providerName, model, modelReasoningEffort } = parseArgs();
|
|
192
239
|
const backend = CLI_BACKENDS[providerName];
|
|
193
240
|
|
|
194
241
|
if (!backend) {
|
|
195
242
|
logErr(`[mcp-agents] Unknown provider: ${providerName}`);
|
|
196
|
-
logErr(
|
|
197
|
-
`[mcp-agents] Available: ${Object.keys(CLI_BACKENDS).join(", ")}`,
|
|
198
|
-
);
|
|
243
|
+
logErr(`[mcp-agents] Available: ${Object.keys(CLI_BACKENDS).join(", ")}`);
|
|
199
244
|
process.exitCode = 1;
|
|
200
245
|
return;
|
|
201
246
|
}
|
|
202
247
|
|
|
248
|
+
if (backend.passthrough) {
|
|
249
|
+
runCodexPassthrough({ model, modelReasoningEffort });
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
203
253
|
const server = new Server(
|
|
204
254
|
{ name: "mcp-agents", version: VERSION },
|
|
205
255
|
{ capabilities: { tools: {} } },
|