add-mcp 1.0.1 → 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 +69 -17
  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";
@@ -180,6 +184,32 @@ function transformCursorConfig(_serverName, config) {
180
184
  }
181
185
  return config;
182
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
+ }
183
213
  var agents = {
184
214
  "claude-code": {
185
215
  name: "claude-code",
@@ -271,6 +301,22 @@ var agents = {
271
301
  },
272
302
  transformConfig: transformGooseConfig
273
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
+ },
274
320
  opencode: {
275
321
  name: "opencode",
276
322
  displayName: "OpenCode",
@@ -597,11 +643,11 @@ function isRemoteSource(parsed) {
597
643
 
598
644
  // src/installer.ts
599
645
  import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
600
- import { join as join3, dirname as dirname5 } from "path";
646
+ import { join as join3, dirname as dirname6 } from "path";
601
647
 
602
648
  // src/formats/json.ts
603
649
  import { readFileSync, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
604
- import { dirname as dirname2 } from "path";
650
+ import { dirname as dirname3 } from "path";
605
651
  import * as jsonc from "jsonc-parser";
606
652
 
607
653
  // src/formats/utils.ts
@@ -652,7 +698,7 @@ function detectIndent(text) {
652
698
  return result || { tabSize: 2, insertSpaces: true };
653
699
  }
654
700
  function writeJsonConfig(filePath, config, configKey) {
655
- const dir = dirname2(filePath);
701
+ const dir = dirname3(filePath);
656
702
  if (!existsSync2(dir)) {
657
703
  mkdirSync(dir, { recursive: true });
658
704
  }
@@ -694,7 +740,7 @@ function setNestedValue(obj, path, value) {
694
740
 
695
741
  // src/formats/yaml.ts
696
742
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
697
- import { dirname as dirname3 } from "path";
743
+ import { dirname as dirname4 } from "path";
698
744
  import yaml from "js-yaml";
699
745
  function readYamlConfig(filePath) {
700
746
  if (!existsSync3(filePath)) {
@@ -705,7 +751,7 @@ function readYamlConfig(filePath) {
705
751
  return parsed || {};
706
752
  }
707
753
  function writeYamlConfig(filePath, config) {
708
- const dir = dirname3(filePath);
754
+ const dir = dirname4(filePath);
709
755
  if (!existsSync3(dir)) {
710
756
  mkdirSync2(dir, { recursive: true });
711
757
  }
@@ -724,7 +770,7 @@ function writeYamlConfig(filePath, config) {
724
770
 
725
771
  // src/formats/toml.ts
726
772
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
727
- import { dirname as dirname4 } from "path";
773
+ import { dirname as dirname5 } from "path";
728
774
  import * as TOML from "@iarna/toml";
729
775
  function readTomlConfig(filePath) {
730
776
  if (!existsSync4(filePath)) {
@@ -735,7 +781,7 @@ function readTomlConfig(filePath) {
735
781
  return parsed;
736
782
  }
737
783
  function writeTomlConfig(filePath, config) {
738
- const dir = dirname4(filePath);
784
+ const dir = dirname5(filePath);
739
785
  if (!existsSync4(dir)) {
740
786
  mkdirSync3(dir, { recursive: true });
741
787
  }
@@ -805,21 +851,26 @@ function getConfigPath(agent, options = {}) {
805
851
  }
806
852
  return agent.configPath;
807
853
  }
854
+ function getConfigKey(agent, options = {}) {
855
+ if (options.local && agent.localConfigKey) {
856
+ return agent.localConfigKey;
857
+ }
858
+ return agent.configKey;
859
+ }
808
860
  function installServerForAgent(serverName, serverConfig, agentType, options = {}) {
809
861
  const agent = agents[agentType];
810
862
  const configPath = getConfigPath(agent, options);
811
863
  try {
812
- const dir = dirname5(configPath);
864
+ const dir = dirname6(configPath);
813
865
  if (!existsSync5(dir)) {
814
866
  mkdirSync4(dir, { recursive: true });
815
867
  }
816
- const transformedConfig = agent.transformConfig ? agent.transformConfig(serverName, serverConfig) : serverConfig;
817
- const config = buildConfigWithKey(
818
- agent.configKey,
819
- serverName,
820
- transformedConfig
821
- );
822
- 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);
823
874
  return {
824
875
  success: true,
825
876
  path: configPath
@@ -854,7 +905,7 @@ function installServer(serverName, serverConfig, agentTypes, options = {}) {
854
905
  // package.json
855
906
  var package_default = {
856
907
  name: "add-mcp",
857
- version: "1.0.1",
908
+ version: "1.1.0",
858
909
  description: "Add MCP servers to your favorite coding agents with a single command.",
859
910
  author: "Andre Landgraf <andre@neon.tech>",
860
911
  license: "Apache-2.0",
@@ -885,6 +936,7 @@ var package_default = {
885
936
  "claude-desktop",
886
937
  "codex",
887
938
  "cursor",
939
+ "github-copilot-cli",
888
940
  "gemini-cli",
889
941
  "goose",
890
942
  "opencode",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-mcp",
3
- "version": "1.0.1",
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",