@boltic/cli 1.0.45 → 1.0.46

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.
Files changed (2) hide show
  1. package/commands/mcp.js +51 -3
  2. package/package.json +1 -1
package/commands/mcp.js CHANGED
@@ -57,8 +57,9 @@ async function handleSetup(args) {
57
57
  const url = args[0];
58
58
  let name = args[1] && !args[1].startsWith("--") ? args[1] : undefined;
59
59
 
60
- // Parse flags: --client, --name
60
+ // Parse flags: --client, --name, --header
61
61
  let client = "claude";
62
+ const headerValues = [];
62
63
  for (let i = 0; i < args.length; i++) {
63
64
  const token = args[i];
64
65
  if (
@@ -79,9 +80,27 @@ async function handleSetup(args) {
79
80
  i++;
80
81
  } else if (token.startsWith("--name=")) {
81
82
  name = token.split("=")[1];
83
+ } else if (
84
+ token === "--header" &&
85
+ args[i + 1] &&
86
+ !args[i + 1].startsWith("--")
87
+ ) {
88
+ headerValues.push(args[i + 1]);
89
+ i++;
90
+ } else if (token.startsWith("--header=")) {
91
+ headerValues.push(token.split("=")[1]);
82
92
  }
83
93
  }
84
94
 
95
+ let headers = {};
96
+ try {
97
+ headers = parseHeaders(headerValues);
98
+ } catch (error) {
99
+ console.log(chalk.red("\n❌ Error occurred while parsing headers:"));
100
+ console.log(chalk.red(` ${error.message}`));
101
+ return;
102
+ }
103
+
85
104
  if (!url) {
86
105
  console.log(
87
106
  chalk.red(
@@ -103,7 +122,7 @@ async function handleSetup(args) {
103
122
  const mcpUrl = url;
104
123
  const command = `composio --sse "${mcpUrl}"`;
105
124
 
106
- saveMcpConfig(url, client, newKey, mcpUrl, command);
125
+ saveMcpConfig(url, client, newKey, mcpUrl, command, headers);
107
126
 
108
127
  console.log(
109
128
  chalk.cyan(
@@ -125,7 +144,29 @@ async function handleSetup(args) {
125
144
  }
126
145
  }
127
146
 
128
- function saveMcpConfig(url, clientType, name, mcpUrl, command) {
147
+ function parseHeaders(headerValues) {
148
+ return headerValues.reduce((acc, headerValue) => {
149
+ const separatorIndex = headerValue.indexOf(":");
150
+ if (separatorIndex === -1) {
151
+ throw new Error(
152
+ `Invalid header format "${headerValue}". Use "Header-Name: value".`
153
+ );
154
+ }
155
+
156
+ const name = headerValue.slice(0, separatorIndex).trim();
157
+ const value = headerValue.slice(separatorIndex + 1).trim();
158
+ if (!name) {
159
+ throw new Error(
160
+ `Invalid header format "${headerValue}". Header name cannot be empty.`
161
+ );
162
+ }
163
+
164
+ acc[name] = value;
165
+ return acc;
166
+ }, {});
167
+ }
168
+
169
+ function saveMcpConfig(url, clientType, name, mcpUrl, command, headers = {}) {
129
170
  const config = {
130
171
  command: "npx",
131
172
  args: ["-y", "mcp-remote", mcpUrl],
@@ -134,6 +175,10 @@ function saveMcpConfig(url, clientType, name, mcpUrl, command) {
134
175
  },
135
176
  };
136
177
 
178
+ if (Object.keys(headers).length > 0) {
179
+ config.headers = headers;
180
+ }
181
+
137
182
  const sseConfig = {
138
183
  url: mcpUrl,
139
184
  };
@@ -364,6 +409,9 @@ function handleFileClient(clientConfig, serverName, config, mcpUrl) {
364
409
  const sseConfig = {
365
410
  url: mcpUrl,
366
411
  };
412
+ if (config.headers) {
413
+ sseConfig.headers = config.headers;
414
+ }
367
415
  existingConfig.mcpServers[serverName] = sseConfig;
368
416
  } else {
369
417
  existingConfig.mcpServers[serverName] = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boltic/cli",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "Professional CLI for interacting with the Boltic platform — create, manage, and publish integrations, serverless functions, workflows, MCPs, and more with enterprise-grade features and a seamless developer experience",
5
5
  "main": "index.js",
6
6
  "bin": {