ai-sdk-provider-codex-cli 0.5.2 → 0.7.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/dist/index.d.cts CHANGED
@@ -46,9 +46,60 @@ type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
46
46
  type ReasoningSummary = 'auto' | 'detailed';
47
47
  type ReasoningSummaryFormat = 'none' | 'experimental';
48
48
  type ModelVerbosity = 'low' | 'medium' | 'high';
49
+ interface McpServerBase {
50
+ /**
51
+ * Enable/disable this MCP server without removing its definition.
52
+ * Maps to: `mcp_servers.<name>.enabled`
53
+ */
54
+ enabled?: boolean;
55
+ /**
56
+ * Time allowed for the MCP server to start (in seconds).
57
+ * Maps to: `mcp_servers.<name>.startup_timeout_sec`
58
+ */
59
+ startupTimeoutSec?: number;
60
+ /**
61
+ * Max time a single MCP tool call may run (in seconds).
62
+ * Maps to: `mcp_servers.<name>.tool_timeout_sec`
63
+ */
64
+ toolTimeoutSec?: number;
65
+ /**
66
+ * Explicit allow/deny lists for tools exposed by the server.
67
+ * Maps to: `mcp_servers.<name>.enabled_tools` / `disabled_tools`
68
+ */
69
+ enabledTools?: string[];
70
+ disabledTools?: string[];
71
+ }
72
+ interface McpServerStdio extends McpServerBase {
73
+ /** Execute an MCP server over stdio */
74
+ transport: 'stdio';
75
+ /** Command to start the MCP server (e.g., `node`, `python`, or a binary path). */
76
+ command: string;
77
+ /** Arguments passed to the command. */
78
+ args?: string[];
79
+ /** Environment variables passed to the MCP process. */
80
+ env?: Record<string, string>;
81
+ /** Optional working directory for the MCP server process. */
82
+ cwd?: string;
83
+ }
84
+ interface McpServerHttp extends McpServerBase {
85
+ /** Use an HTTP-based MCP server (RMCP). */
86
+ transport: 'http';
87
+ /** Base URL for the MCP server. */
88
+ url: string;
89
+ /** Bearer token supplied inline (use env var variant to avoid embedding secrets). */
90
+ bearerToken?: string;
91
+ /** Name of env var that holds the bearer token. */
92
+ bearerTokenEnvVar?: string;
93
+ /** Static HTTP headers to send with each MCP request. */
94
+ httpHeaders?: Record<string, string>;
95
+ /** Names of env vars whose values should be sent as HTTP headers. */
96
+ envHttpHeaders?: Record<string, string>;
97
+ }
98
+ type McpServerConfig = McpServerStdio | McpServerHttp;
49
99
  interface CodexCliSettings {
50
100
  codexPath?: string;
51
101
  cwd?: string;
102
+ addDirs?: string[];
52
103
  approvalMode?: ApprovalMode;
53
104
  sandboxMode?: SandboxMode;
54
105
  fullAuto?: boolean;
@@ -97,6 +148,16 @@ interface CodexCliSettings {
97
148
  * Maps to: `-c model_verbosity=<value>`
98
149
  */
99
150
  modelVerbosity?: ModelVerbosity;
151
+ /**
152
+ * Configure MCP servers (stdio or HTTP/RMCP). Keys are server names.
153
+ * Each entry maps to the Codex CLI `mcp_servers.<name>` table.
154
+ */
155
+ mcpServers?: Record<string, McpServerConfig>;
156
+ /**
157
+ * Enable the RMCP client so HTTP-based MCP servers can be contacted.
158
+ * Maps to: `-c features.rmcp_client=true`
159
+ */
160
+ rmcpClient?: boolean;
100
161
  /**
101
162
  * Include experimental plan tool that the model can use to update its current plan.
102
163
  *
@@ -169,11 +230,25 @@ interface CodexCliProviderOptions {
169
230
  * Maps to Codex `model_verbosity`.
170
231
  */
171
232
  textVerbosity?: ModelVerbosity;
233
+ /**
234
+ * Per-call override for extra directories Codex can access.
235
+ * Maps to repeated `--add-dir` flags.
236
+ */
237
+ addDirs?: string[];
172
238
  /**
173
239
  * Per-call Codex CLI config overrides. These are merged with
174
240
  * constructor-level overrides with per-call values taking precedence.
175
241
  */
176
242
  configOverrides?: Record<string, string | number | boolean | object>;
243
+ /**
244
+ * Per-call MCP server definitions. Merged with constructor definitions
245
+ * (per-call servers and fields take precedence).
246
+ */
247
+ mcpServers?: Record<string, McpServerConfig>;
248
+ /**
249
+ * Per-call override for RMCP client enablement.
250
+ */
251
+ rmcpClient?: boolean;
177
252
  }
178
253
 
179
254
  interface CodexCliProvider extends ProviderV2 {
@@ -203,8 +278,12 @@ declare class CodexCliLanguageModel implements LanguageModelV2 {
203
278
  private sessionId?;
204
279
  constructor(options: CodexLanguageModelOptions);
205
280
  private mergeSettings;
281
+ private mergeMcpServers;
282
+ private mergeSingleMcpServer;
283
+ private mergeStringRecord;
206
284
  private getItemType;
207
285
  private buildArgs;
286
+ private applyMcpSettings;
208
287
  private addConfigOverride;
209
288
  /**
210
289
  * Serialize a config override value into a CLI-safe string.
package/dist/index.d.ts CHANGED
@@ -46,9 +46,60 @@ type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
46
46
  type ReasoningSummary = 'auto' | 'detailed';
47
47
  type ReasoningSummaryFormat = 'none' | 'experimental';
48
48
  type ModelVerbosity = 'low' | 'medium' | 'high';
49
+ interface McpServerBase {
50
+ /**
51
+ * Enable/disable this MCP server without removing its definition.
52
+ * Maps to: `mcp_servers.<name>.enabled`
53
+ */
54
+ enabled?: boolean;
55
+ /**
56
+ * Time allowed for the MCP server to start (in seconds).
57
+ * Maps to: `mcp_servers.<name>.startup_timeout_sec`
58
+ */
59
+ startupTimeoutSec?: number;
60
+ /**
61
+ * Max time a single MCP tool call may run (in seconds).
62
+ * Maps to: `mcp_servers.<name>.tool_timeout_sec`
63
+ */
64
+ toolTimeoutSec?: number;
65
+ /**
66
+ * Explicit allow/deny lists for tools exposed by the server.
67
+ * Maps to: `mcp_servers.<name>.enabled_tools` / `disabled_tools`
68
+ */
69
+ enabledTools?: string[];
70
+ disabledTools?: string[];
71
+ }
72
+ interface McpServerStdio extends McpServerBase {
73
+ /** Execute an MCP server over stdio */
74
+ transport: 'stdio';
75
+ /** Command to start the MCP server (e.g., `node`, `python`, or a binary path). */
76
+ command: string;
77
+ /** Arguments passed to the command. */
78
+ args?: string[];
79
+ /** Environment variables passed to the MCP process. */
80
+ env?: Record<string, string>;
81
+ /** Optional working directory for the MCP server process. */
82
+ cwd?: string;
83
+ }
84
+ interface McpServerHttp extends McpServerBase {
85
+ /** Use an HTTP-based MCP server (RMCP). */
86
+ transport: 'http';
87
+ /** Base URL for the MCP server. */
88
+ url: string;
89
+ /** Bearer token supplied inline (use env var variant to avoid embedding secrets). */
90
+ bearerToken?: string;
91
+ /** Name of env var that holds the bearer token. */
92
+ bearerTokenEnvVar?: string;
93
+ /** Static HTTP headers to send with each MCP request. */
94
+ httpHeaders?: Record<string, string>;
95
+ /** Names of env vars whose values should be sent as HTTP headers. */
96
+ envHttpHeaders?: Record<string, string>;
97
+ }
98
+ type McpServerConfig = McpServerStdio | McpServerHttp;
49
99
  interface CodexCliSettings {
50
100
  codexPath?: string;
51
101
  cwd?: string;
102
+ addDirs?: string[];
52
103
  approvalMode?: ApprovalMode;
53
104
  sandboxMode?: SandboxMode;
54
105
  fullAuto?: boolean;
@@ -97,6 +148,16 @@ interface CodexCliSettings {
97
148
  * Maps to: `-c model_verbosity=<value>`
98
149
  */
99
150
  modelVerbosity?: ModelVerbosity;
151
+ /**
152
+ * Configure MCP servers (stdio or HTTP/RMCP). Keys are server names.
153
+ * Each entry maps to the Codex CLI `mcp_servers.<name>` table.
154
+ */
155
+ mcpServers?: Record<string, McpServerConfig>;
156
+ /**
157
+ * Enable the RMCP client so HTTP-based MCP servers can be contacted.
158
+ * Maps to: `-c features.rmcp_client=true`
159
+ */
160
+ rmcpClient?: boolean;
100
161
  /**
101
162
  * Include experimental plan tool that the model can use to update its current plan.
102
163
  *
@@ -169,11 +230,25 @@ interface CodexCliProviderOptions {
169
230
  * Maps to Codex `model_verbosity`.
170
231
  */
171
232
  textVerbosity?: ModelVerbosity;
233
+ /**
234
+ * Per-call override for extra directories Codex can access.
235
+ * Maps to repeated `--add-dir` flags.
236
+ */
237
+ addDirs?: string[];
172
238
  /**
173
239
  * Per-call Codex CLI config overrides. These are merged with
174
240
  * constructor-level overrides with per-call values taking precedence.
175
241
  */
176
242
  configOverrides?: Record<string, string | number | boolean | object>;
243
+ /**
244
+ * Per-call MCP server definitions. Merged with constructor definitions
245
+ * (per-call servers and fields take precedence).
246
+ */
247
+ mcpServers?: Record<string, McpServerConfig>;
248
+ /**
249
+ * Per-call override for RMCP client enablement.
250
+ */
251
+ rmcpClient?: boolean;
177
252
  }
178
253
 
179
254
  interface CodexCliProvider extends ProviderV2 {
@@ -203,8 +278,12 @@ declare class CodexCliLanguageModel implements LanguageModelV2 {
203
278
  private sessionId?;
204
279
  constructor(options: CodexLanguageModelOptions);
205
280
  private mergeSettings;
281
+ private mergeMcpServers;
282
+ private mergeSingleMcpServer;
283
+ private mergeStringRecord;
206
284
  private getItemType;
207
285
  private buildArgs;
286
+ private applyMcpSettings;
208
287
  private addConfigOverride;
209
288
  /**
210
289
  * Serialize a config override value into a CLI-safe string.