add-mcp 1.12.0 → 1.13.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.
@@ -617,6 +617,13 @@ function getAgentTypes() {
617
617
  function supportsProjectConfig(agentType) {
618
618
  return agents[agentType].localConfigPath !== void 0;
619
619
  }
620
+ function getCommonInstallScopes(agentTypes) {
621
+ if (agentTypes.length === 0) return [];
622
+ if (agentTypes.some((agentType) => !supportsProjectConfig(agentType))) {
623
+ return ["global"];
624
+ }
625
+ return ["local", "global"];
626
+ }
620
627
  function getProjectCapableAgents() {
621
628
  return Object.keys(agents).filter(
622
629
  (type) => supportsProjectConfig(type)
@@ -1587,6 +1594,7 @@ export {
1587
1594
  agents,
1588
1595
  getAgentTypes,
1589
1596
  supportsProjectConfig,
1597
+ getCommonInstallScopes,
1590
1598
  getProjectCapableAgents,
1591
1599
  detectProjectAgents,
1592
1600
  detectGlobalAgents,
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  detectProjectAgents,
9
9
  findMatchingServers,
10
10
  getAgentTypes,
11
+ getCommonInstallScopes,
11
12
  getConfigPath,
12
13
  getFindRegistries,
13
14
  getLastSelectedAgents,
@@ -23,7 +24,7 @@ import {
23
24
  selectAgentsInteractive,
24
25
  supportsProjectConfig,
25
26
  updateGitignoreWithPaths
26
- } from "./chunk-IPCKQUBH.js";
27
+ } from "./chunk-3ZFFEEQJ.js";
27
28
 
28
29
  // src/index.ts
29
30
  import { program } from "commander";
@@ -783,7 +784,7 @@ async function runFind(query, options) {
783
784
  // package.json
784
785
  var package_default = {
785
786
  name: "add-mcp",
786
- version: "1.12.0",
787
+ version: "1.13.0",
787
788
  description: "Add MCP servers to your favorite coding agents with a single command.",
788
789
  author: "Andre Landgraf <andre@neon.tech>",
789
790
  license: "Apache-2.0",
@@ -1885,8 +1886,6 @@ async function main(target, options) {
1885
1886
  });
1886
1887
  let targetAgents;
1887
1888
  const allAgentTypes = getAgentTypes();
1888
- const hasExplicitAgentFlags = options.agent && options.agent.length > 0 || options.all === true;
1889
- let selectedViaPrompt = false;
1890
1889
  let agentRouting = /* @__PURE__ */ new Map();
1891
1890
  if (options.agent && options.agent.length > 0) {
1892
1891
  const resolved = [];
@@ -1946,7 +1945,7 @@ async function main(target, options) {
1946
1945
  );
1947
1946
  }
1948
1947
  } else {
1949
- const availableAgents = options.global ? allAgentTypes : getProjectCapableAgents();
1948
+ const availableAgents = allAgentTypes;
1950
1949
  p2.log.warn(
1951
1950
  options.global ? "No coding agents detected." : "No agents detected in this project."
1952
1951
  );
@@ -1957,18 +1956,14 @@ async function main(target, options) {
1957
1956
  p2.cancel("Installation cancelled");
1958
1957
  process.exit(0);
1959
1958
  }
1960
- selectedViaPrompt = true;
1961
1959
  targetAgents = selected;
1962
- for (const agent of targetAgents) {
1963
- agentRouting.set(agent, options.global ? "global" : "local");
1964
- }
1965
1960
  }
1966
1961
  } else if (options.yes) {
1967
1962
  targetAgents = detectedAgents;
1968
1963
  const agentNames = detectedAgents.map((a) => chalk.cyan(agents[a].displayName)).join(", ");
1969
1964
  p2.log.info(`Installing to: ${agentNames}`);
1970
1965
  } else {
1971
- const availableAgents = options.global ? allAgentTypes : getProjectCapableAgents();
1966
+ const availableAgents = allAgentTypes;
1972
1967
  let lastSelected;
1973
1968
  try {
1974
1969
  lastSelected = await getLastSelectedAgents();
@@ -1990,11 +1985,7 @@ async function main(target, options) {
1990
1985
  p2.cancel("Installation cancelled");
1991
1986
  process.exit(0);
1992
1987
  }
1993
- selectedViaPrompt = true;
1994
1988
  targetAgents = selected;
1995
- for (const agent of targetAgents) {
1996
- agentRouting.set(agent, options.global ? "global" : "local");
1997
- }
1998
1989
  }
1999
1990
  }
2000
1991
  const requiredTransport = isRemoteSource(parsed) ? resolvedTransport ?? "http" : "stdio";
@@ -2028,50 +2019,45 @@ async function main(target, options) {
2028
2019
  process.exit(1);
2029
2020
  }
2030
2021
  }
2031
- const hasSmartRouting = agentRouting.size > 0;
2032
2022
  if (options.global) {
2023
+ agentRouting = /* @__PURE__ */ new Map();
2033
2024
  for (const agent of targetAgents) {
2034
2025
  agentRouting.set(agent, "global");
2035
2026
  }
2036
- } else if (!hasSmartRouting) {
2037
- const selectedWithLocal = targetAgents.filter(
2038
- (a) => supportsProjectConfig(a)
2039
- );
2040
- const globalOnlySelected = targetAgents.filter(
2041
- (a) => !supportsProjectConfig(a)
2042
- );
2043
- for (const agent of globalOnlySelected) {
2044
- agentRouting.set(agent, "global");
2027
+ } else {
2028
+ const commonScopes = getCommonInstallScopes(targetAgents);
2029
+ if (commonScopes.length === 0) {
2030
+ p2.log.error("No agents selected");
2031
+ process.exit(1);
2045
2032
  }
2046
- if (selectedWithLocal.length > 0) {
2047
- let installLocally = true;
2048
- if (!options.yes) {
2049
- const scope = await p2.select({
2050
- message: "Installation scope",
2051
- options: [
2052
- {
2053
- value: true,
2054
- label: "Project",
2055
- hint: "Install in current directory (committed with your project)"
2056
- },
2057
- {
2058
- value: false,
2059
- label: "Global",
2060
- hint: "Install in home directory (available across all projects)"
2061
- }
2062
- ]
2063
- });
2064
- if (p2.isCancel(scope)) {
2065
- p2.cancel("Installation cancelled");
2066
- process.exit(0);
2067
- }
2068
- installLocally = scope;
2069
- }
2070
- for (const agent of selectedWithLocal) {
2071
- agentRouting.set(agent, installLocally ? "local" : "global");
2033
+ let installScope = commonScopes[0];
2034
+ if (commonScopes.length > 1 && !options.yes) {
2035
+ const scope = await p2.select({
2036
+ message: "Installation scope",
2037
+ options: [
2038
+ {
2039
+ value: "local",
2040
+ label: "Project",
2041
+ hint: "Install in current directory (committed with your project)"
2042
+ },
2043
+ {
2044
+ value: "global",
2045
+ label: "Global",
2046
+ hint: "Install in home directory (available across all projects)"
2047
+ }
2048
+ ]
2049
+ });
2050
+ if (p2.isCancel(scope)) {
2051
+ p2.cancel("Installation cancelled");
2052
+ process.exit(0);
2072
2053
  }
2073
- } else {
2074
- p2.log.info("Selected agents only support global installation");
2054
+ installScope = scope;
2055
+ } else if (installScope === "global") {
2056
+ p2.log.info("Selected agents require global installation");
2057
+ }
2058
+ agentRouting = /* @__PURE__ */ new Map();
2059
+ for (const agent of targetAgents) {
2060
+ agentRouting.set(agent, installScope);
2075
2061
  }
2076
2062
  }
2077
2063
  const summaryLines = [];
@@ -2088,15 +2074,7 @@ async function main(target, options) {
2088
2074
  const globalAgents = targetAgents.filter(
2089
2075
  (a) => agentRouting.get(a) === "global"
2090
2076
  );
2091
- if (localAgents.length > 0 && globalAgents.length > 0) {
2092
- summaryLines.push(`${chalk.cyan("Scope:")} Mixed (project + global)`);
2093
- summaryLines.push(
2094
- `${chalk.cyan(" Project:")} ${localAgents.map((a) => agents[a].displayName).join(", ")}`
2095
- );
2096
- summaryLines.push(
2097
- `${chalk.cyan(" Global:")} ${globalAgents.map((a) => agents[a].displayName).join(", ")}`
2098
- );
2099
- } else if (localAgents.length > 0) {
2077
+ if (localAgents.length > 0) {
2100
2078
  summaryLines.push(`${chalk.cyan("Scope:")} Project`);
2101
2079
  summaryLines.push(
2102
2080
  `${chalk.cyan("Agents:")} ${localAgents.map((a) => agents[a].displayName).join(", ")}`
@@ -2174,7 +2152,7 @@ async function main(target, options) {
2174
2152
  `${describeOptionalField(field)} is not supported by ${agentNames.join(", ")}; dropped from ${agentNames.length === 1 ? "that config" : "those configs"}.`
2175
2153
  );
2176
2154
  }
2177
- if (options.gitignore && options.global) {
2155
+ if (options.gitignore && localAgents.length === 0) {
2178
2156
  p2.log.warn(
2179
2157
  "--gitignore is only supported for project-scoped installations; ignoring."
2180
2158
  );
package/dist/lib.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  listInstalledServers,
11
11
  readConfig,
12
12
  removeServerFromConfig
13
- } from "./chunk-IPCKQUBH.js";
13
+ } from "./chunk-3ZFFEEQJ.js";
14
14
 
15
15
  // src/lib.ts
16
16
  import { existsSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-mcp",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Add MCP servers to your favorite coding agents with a single command.",
5
5
  "author": "Andre Landgraf <andre@neon.tech>",
6
6
  "license": "Apache-2.0",