add-mcp 1.0.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +13 -12
  2. package/dist/index.js +72 -21
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Add MCP servers to your favorite coding agents with a single command.
4
4
 
5
- Supports **Claude Code**, **Codex**, **Cursor**, **OpenCode**, **VSCode** and [4 more](#supported-agents).
5
+ Supports **Claude Code**, **Codex**, **Cursor**, **OpenCode**, **VSCode** and [5 more](#supported-agents).
6
6
 
7
7
  ## Install an MCP Server
8
8
 
@@ -135,17 +135,18 @@ Agents that do not support headers: Goose.
135
135
 
136
136
  MCP servers can be installed to any of these agents:
137
137
 
138
- | Agent | `--agent` | Project Path | Global Path |
139
- | -------------- | ---------------- | ----------------------- | ----------------------------------------------------------------- |
140
- | Claude Code | `claude-code` | `.mcp.json` | `~/.claude.json` |
141
- | Claude Desktop | `claude-desktop` | - | `~/Library/Application Support/Claude/claude_desktop_config.json` |
142
- | Codex | `codex` | `.codex/config.toml` | `~/.codex/config.toml` |
143
- | Cursor | `cursor` | `.cursor/mcp.json` | `~/.cursor/mcp.json` |
144
- | Gemini CLI | `gemini-cli` | `.gemini/settings.json` | `~/.gemini/settings.json` |
145
- | Goose | `goose` | `.goose/config.yaml` | `~/.config/goose/config.yaml` |
146
- | OpenCode | `opencode` | `.opencode.json` | `~/.config/opencode/opencode.json` |
147
- | VS Code | `vscode` | `.vscode/mcp.json` | `~/Library/Application Support/Code/User/mcp.json` |
148
- | Zed | `zed` | `.zed/settings.json` | `~/Library/Application Support/Zed/settings.json` |
138
+ | Agent | `--agent` | Project Path | Global Path |
139
+ | ------------------ | -------------------- | ----------------------- | ----------------------------------------------------------------- |
140
+ | Claude Code | `claude-code` | `.mcp.json` | `~/.claude.json` |
141
+ | Claude Desktop | `claude-desktop` | - | `~/Library/Application Support/Claude/claude_desktop_config.json` |
142
+ | Codex | `codex` | `.codex/config.toml` | `~/.codex/config.toml` |
143
+ | Cursor | `cursor` | `.cursor/mcp.json` | `~/.cursor/mcp.json` |
144
+ | Gemini CLI | `gemini-cli` | `.gemini/settings.json` | `~/.gemini/settings.json` |
145
+ | Goose | `goose` | `.goose/config.yaml` | `~/.config/goose/config.yaml` |
146
+ | GitHub Copilot CLI | `github-copilot-cli` | `.vscode/mcp.json` | `~/.copilot/mcp-config.json` |
147
+ | OpenCode | `opencode` | `opencode.json` | `~/.config/opencode/opencode.json` |
148
+ | VS Code | `vscode` | `.vscode/mcp.json` | `~/Library/Application Support/Code/User/mcp.json` |
149
+ | Zed | `zed` | `.zed/settings.json` | `~/Library/Application Support/Zed/settings.json` |
149
150
 
150
151
  **Aliases:** `gemini` → `gemini-cli`, `github-copilot` → `vscode`
151
152
 
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ var agentAliases = {
15
15
  // src/agents.ts
16
16
  import * as p from "@clack/prompts";
17
17
  import { homedir as homedir2 } from "os";
18
- import { join as join2 } from "path";
18
+ import { dirname as dirname2, join as join2 } from "path";
19
19
  import { existsSync } from "fs";
20
20
 
21
21
  // src/mcp-lock.ts
@@ -98,6 +98,10 @@ function getPlatformPaths() {
98
98
  }
99
99
  }
100
100
  var { appSupport, vscodePath, gooseConfigPath } = getPlatformPaths();
101
+ var copilotConfigPath = join2(
102
+ process.env.XDG_CONFIG_HOME || join2(home, ".copilot"),
103
+ "mcp-config.json"
104
+ );
101
105
  function transformGooseConfig(serverName, config) {
102
106
  if (config.url) {
103
107
  const gooseType = config.type === "sse" ? "sse" : "streamable_http";
@@ -149,8 +153,7 @@ function transformOpenCodeConfig(_serverName, config) {
149
153
  }
150
154
  return {
151
155
  type: "local",
152
- command: config.command,
153
- args: config.args || [],
156
+ command: [config.command, ...config.args || []],
154
157
  enabled: true,
155
158
  environment: config.env || {}
156
159
  };
@@ -181,6 +184,32 @@ function transformCursorConfig(_serverName, config) {
181
184
  }
182
185
  return config;
183
186
  }
187
+ function transformGitHubCopilotCliConfig(_serverName, config, context) {
188
+ if (context?.local) {
189
+ return config;
190
+ }
191
+ if (config.url) {
192
+ const remoteConfig = {
193
+ type: config.type || "http",
194
+ url: config.url,
195
+ tools: ["*"]
196
+ };
197
+ if (config.headers && Object.keys(config.headers).length > 0) {
198
+ remoteConfig.headers = config.headers;
199
+ }
200
+ return remoteConfig;
201
+ }
202
+ const localConfig = {
203
+ type: "stdio",
204
+ command: config.command,
205
+ args: config.args || [],
206
+ tools: ["*"]
207
+ };
208
+ if (config.env && Object.keys(config.env).length > 0) {
209
+ localConfig.env = config.env;
210
+ }
211
+ return localConfig;
212
+ }
184
213
  var agents = {
185
214
  "claude-code": {
186
215
  name: "claude-code",
@@ -272,12 +301,28 @@ var agents = {
272
301
  },
273
302
  transformConfig: transformGooseConfig
274
303
  },
304
+ "github-copilot-cli": {
305
+ name: "github-copilot-cli",
306
+ displayName: "GitHub Copilot CLI",
307
+ configPath: copilotConfigPath,
308
+ localConfigPath: ".vscode/mcp.json",
309
+ projectDetectPaths: [".vscode"],
310
+ configKey: "mcpServers",
311
+ localConfigKey: "servers",
312
+ format: "json",
313
+ supportedTransports: ["stdio", "http", "sse"],
314
+ supportsHeaders: true,
315
+ detectGlobalInstall: async () => {
316
+ return existsSync(dirname2(copilotConfigPath));
317
+ },
318
+ transformConfig: transformGitHubCopilotCliConfig
319
+ },
275
320
  opencode: {
276
321
  name: "opencode",
277
322
  displayName: "OpenCode",
278
323
  configPath: join2(home, ".config", "opencode", "opencode.json"),
279
- localConfigPath: ".opencode.json",
280
- projectDetectPaths: [".opencode.json", ".opencode"],
324
+ localConfigPath: "opencode.json",
325
+ projectDetectPaths: ["opencode.json", ".opencode"],
281
326
  configKey: "mcp",
282
327
  format: "json",
283
328
  supportedTransports: ["stdio", "http", "sse"],
@@ -598,11 +643,11 @@ function isRemoteSource(parsed) {
598
643
 
599
644
  // src/installer.ts
600
645
  import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
601
- import { join as join3, dirname as dirname5 } from "path";
646
+ import { join as join3, dirname as dirname6 } from "path";
602
647
 
603
648
  // src/formats/json.ts
604
649
  import { readFileSync, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
605
- import { dirname as dirname2 } from "path";
650
+ import { dirname as dirname3 } from "path";
606
651
  import * as jsonc from "jsonc-parser";
607
652
 
608
653
  // src/formats/utils.ts
@@ -653,7 +698,7 @@ function detectIndent(text) {
653
698
  return result || { tabSize: 2, insertSpaces: true };
654
699
  }
655
700
  function writeJsonConfig(filePath, config, configKey) {
656
- const dir = dirname2(filePath);
701
+ const dir = dirname3(filePath);
657
702
  if (!existsSync2(dir)) {
658
703
  mkdirSync(dir, { recursive: true });
659
704
  }
@@ -695,7 +740,7 @@ function setNestedValue(obj, path, value) {
695
740
 
696
741
  // src/formats/yaml.ts
697
742
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
698
- import { dirname as dirname3 } from "path";
743
+ import { dirname as dirname4 } from "path";
699
744
  import yaml from "js-yaml";
700
745
  function readYamlConfig(filePath) {
701
746
  if (!existsSync3(filePath)) {
@@ -706,7 +751,7 @@ function readYamlConfig(filePath) {
706
751
  return parsed || {};
707
752
  }
708
753
  function writeYamlConfig(filePath, config) {
709
- const dir = dirname3(filePath);
754
+ const dir = dirname4(filePath);
710
755
  if (!existsSync3(dir)) {
711
756
  mkdirSync2(dir, { recursive: true });
712
757
  }
@@ -725,7 +770,7 @@ function writeYamlConfig(filePath, config) {
725
770
 
726
771
  // src/formats/toml.ts
727
772
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
728
- import { dirname as dirname4 } from "path";
773
+ import { dirname as dirname5 } from "path";
729
774
  import * as TOML from "@iarna/toml";
730
775
  function readTomlConfig(filePath) {
731
776
  if (!existsSync4(filePath)) {
@@ -736,7 +781,7 @@ function readTomlConfig(filePath) {
736
781
  return parsed;
737
782
  }
738
783
  function writeTomlConfig(filePath, config) {
739
- const dir = dirname4(filePath);
784
+ const dir = dirname5(filePath);
740
785
  if (!existsSync4(dir)) {
741
786
  mkdirSync3(dir, { recursive: true });
742
787
  }
@@ -806,21 +851,26 @@ function getConfigPath(agent, options = {}) {
806
851
  }
807
852
  return agent.configPath;
808
853
  }
854
+ function getConfigKey(agent, options = {}) {
855
+ if (options.local && agent.localConfigKey) {
856
+ return agent.localConfigKey;
857
+ }
858
+ return agent.configKey;
859
+ }
809
860
  function installServerForAgent(serverName, serverConfig, agentType, options = {}) {
810
861
  const agent = agents[agentType];
811
862
  const configPath = getConfigPath(agent, options);
812
863
  try {
813
- const dir = dirname5(configPath);
864
+ const dir = dirname6(configPath);
814
865
  if (!existsSync5(dir)) {
815
866
  mkdirSync4(dir, { recursive: true });
816
867
  }
817
- const transformedConfig = agent.transformConfig ? agent.transformConfig(serverName, serverConfig) : serverConfig;
818
- const config = buildConfigWithKey(
819
- agent.configKey,
820
- serverName,
821
- transformedConfig
822
- );
823
- writeConfig(configPath, config, agent.format, agent.configKey);
868
+ const transformedConfig = agent.transformConfig ? agent.transformConfig(serverName, serverConfig, {
869
+ local: Boolean(options.local)
870
+ }) : serverConfig;
871
+ const configKey = getConfigKey(agent, options);
872
+ const config = buildConfigWithKey(configKey, serverName, transformedConfig);
873
+ writeConfig(configPath, config, agent.format, configKey);
824
874
  return {
825
875
  success: true,
826
876
  path: configPath
@@ -855,7 +905,7 @@ function installServer(serverName, serverConfig, agentTypes, options = {}) {
855
905
  // package.json
856
906
  var package_default = {
857
907
  name: "add-mcp",
858
- version: "1.0.0",
908
+ version: "1.1.0",
859
909
  description: "Add MCP servers to your favorite coding agents with a single command.",
860
910
  author: "Andre Landgraf <andre@neon.tech>",
861
911
  license: "Apache-2.0",
@@ -886,6 +936,7 @@ var package_default = {
886
936
  "claude-desktop",
887
937
  "codex",
888
938
  "cursor",
939
+ "github-copilot-cli",
889
940
  "gemini-cli",
890
941
  "goose",
891
942
  "opencode",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.1.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",
@@ -31,6 +31,7 @@
31
31
  "claude-desktop",
32
32
  "codex",
33
33
  "cursor",
34
+ "github-copilot-cli",
34
35
  "gemini-cli",
35
36
  "goose",
36
37
  "opencode",