add-mcp 1.9.0 → 1.9.1
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.js +20 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2085,7 +2085,7 @@ function findMatchingServers(agentServersList, query) {
|
|
|
2085
2085
|
// package.json
|
|
2086
2086
|
var package_default = {
|
|
2087
2087
|
name: "add-mcp",
|
|
2088
|
-
version: "1.9.
|
|
2088
|
+
version: "1.9.1",
|
|
2089
2089
|
description: "Add MCP servers to your favorite coding agents with a single command.",
|
|
2090
2090
|
author: "Andre Landgraf <andre@neon.tech>",
|
|
2091
2091
|
license: "Apache-2.0",
|
|
@@ -2331,6 +2331,16 @@ function inferFindPreferredTransport(options) {
|
|
|
2331
2331
|
function collect(value, previous) {
|
|
2332
2332
|
return previous.concat([value]);
|
|
2333
2333
|
}
|
|
2334
|
+
function looksLikeEatenShellVar(invalidEntries, separator) {
|
|
2335
|
+
for (const entry of invalidEntries) {
|
|
2336
|
+
const separatorIndex = entry.indexOf(separator);
|
|
2337
|
+
if (separatorIndex <= 0) continue;
|
|
2338
|
+
const key = entry.slice(0, separatorIndex).trim();
|
|
2339
|
+
const value = entry.slice(separatorIndex + 1).trim();
|
|
2340
|
+
if (key && !value) return true;
|
|
2341
|
+
}
|
|
2342
|
+
return false;
|
|
2343
|
+
}
|
|
2334
2344
|
function parseHeaders(values) {
|
|
2335
2345
|
const headers = {};
|
|
2336
2346
|
const invalid = [];
|
|
@@ -2360,8 +2370,8 @@ function parseEnv(values) {
|
|
|
2360
2370
|
continue;
|
|
2361
2371
|
}
|
|
2362
2372
|
const key = entry.slice(0, separatorIndex).trim();
|
|
2363
|
-
const value = entry.slice(separatorIndex + 1);
|
|
2364
|
-
if (!key) {
|
|
2373
|
+
const value = entry.slice(separatorIndex + 1).trim();
|
|
2374
|
+
if (!key || !value) {
|
|
2365
2375
|
invalid.push(entry);
|
|
2366
2376
|
continue;
|
|
2367
2377
|
}
|
|
@@ -2389,17 +2399,17 @@ program.name("add-mcp").description(
|
|
|
2389
2399
|
"Transport type for remote servers (http, sse)"
|
|
2390
2400
|
).option("--type <type>", "Alias for --transport").option(
|
|
2391
2401
|
"--header <header>",
|
|
2392
|
-
"HTTP header for remote servers (repeatable, 'Key: Value'). Placeholders ${VAR} prompt interactively when not using --yes.",
|
|
2402
|
+
"HTTP header for remote servers (repeatable, 'Key: Value'). Placeholders ${VAR} prompt interactively when not using --yes. Use single quotes so your shell does not expand the ${VAR}.",
|
|
2393
2403
|
collect,
|
|
2394
2404
|
[]
|
|
2395
2405
|
).option(
|
|
2396
2406
|
"--env <env>",
|
|
2397
|
-
"Environment variable for local stdio servers (repeatable, 'KEY=VALUE'). Placeholders ${VAR} prompt interactively when not using --yes.",
|
|
2407
|
+
"Environment variable for local stdio servers (repeatable, 'KEY=VALUE'). Placeholders ${VAR} prompt interactively when not using --yes. Use single quotes so your shell does not expand the ${VAR}.",
|
|
2398
2408
|
collect,
|
|
2399
2409
|
[]
|
|
2400
2410
|
).option(
|
|
2401
2411
|
"--args <arg>",
|
|
2402
|
-
"Argument for local stdio servers (repeatable). Placeholders ${VAR} prompt interactively when not using --yes.",
|
|
2412
|
+
"Argument for local stdio servers (repeatable). Placeholders ${VAR} prompt interactively when not using --yes. Use single quotes so your shell does not expand the ${VAR}.",
|
|
2403
2413
|
collect,
|
|
2404
2414
|
[]
|
|
2405
2415
|
).option("-y, --yes", "Skip confirmation prompts").option("--all", "Install to all agents").option("--gitignore", "Add generated project config files to .gitignore").action(async (target, options) => {
|
|
@@ -2981,8 +2991,9 @@ async function main(target, options) {
|
|
|
2981
2991
|
const headerValues = options.header ?? [];
|
|
2982
2992
|
const headerResult = parseHeaders(headerValues);
|
|
2983
2993
|
if (headerResult.invalid.length > 0) {
|
|
2994
|
+
const hint = looksLikeEatenShellVar(headerResult.invalid, ":") ? " (looks like your shell expanded a ${VAR} to an empty string; use single quotes: --header 'Key: ${VAR}' to pass the template literally)" : "";
|
|
2984
2995
|
p3.log.error(
|
|
2985
|
-
`Invalid --header value(s): ${headerResult.invalid.join(", ")}. Use "Key: Value" format
|
|
2996
|
+
`Invalid --header value(s): ${headerResult.invalid.join(", ")}. Use "Key: Value" format.${hint}`
|
|
2986
2997
|
);
|
|
2987
2998
|
process.exit(1);
|
|
2988
2999
|
}
|
|
@@ -2994,8 +3005,9 @@ async function main(target, options) {
|
|
|
2994
3005
|
const envValues = options.env ?? [];
|
|
2995
3006
|
const envResult = parseEnv(envValues);
|
|
2996
3007
|
if (envResult.invalid.length > 0) {
|
|
3008
|
+
const hint = looksLikeEatenShellVar(envResult.invalid, "=") ? " (looks like your shell expanded a ${VAR} to an empty string; use single quotes: --env 'KEY=${VAR}' to pass the template literally)" : "";
|
|
2997
3009
|
p3.log.error(
|
|
2998
|
-
`Invalid --env value(s): ${envResult.invalid.join(", ")}. Use "KEY=VALUE" format
|
|
3010
|
+
`Invalid --env value(s): ${envResult.invalid.join(", ")}. Use "KEY=VALUE" format.${hint}`
|
|
2999
3011
|
);
|
|
3000
3012
|
process.exit(1);
|
|
3001
3013
|
}
|