n8n-nodes-claude-code-cli 1.6.0 → 1.8.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.
@@ -174132,6 +174132,148 @@ var agentsDescription = [
174132
174132
  }
174133
174133
  ];
174134
174134
 
174135
+ // nodes/ClaudeCode/descriptions/mcpServersDescription.ts
174136
+ var mcpServersDescription = [
174137
+ {
174138
+ displayName: "MCP Servers",
174139
+ name: "mcpServers",
174140
+ type: "fixedCollection",
174141
+ typeOptions: {
174142
+ multipleValues: true,
174143
+ multipleValueButtonText: "Add MCP Server"
174144
+ },
174145
+ default: { serversList: [] },
174146
+ displayOptions: {
174147
+ show: {
174148
+ operation: ["executePrompt", "executeWithContext"]
174149
+ }
174150
+ },
174151
+ options: [
174152
+ {
174153
+ name: "serversList",
174154
+ displayName: "Servers",
174155
+ values: [
174156
+ {
174157
+ displayName: "Server Name",
174158
+ name: "name",
174159
+ type: "string",
174160
+ default: "",
174161
+ required: true,
174162
+ placeholder: "slack",
174163
+ description: "Unique identifier for this MCP server."
174164
+ },
174165
+ {
174166
+ displayName: "Transport Type",
174167
+ name: "serverType",
174168
+ type: "options",
174169
+ options: [
174170
+ { name: "Stdio", value: "stdio" },
174171
+ { name: "HTTP", value: "http" }
174172
+ ],
174173
+ default: "stdio",
174174
+ description: "Transport protocol for communicating with the MCP server."
174175
+ },
174176
+ {
174177
+ displayName: "Command",
174178
+ name: "command",
174179
+ type: "string",
174180
+ default: "",
174181
+ required: true,
174182
+ placeholder: "npx -y @modelcontextprotocol/server-slack",
174183
+ description: "Full command to launch the MCP server. Arguments after the executable are automatically extracted (e.g. 'npx -y @org/server --key val' becomes command='npx', args=['-y','@org/server','--key','val']).",
174184
+ displayOptions: {
174185
+ show: {
174186
+ serverType: ["stdio"]
174187
+ }
174188
+ }
174189
+ },
174190
+ {
174191
+ displayName: "Arguments",
174192
+ name: "args",
174193
+ type: "string",
174194
+ default: "",
174195
+ placeholder: "--port,3000,--verbose",
174196
+ description: "Comma-separated arguments to pass to the command.",
174197
+ displayOptions: {
174198
+ show: {
174199
+ serverType: ["stdio"]
174200
+ }
174201
+ }
174202
+ },
174203
+ {
174204
+ displayName: "Environment Variables",
174205
+ name: "env",
174206
+ type: "string",
174207
+ typeOptions: { rows: 2 },
174208
+ default: "",
174209
+ placeholder: '{"SLACK_TOKEN": "xoxb-..."}',
174210
+ description: "JSON object of environment variables for the server process.",
174211
+ displayOptions: {
174212
+ show: {
174213
+ serverType: ["stdio"]
174214
+ }
174215
+ }
174216
+ },
174217
+ {
174218
+ displayName: "URL",
174219
+ name: "url",
174220
+ type: "string",
174221
+ default: "",
174222
+ required: true,
174223
+ placeholder: "https://mcp.example.com/sse",
174224
+ description: "HTTP endpoint URL of the MCP server.",
174225
+ displayOptions: {
174226
+ show: {
174227
+ serverType: ["http"]
174228
+ }
174229
+ }
174230
+ },
174231
+ {
174232
+ displayName: "Headers",
174233
+ name: "headers",
174234
+ type: "string",
174235
+ typeOptions: { rows: 2 },
174236
+ default: "",
174237
+ placeholder: '{"Authorization": "Bearer ..."}',
174238
+ description: "JSON object of HTTP headers to send with requests.",
174239
+ displayOptions: {
174240
+ show: {
174241
+ serverType: ["http"]
174242
+ }
174243
+ }
174244
+ }
174245
+ ]
174246
+ }
174247
+ ],
174248
+ description: "Define MCP servers to inject into the Claude Code session. Servers provide external tools (Slack, GitHub, databases, etc.)."
174249
+ },
174250
+ {
174251
+ displayName: "MCP Config File Paths",
174252
+ name: "mcpConfigFilePaths",
174253
+ type: "string",
174254
+ default: "",
174255
+ placeholder: "/path/to/mcp-config.json, /path/to/another.json",
174256
+ description: "Comma-separated file paths to MCP configuration files. Each file is passed as a separate --mcp-config argument.",
174257
+ displayOptions: {
174258
+ show: {
174259
+ operation: ["executePrompt", "executeWithContext"]
174260
+ }
174261
+ }
174262
+ },
174263
+ {
174264
+ displayName: "MCP Strict Mode",
174265
+ name: "mcpStrictMode",
174266
+ type: "boolean",
174267
+ default: false,
174268
+ description: "Whether to enable strict MCP config mode. When enabled, Claude Code will fail if any MCP server cannot be started.",
174269
+ displayOptions: {
174270
+ show: {
174271
+ operation: ["executePrompt", "executeWithContext"]
174272
+ }
174273
+ }
174274
+ }
174275
+ ];
174276
+
174135
174277
  // nodes/ClaudeCode/descriptions/optionsDescription.ts
174136
174278
  var optionsDescription = [
174137
174279
  {
@@ -174161,6 +174303,18 @@ var optionsDescription = [
174161
174303
  default: "json",
174162
174304
  description: "Output format for Claude Code response. Stream JSON captures all tool interactions as streaming events."
174163
174305
  },
174306
+ {
174307
+ displayName: "Reasoning Effort",
174308
+ name: "effort",
174309
+ type: "options",
174310
+ options: [
174311
+ { name: "Low", value: "low" },
174312
+ { name: "Medium", value: "medium" },
174313
+ { name: "High", value: "high" }
174314
+ ],
174315
+ default: "high",
174316
+ description: "Controls the reasoning effort level. Low = fast and cheap, High = deep thinking. Useful for workflows where some tasks are simple (summary, extraction) vs complex (refactoring)."
174317
+ },
174164
174318
  {
174165
174319
  displayName: "Max Turns",
174166
174320
  name: "maxTurns",
@@ -174175,6 +174329,25 @@ var optionsDescription = [
174175
174329
  default: 300,
174176
174330
  description: "Execution timeout in seconds. Maximum: 3600 (1 hour)."
174177
174331
  },
174332
+ {
174333
+ displayName: "System Prompt Mode",
174334
+ name: "systemPromptMode",
174335
+ type: "options",
174336
+ options: [
174337
+ {
174338
+ name: "Append",
174339
+ value: "append",
174340
+ description: "Append to Claude Code default system prompt"
174341
+ },
174342
+ {
174343
+ name: "Replace",
174344
+ value: "replace",
174345
+ description: "Replace the entire Claude Code default system prompt"
174346
+ }
174347
+ ],
174348
+ default: "append",
174349
+ description: "Whether to append to or replace the default Claude Code system prompt. Replace gives full control over system instructions."
174350
+ },
174178
174351
  {
174179
174352
  displayName: "System Prompt",
174180
174353
  name: "systemPrompt",
@@ -174184,7 +174357,7 @@ var optionsDescription = [
174184
174357
  },
174185
174358
  default: "",
174186
174359
  placeholder: "You are a helpful code reviewer...",
174187
- description: "Additional system prompt to append to Claude Code default system prompt"
174360
+ description: "System prompt text. Behavior depends on System Prompt Mode: Append adds to the default prompt, Replace overrides it entirely."
174188
174361
  },
174189
174362
  {
174190
174363
  displayName: "System Prompt File",
@@ -174192,7 +174365,7 @@ var optionsDescription = [
174192
174365
  type: "string",
174193
174366
  default: "",
174194
174367
  placeholder: "/path/to/system-prompt.txt",
174195
- description: "Path to a file containing additional system prompt text to append to Claude Code default system prompt. Use this instead of inline System Prompt for long or reusable prompts."
174368
+ description: "Path to a file containing system prompt text. Behavior depends on System Prompt Mode: Append adds to the default prompt, Replace overrides it entirely."
174196
174369
  },
174197
174370
  {
174198
174371
  displayName: "Verbose",
@@ -174208,6 +174381,13 @@ var optionsDescription = [
174208
174381
  default: 0,
174209
174382
  description: "Maximum dollar amount to spend before stopping execution. 0 means unlimited. Critical for controlling costs in automated workflows."
174210
174383
  },
174384
+ {
174385
+ displayName: "Max Output Tokens",
174386
+ name: "maxOutputTokens",
174387
+ type: "number",
174388
+ default: 0,
174389
+ description: "Maximum number of tokens in the output. 0 means unlimited. Useful for controlling costs and avoiding overly long responses in automated workflows. Sets CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable."
174390
+ },
174211
174391
  {
174212
174392
  displayName: "JSON Schema",
174213
174393
  name: "jsonSchema",
@@ -174305,14 +174485,25 @@ function buildCommand(options, credentials) {
174305
174485
  );
174306
174486
  }
174307
174487
  if (options.systemPrompt) {
174308
- args.push("--append-system-prompt", options.systemPrompt);
174488
+ if (options.systemPromptMode === "replace") {
174489
+ args.push("--system-prompt", options.systemPrompt);
174490
+ } else {
174491
+ args.push("--append-system-prompt", options.systemPrompt);
174492
+ }
174309
174493
  }
174310
174494
  if (options.systemPromptFile) {
174311
- args.push("--append-system-prompt-file", options.systemPromptFile);
174495
+ if (options.systemPromptMode === "replace") {
174496
+ args.push("--system-prompt-file", options.systemPromptFile);
174497
+ } else {
174498
+ args.push("--append-system-prompt-file", options.systemPromptFile);
174499
+ }
174312
174500
  }
174313
174501
  if (options.verbose && options.outputFormat !== "stream-json") {
174314
174502
  args.push("--verbose");
174315
174503
  }
174504
+ if (options.effort && options.effort !== "high") {
174505
+ args.push("--effort", options.effort);
174506
+ }
174316
174507
  if (options.maxBudgetUsd && options.maxBudgetUsd > 0) {
174317
174508
  args.push("--max-budget-usd", String(options.maxBudgetUsd));
174318
174509
  }
@@ -174344,12 +174535,31 @@ function buildCommand(options, credentials) {
174344
174535
  if (options.agents && Object.keys(options.agents).length > 0) {
174345
174536
  args.push("--agents", JSON.stringify(options.agents));
174346
174537
  }
174538
+ if (options.mcpConfig) {
174539
+ if (options.mcpConfig.inlineServers && Object.keys(options.mcpConfig.inlineServers).length > 0) {
174540
+ args.push(
174541
+ "--mcp-config",
174542
+ JSON.stringify({ mcpServers: options.mcpConfig.inlineServers })
174543
+ );
174544
+ }
174545
+ if (options.mcpConfig.configFilePaths && options.mcpConfig.configFilePaths.length > 0) {
174546
+ for (const filePath of options.mcpConfig.configFilePaths) {
174547
+ args.push("--mcp-config", filePath);
174548
+ }
174549
+ }
174550
+ if (options.mcpConfig.strictMode) {
174551
+ args.push("--strict-mcp-config");
174552
+ }
174553
+ }
174347
174554
  if (options.additionalArgs && options.additionalArgs.length > 0) {
174348
174555
  args.push(...options.additionalArgs);
174349
174556
  }
174350
174557
  if (options.extendedContext === false) {
174351
174558
  env.CLAUDE_CODE_DISABLE_1M_CONTEXT = "1";
174352
174559
  }
174560
+ if (options.maxOutputTokens && options.maxOutputTokens > 0) {
174561
+ env.CLAUDE_CODE_MAX_OUTPUT_TOKENS = String(options.maxOutputTokens);
174562
+ }
174353
174563
  if ("envVars" in credentials && credentials.envVars) {
174354
174564
  const envVarsString = credentials.envVars;
174355
174565
  if (envVarsString && envVarsString !== "{}") {
@@ -174582,6 +174792,63 @@ function buildExecutionOptions(context, itemIndex, operation) {
174582
174792
  agents[agent.name] = def;
174583
174793
  }
174584
174794
  }
174795
+ const mcpServersData = context.getNodeParameter("mcpServers", itemIndex, {
174796
+ serversList: []
174797
+ });
174798
+ const mcpConfigFilePathsRaw = context.getNodeParameter(
174799
+ "mcpConfigFilePaths",
174800
+ itemIndex,
174801
+ ""
174802
+ );
174803
+ const mcpStrictMode = context.getNodeParameter(
174804
+ "mcpStrictMode",
174805
+ itemIndex,
174806
+ false
174807
+ );
174808
+ let mcpConfig;
174809
+ const hasInlineServers = mcpServersData.serversList && mcpServersData.serversList.length > 0;
174810
+ const configFilePaths = mcpConfigFilePathsRaw ? mcpConfigFilePathsRaw.split(",").map((p) => p.trim()).filter(Boolean) : [];
174811
+ const hasConfigFiles = configFilePaths.length > 0;
174812
+ if (hasInlineServers || hasConfigFiles || mcpStrictMode) {
174813
+ mcpConfig = {};
174814
+ if (hasInlineServers) {
174815
+ mcpConfig.inlineServers = {};
174816
+ for (const server of mcpServersData.serversList) {
174817
+ let def;
174818
+ if (server.serverType === "http") {
174819
+ def = {
174820
+ type: "http",
174821
+ url: server.url
174822
+ };
174823
+ if (server.headers) {
174824
+ def.headers = JSON.parse(server.headers);
174825
+ }
174826
+ } else {
174827
+ const commandParts = server.command.split(/\s+/).filter(Boolean);
174828
+ const executable = commandParts[0];
174829
+ const commandArgs = commandParts.slice(1);
174830
+ const explicitArgs = server.args ? server.args.split(",").map((a) => a.trim()).filter(Boolean) : [];
174831
+ const allArgs = [...commandArgs, ...explicitArgs];
174832
+ def = {
174833
+ command: executable
174834
+ };
174835
+ if (allArgs.length > 0) {
174836
+ def.args = allArgs;
174837
+ }
174838
+ if (server.env) {
174839
+ def.env = JSON.parse(server.env);
174840
+ }
174841
+ }
174842
+ mcpConfig.inlineServers[server.name] = def;
174843
+ }
174844
+ }
174845
+ if (hasConfigFiles) {
174846
+ mcpConfig.configFilePaths = configFilePaths;
174847
+ }
174848
+ if (mcpStrictMode) {
174849
+ mcpConfig.strictMode = true;
174850
+ }
174851
+ }
174585
174852
  return {
174586
174853
  prompt,
174587
174854
  workingDirectory: options.workingDirectory,
@@ -174596,13 +174863,17 @@ function buildExecutionOptions(context, itemIndex, operation) {
174596
174863
  timeout: options.timeout || 300,
174597
174864
  systemPrompt: options.systemPrompt || void 0,
174598
174865
  systemPromptFile: options.systemPromptFile || void 0,
174866
+ systemPromptMode: options.systemPromptMode || void 0,
174599
174867
  verbose: options.verbose || void 0,
174600
174868
  maxBudgetUsd: options.maxBudgetUsd || void 0,
174601
174869
  jsonSchema: options.jsonSchema || void 0,
174602
174870
  fallbackModel: options.fallbackModel || void 0,
174603
174871
  agents,
174872
+ mcpConfig,
174604
174873
  extendedContext: options.extendedContext !== false,
174605
- worktree: options.worktreeEnabled ? options.worktreeName || "" : void 0
174874
+ worktree: options.worktreeEnabled ? options.worktreeName || "" : void 0,
174875
+ effort: options.effort && options.effort !== "high" ? options.effort : void 0,
174876
+ maxOutputTokens: options.maxOutputTokens || void 0
174606
174877
  };
174607
174878
  }
174608
174879
 
@@ -174770,9 +175041,15 @@ var LocalExecutor = class {
174770
175041
  };
174771
175042
 
174772
175043
  // nodes/ClaudeCode/transport/SshExecutor.ts
174773
- var import_ssh2 = require("ssh2");
174774
175044
  var import_node_fs = require("node:fs");
174775
175045
  var import_node_os = require("node:os");
175046
+ function loadSsh2() {
175047
+ return import("ssh2").catch(() => {
175048
+ throw new Error(
175049
+ 'SSH transport requires the "ssh2" package. Install it with: npm install ssh2'
175050
+ );
175051
+ });
175052
+ }
174776
175053
  var SshExecutor = class {
174777
175054
  credentials;
174778
175055
  constructor(credentials) {
@@ -174824,169 +175101,190 @@ var SshExecutor = class {
174824
175101
  * Execute a Claude Code command via SSH
174825
175102
  */
174826
175103
  execute(options) {
174827
- return new Promise((resolve) => {
174828
- const startTime = Date.now();
174829
- const remoteCmd = this.buildRemoteCommand(options);
174830
- let sshConfig;
174831
- try {
174832
- sshConfig = this.buildSshConfig();
174833
- } catch (err) {
174834
- const duration = Date.now() - startTime;
174835
- resolve(createErrorResult(err.message, 1, duration));
174836
- return;
174837
- }
174838
- const timeoutMs = options.timeout ? options.timeout * 1e3 : 3e5;
174839
- let stdout = "";
174840
- let stderr = "";
174841
- let connectionClosed = false;
174842
- const conn = new import_ssh2.Client();
174843
- const connectionTimeout = setTimeout(() => {
174844
- if (!connectionClosed) {
174845
- connectionClosed = true;
174846
- conn.end();
174847
- const duration = Date.now() - startTime;
174848
- resolve(createErrorResult("SSH connection timeout", 1, duration));
174849
- }
174850
- }, timeoutMs);
174851
- conn.on("ready", () => {
174852
- conn.exec(remoteCmd, { pty: false }, (err, stream2) => {
174853
- if (err) {
174854
- clearTimeout(connectionTimeout);
175104
+ const startTime = Date.now();
175105
+ const remoteCmd = this.buildRemoteCommand(options);
175106
+ let sshConfig;
175107
+ try {
175108
+ sshConfig = this.buildSshConfig();
175109
+ } catch (err) {
175110
+ const duration = Date.now() - startTime;
175111
+ return Promise.resolve(
175112
+ createErrorResult(err.message, 1, duration)
175113
+ );
175114
+ }
175115
+ return loadSsh2().then((ssh2) => {
175116
+ return new Promise((resolve) => {
175117
+ const timeoutMs = options.timeout ? options.timeout * 1e3 : 3e5;
175118
+ let stdout = "";
175119
+ let stderr = "";
175120
+ let connectionClosed = false;
175121
+ const conn = new ssh2.Client();
175122
+ const connectionTimeout = setTimeout(() => {
175123
+ if (!connectionClosed) {
174855
175124
  connectionClosed = true;
174856
175125
  conn.end();
174857
175126
  const duration = Date.now() - startTime;
174858
- resolve(
174859
- createErrorResult(`SSH exec error: ${err.message}`, 1, duration)
174860
- );
174861
- return;
175127
+ resolve(createErrorResult("SSH connection timeout", 1, duration));
174862
175128
  }
174863
- let exitCode = null;
174864
- let streamClosed = false;
174865
- const handleCompletion = () => {
174866
- if (streamClosed && exitCode !== null && !connectionClosed) {
175129
+ }, timeoutMs);
175130
+ conn.on("ready", () => {
175131
+ conn.exec(remoteCmd, { pty: false }, (err, stream2) => {
175132
+ if (err) {
174867
175133
  clearTimeout(connectionTimeout);
174868
175134
  connectionClosed = true;
174869
175135
  conn.end();
174870
175136
  const duration = Date.now() - startTime;
174871
- const code = exitCode ?? 0;
174872
- if (options.outputFormat === "json") {
174873
- const parsed = parseJsonOutput(stdout);
174874
- resolve(normalizeOutput(parsed, code, duration, stderr));
174875
- } else if (options.outputFormat === "stream-json") {
174876
- const { events, result } = parseStreamJsonOutput(stdout);
174877
- resolve(
174878
- normalizeStreamOutput(events, result, code, duration, stderr)
174879
- );
174880
- } else {
174881
- resolve({
174882
- success: code === 0,
174883
- sessionId: "",
174884
- output: stdout,
174885
- exitCode: code,
174886
- duration,
174887
- error: code !== 0 ? stderr : void 0
174888
- });
174889
- }
174890
- }
174891
- };
174892
- stream2.on("exit", (code) => {
174893
- exitCode = code ?? 0;
174894
- handleCompletion();
174895
- });
174896
- stream2.on("close", () => {
174897
- streamClosed = true;
174898
- if (exitCode === null) {
174899
- exitCode = 0;
175137
+ resolve(
175138
+ createErrorResult(
175139
+ `SSH exec error: ${err.message}`,
175140
+ 1,
175141
+ duration
175142
+ )
175143
+ );
175144
+ return;
174900
175145
  }
174901
- handleCompletion();
174902
- });
174903
- stream2.on("data", (data) => {
174904
- stdout += data.toString();
174905
- });
174906
- stream2.stderr.on("data", (data) => {
174907
- stderr += data.toString();
175146
+ let exitCode = null;
175147
+ let streamClosed = false;
175148
+ const handleCompletion = () => {
175149
+ if (streamClosed && exitCode !== null && !connectionClosed) {
175150
+ clearTimeout(connectionTimeout);
175151
+ connectionClosed = true;
175152
+ conn.end();
175153
+ const duration = Date.now() - startTime;
175154
+ const code = exitCode ?? 0;
175155
+ if (options.outputFormat === "json") {
175156
+ const parsed = parseJsonOutput(stdout);
175157
+ resolve(normalizeOutput(parsed, code, duration, stderr));
175158
+ } else if (options.outputFormat === "stream-json") {
175159
+ const { events, result } = parseStreamJsonOutput(stdout);
175160
+ resolve(
175161
+ normalizeStreamOutput(
175162
+ events,
175163
+ result,
175164
+ code,
175165
+ duration,
175166
+ stderr
175167
+ )
175168
+ );
175169
+ } else {
175170
+ resolve({
175171
+ success: code === 0,
175172
+ sessionId: "",
175173
+ output: stdout,
175174
+ exitCode: code,
175175
+ duration,
175176
+ error: code !== 0 ? stderr : void 0
175177
+ });
175178
+ }
175179
+ }
175180
+ };
175181
+ stream2.on("exit", (code) => {
175182
+ exitCode = code ?? 0;
175183
+ handleCompletion();
175184
+ });
175185
+ stream2.on("close", () => {
175186
+ streamClosed = true;
175187
+ if (exitCode === null) {
175188
+ exitCode = 0;
175189
+ }
175190
+ handleCompletion();
175191
+ });
175192
+ stream2.on("data", (data) => {
175193
+ stdout += data.toString();
175194
+ });
175195
+ stream2.stderr.on("data", (data) => {
175196
+ stderr += data.toString();
175197
+ });
175198
+ stream2.end();
174908
175199
  });
174909
- stream2.end();
174910
175200
  });
175201
+ conn.on("error", (err) => {
175202
+ clearTimeout(connectionTimeout);
175203
+ if (!connectionClosed) {
175204
+ connectionClosed = true;
175205
+ const duration = Date.now() - startTime;
175206
+ resolve(
175207
+ createErrorResult(
175208
+ `SSH connection error: ${err.message}`,
175209
+ 1,
175210
+ duration
175211
+ )
175212
+ );
175213
+ }
175214
+ });
175215
+ conn.connect(sshConfig);
174911
175216
  });
174912
- conn.on("error", (err) => {
174913
- clearTimeout(connectionTimeout);
174914
- if (!connectionClosed) {
174915
- connectionClosed = true;
174916
- const duration = Date.now() - startTime;
174917
- resolve(
174918
- createErrorResult(
174919
- `SSH connection error: ${err.message}`,
174920
- 1,
174921
- duration
174922
- )
174923
- );
174924
- }
174925
- });
174926
- conn.connect(sshConfig);
175217
+ }).catch((err) => {
175218
+ const duration = Date.now() - startTime;
175219
+ return createErrorResult(err.message, 1, duration);
174927
175220
  });
174928
175221
  }
174929
175222
  /**
174930
175223
  * Test SSH connection and Claude Code availability
174931
175224
  */
174932
175225
  testConnection() {
174933
- return new Promise((resolve) => {
174934
- let sshConfig;
174935
- try {
174936
- sshConfig = this.buildSshConfig();
174937
- } catch {
174938
- resolve(false);
174939
- return;
174940
- }
174941
- const conn = new import_ssh2.Client();
174942
- let resolved = false;
174943
- const timeout = setTimeout(() => {
174944
- if (!resolved) {
174945
- resolved = true;
174946
- conn.end();
174947
- resolve(false);
174948
- }
174949
- }, 1e4);
174950
- conn.on("ready", () => {
174951
- const claudePath = this.credentials.claudePath || "claude";
174952
- conn.exec(`${claudePath} --version`, { pty: false }, (err, stream2) => {
174953
- if (err) {
174954
- clearTimeout(timeout);
174955
- if (!resolved) {
174956
- resolved = true;
174957
- conn.end();
174958
- resolve(false);
175226
+ let sshConfig;
175227
+ try {
175228
+ sshConfig = this.buildSshConfig();
175229
+ } catch {
175230
+ return Promise.resolve(false);
175231
+ }
175232
+ return loadSsh2().then((ssh2) => {
175233
+ return new Promise((resolve) => {
175234
+ const conn = new ssh2.Client();
175235
+ let resolved = false;
175236
+ const timeout = setTimeout(() => {
175237
+ if (!resolved) {
175238
+ resolved = true;
175239
+ conn.end();
175240
+ resolve(false);
175241
+ }
175242
+ }, 1e4);
175243
+ conn.on("ready", () => {
175244
+ const claudePath = this.credentials.claudePath || "claude";
175245
+ conn.exec(
175246
+ `${claudePath} --version`,
175247
+ { pty: false },
175248
+ (err, stream2) => {
175249
+ if (err) {
175250
+ clearTimeout(timeout);
175251
+ if (!resolved) {
175252
+ resolved = true;
175253
+ conn.end();
175254
+ resolve(false);
175255
+ }
175256
+ return;
175257
+ }
175258
+ stream2.on("exit", (code) => {
175259
+ clearTimeout(timeout);
175260
+ if (!resolved) {
175261
+ resolved = true;
175262
+ conn.end();
175263
+ resolve(code === 0);
175264
+ }
175265
+ });
175266
+ stream2.on("close", () => {
175267
+ clearTimeout(timeout);
175268
+ if (!resolved) {
175269
+ resolved = true;
175270
+ conn.end();
175271
+ resolve(true);
175272
+ }
175273
+ });
175274
+ stream2.end();
174959
175275
  }
174960
- return;
175276
+ );
175277
+ });
175278
+ conn.on("error", () => {
175279
+ clearTimeout(timeout);
175280
+ if (!resolved) {
175281
+ resolved = true;
175282
+ resolve(false);
174961
175283
  }
174962
- stream2.on("exit", (code) => {
174963
- clearTimeout(timeout);
174964
- if (!resolved) {
174965
- resolved = true;
174966
- conn.end();
174967
- resolve(code === 0);
174968
- }
174969
- });
174970
- stream2.on("close", () => {
174971
- clearTimeout(timeout);
174972
- if (!resolved) {
174973
- resolved = true;
174974
- conn.end();
174975
- resolve(true);
174976
- }
174977
- });
174978
- stream2.end();
174979
175284
  });
175285
+ conn.connect(sshConfig);
174980
175286
  });
174981
- conn.on("error", () => {
174982
- clearTimeout(timeout);
174983
- if (!resolved) {
174984
- resolved = true;
174985
- resolve(false);
174986
- }
174987
- });
174988
- conn.connect(sshConfig);
174989
- });
175287
+ }).catch(() => false);
174990
175288
  }
174991
175289
  };
174992
175290
 
@@ -175355,6 +175653,22 @@ function buildClaudeArgs(options) {
175355
175653
  if (options.agents && Object.keys(options.agents).length > 0) {
175356
175654
  args.push("--agents", JSON.stringify(options.agents));
175357
175655
  }
175656
+ if (options.mcpConfig) {
175657
+ if (options.mcpConfig.inlineServers && Object.keys(options.mcpConfig.inlineServers).length > 0) {
175658
+ args.push(
175659
+ "--mcp-config",
175660
+ JSON.stringify({ mcpServers: options.mcpConfig.inlineServers })
175661
+ );
175662
+ }
175663
+ if (options.mcpConfig.configFilePaths && options.mcpConfig.configFilePaths.length > 0) {
175664
+ for (const filePath of options.mcpConfig.configFilePaths) {
175665
+ args.push("--mcp-config", filePath);
175666
+ }
175667
+ }
175668
+ if (options.mcpConfig.strictMode) {
175669
+ args.push("--strict-mcp-config");
175670
+ }
175671
+ }
175358
175672
  if (options.additionalArgs && options.additionalArgs.length > 0) {
175359
175673
  args.push(...options.additionalArgs);
175360
175674
  }
@@ -175802,6 +176116,8 @@ var ClaudeCode = class {
175802
176116
  ...modelDescription,
175803
176117
  // Custom subagents
175804
176118
  ...agentsDescription,
176119
+ // MCP servers
176120
+ ...mcpServersDescription,
175805
176121
  // Additional options
175806
176122
  ...optionsDescription
175807
176123
  ]