add-mcp 1.1.0 → 1.2.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.
- package/README.md +4 -0
- package/dist/index.js +59 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -54,6 +54,9 @@ npx add-mcp mcp-server-github --all
|
|
|
54
54
|
|
|
55
55
|
# Install to all agents, globally, without prompts
|
|
56
56
|
npx add-mcp mcp-server-github --all -g -y
|
|
57
|
+
|
|
58
|
+
# Add generated config files to .gitignore
|
|
59
|
+
npx add-mcp https://mcp.example.com/mcp -a cursor -y --gitignore
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
### Options
|
|
@@ -68,6 +71,7 @@ npx add-mcp mcp-server-github --all -g -y
|
|
|
68
71
|
| `-n, --name <name>` | Server name (auto-inferred if not provided) |
|
|
69
72
|
| `-y, --yes` | Skip all confirmation prompts |
|
|
70
73
|
| `--all` | Install to all agents |
|
|
74
|
+
| `--gitignore` | Add generated config files to `.gitignore` |
|
|
71
75
|
|
|
72
76
|
### Additional Commands
|
|
73
77
|
|
package/dist/index.js
CHANGED
|
@@ -642,8 +642,8 @@ function isRemoteSource(parsed) {
|
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
// src/installer.ts
|
|
645
|
-
import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
|
|
646
|
-
import { join as join3, dirname as dirname6 } from "path";
|
|
645
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
646
|
+
import { join as join3, dirname as dirname6, isAbsolute, relative, sep } from "path";
|
|
647
647
|
|
|
648
648
|
// src/formats/json.ts
|
|
649
649
|
import { readFileSync, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
|
|
@@ -844,6 +844,41 @@ function buildServerConfig(parsed, options = {}) {
|
|
|
844
844
|
args: ["-y", parsed.value]
|
|
845
845
|
};
|
|
846
846
|
}
|
|
847
|
+
function updateGitignoreWithPaths(paths, options = {}) {
|
|
848
|
+
const cwd = options.cwd || process.cwd();
|
|
849
|
+
const gitignorePath = join3(cwd, ".gitignore");
|
|
850
|
+
const existingContent = existsSync5(gitignorePath) ? readFileSync4(gitignorePath, "utf-8") : "";
|
|
851
|
+
const existingEntries = new Set(
|
|
852
|
+
existingContent.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0)
|
|
853
|
+
);
|
|
854
|
+
const entriesToAdd = [];
|
|
855
|
+
for (const filePath of paths) {
|
|
856
|
+
const relativePath = isAbsolute(filePath) ? relative(cwd, filePath) : filePath;
|
|
857
|
+
if (!relativePath || relativePath.startsWith("..") || isAbsolute(relativePath)) {
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
const normalizedPath = relativePath.split(sep).join("/");
|
|
861
|
+
const cleanPath = normalizedPath.startsWith("./") ? normalizedPath.slice(2) : normalizedPath;
|
|
862
|
+
if (!cleanPath || cleanPath === ".gitignore" || existingEntries.has(cleanPath)) {
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
existingEntries.add(cleanPath);
|
|
866
|
+
entriesToAdd.push(cleanPath);
|
|
867
|
+
}
|
|
868
|
+
if (entriesToAdd.length > 0) {
|
|
869
|
+
let nextContent = existingContent;
|
|
870
|
+
if (nextContent.length > 0 && !nextContent.endsWith("\n")) {
|
|
871
|
+
nextContent += "\n";
|
|
872
|
+
}
|
|
873
|
+
nextContent += `${entriesToAdd.join("\n")}
|
|
874
|
+
`;
|
|
875
|
+
writeFileSync4(gitignorePath, nextContent, "utf-8");
|
|
876
|
+
}
|
|
877
|
+
return {
|
|
878
|
+
path: gitignorePath,
|
|
879
|
+
added: entriesToAdd
|
|
880
|
+
};
|
|
881
|
+
}
|
|
847
882
|
function getConfigPath(agent, options = {}) {
|
|
848
883
|
if (options.local && agent.localConfigPath) {
|
|
849
884
|
const cwd = options.cwd || process.cwd();
|
|
@@ -905,7 +940,7 @@ function installServer(serverName, serverConfig, agentTypes, options = {}) {
|
|
|
905
940
|
// package.json
|
|
906
941
|
var package_default = {
|
|
907
942
|
name: "add-mcp",
|
|
908
|
-
version: "1.
|
|
943
|
+
version: "1.2.0",
|
|
909
944
|
description: "Add MCP servers to your favorite coding agents with a single command.",
|
|
910
945
|
author: "Andre Landgraf <andre@neon.tech>",
|
|
911
946
|
license: "Apache-2.0",
|
|
@@ -921,9 +956,9 @@ var package_default = {
|
|
|
921
956
|
fmt: "prettier --write .",
|
|
922
957
|
build: "tsup src/index.ts --format esm --dts --clean",
|
|
923
958
|
dev: "tsx src/index.ts",
|
|
924
|
-
test: "tsx tests/source-parser.test.ts && tsx tests/agents.test.ts && tsx tests/mcp-lock.test.ts && tsx tests/installer.test.ts && tsx tests/e2e/install.test.ts",
|
|
959
|
+
test: "tsx tests/source-parser.test.ts && tsx tests/agents.test.ts && tsx tests/mcp-lock.test.ts && tsx tests/installer.test.ts && tsx tests/e2e/install.test.ts && tsx tests/e2e/cli.test.ts",
|
|
925
960
|
"test:unit": "tsx tests/source-parser.test.ts && tsx tests/agents.test.ts && tsx tests/mcp-lock.test.ts && tsx tests/installer.test.ts",
|
|
926
|
-
"test:e2e": "tsx tests/e2e/install.test.ts",
|
|
961
|
+
"test:e2e": "tsx tests/e2e/install.test.ts && tsx tests/e2e/cli.test.ts",
|
|
927
962
|
typecheck: "tsc --noEmit",
|
|
928
963
|
prepublishOnly: "npm run build"
|
|
929
964
|
},
|
|
@@ -1054,7 +1089,10 @@ program.name("add-mcp").description(
|
|
|
1054
1089
|
"HTTP header for remote servers (repeatable, 'Key: Value')",
|
|
1055
1090
|
collect,
|
|
1056
1091
|
[]
|
|
1057
|
-
).option("-y, --yes", "Skip confirmation prompts").option("--all", "Install to all agents").
|
|
1092
|
+
).option("-y, --yes", "Skip confirmation prompts").option("--all", "Install to all agents").option(
|
|
1093
|
+
"--gitignore",
|
|
1094
|
+
"Add generated project config files to .gitignore"
|
|
1095
|
+
).action(async (target, options) => {
|
|
1058
1096
|
await main(target, options);
|
|
1059
1097
|
});
|
|
1060
1098
|
program.command("list-agents").description("List all supported coding agents").action(() => {
|
|
@@ -1463,6 +1501,21 @@ async function main(target, options) {
|
|
|
1463
1501
|
);
|
|
1464
1502
|
}
|
|
1465
1503
|
}
|
|
1504
|
+
if (options.gitignore && options.global) {
|
|
1505
|
+
p2.log.warn(
|
|
1506
|
+
"--gitignore is only supported for project-scoped installations; ignoring."
|
|
1507
|
+
);
|
|
1508
|
+
} else if (options.gitignore) {
|
|
1509
|
+
const successfulPaths = successful.map(([_, result]) => result.path);
|
|
1510
|
+
const gitignoreUpdate = updateGitignoreWithPaths(successfulPaths);
|
|
1511
|
+
if (gitignoreUpdate.added.length > 0) {
|
|
1512
|
+
p2.log.info(
|
|
1513
|
+
`Added ${gitignoreUpdate.added.length} entr${gitignoreUpdate.added.length === 1 ? "y" : "ies"} to .gitignore`
|
|
1514
|
+
);
|
|
1515
|
+
} else {
|
|
1516
|
+
p2.log.info("No new local config paths to add to .gitignore");
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1466
1519
|
console.log();
|
|
1467
1520
|
p2.outro(chalk.green("Done!"));
|
|
1468
1521
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "add-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"fmt": "prettier --write .",
|
|
17
17
|
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
18
18
|
"dev": "tsx src/index.ts",
|
|
19
|
-
"test": "tsx tests/source-parser.test.ts && tsx tests/agents.test.ts && tsx tests/mcp-lock.test.ts && tsx tests/installer.test.ts && tsx tests/e2e/install.test.ts",
|
|
19
|
+
"test": "tsx tests/source-parser.test.ts && tsx tests/agents.test.ts && tsx tests/mcp-lock.test.ts && tsx tests/installer.test.ts && tsx tests/e2e/install.test.ts && tsx tests/e2e/cli.test.ts",
|
|
20
20
|
"test:unit": "tsx tests/source-parser.test.ts && tsx tests/agents.test.ts && tsx tests/mcp-lock.test.ts && tsx tests/installer.test.ts",
|
|
21
|
-
"test:e2e": "tsx tests/e2e/install.test.ts",
|
|
21
|
+
"test:e2e": "tsx tests/e2e/install.test.ts && tsx tests/e2e/cli.test.ts",
|
|
22
22
|
"typecheck": "tsc --noEmit",
|
|
23
23
|
"prepublishOnly": "npm run build"
|
|
24
24
|
},
|