@mongodb-js/mcp-setup 3.0.0-prerelease.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/aiTool.d.ts +46 -0
- package/dist/aiTool.d.ts.map +1 -0
- package/dist/aiTool.js +382 -0
- package/dist/aiTool.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/installSkills.d.ts +42 -0
- package/dist/installSkills.d.ts.map +1 -0
- package/dist/installSkills.js +112 -0
- package/dist/installSkills.js.map +1 -0
- package/dist/setupAiToolsUtils.d.ts +4 -0
- package/dist/setupAiToolsUtils.d.ts.map +1 -0
- package/dist/setupAiToolsUtils.js +20 -0
- package/dist/setupAiToolsUtils.js.map +1 -0
- package/dist/setupCliHandler.d.ts +8 -0
- package/dist/setupCliHandler.d.ts.map +1 -0
- package/dist/setupCliHandler.js +15 -0
- package/dist/setupCliHandler.js.map +1 -0
- package/dist/setupMcpServer.d.ts +12 -0
- package/dist/setupMcpServer.d.ts.map +1 -0
- package/dist/setupMcpServer.js +385 -0
- package/dist/setupMcpServer.js.map +1 -0
- package/dist/setupTelemetry.d.ts +106 -0
- package/dist/setupTelemetry.d.ts.map +1 -0
- package/dist/setupTelemetry.js +205 -0
- package/dist/setupTelemetry.js.map +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
package/dist/aiTool.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Platform } from "./setupAiToolsUtils.js";
|
|
2
|
+
export type AIToolType = "cursor" | "vscode" | "windsurf" | "claudeDesktop" | "claudeCode" | "opencode";
|
|
3
|
+
export declare const TOOLS_WITHOUT_EDITORS: AIToolType[];
|
|
4
|
+
type McpConfigEntry = {
|
|
5
|
+
command: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
type OpenCodeMcpEntry = {
|
|
10
|
+
type: "local";
|
|
11
|
+
command: string[];
|
|
12
|
+
environment?: Record<string, string>;
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type McpConfig = {
|
|
16
|
+
mcpServers: Record<string, McpConfigEntry>;
|
|
17
|
+
} | {
|
|
18
|
+
servers: Record<string, McpConfigEntry>;
|
|
19
|
+
} | {
|
|
20
|
+
mcp: Record<string, OpenCodeMcpEntry>;
|
|
21
|
+
};
|
|
22
|
+
type McpServers = "mcpServers" | "servers" | "mcp";
|
|
23
|
+
export declare abstract class AITool {
|
|
24
|
+
abstract name: string;
|
|
25
|
+
abstract toolType: AIToolType;
|
|
26
|
+
abstract configFileName: string;
|
|
27
|
+
abstract get configPath(): string;
|
|
28
|
+
tip?: string;
|
|
29
|
+
protected getServersKey(): McpServers;
|
|
30
|
+
protected getEnvironmentKey(): "env" | "environment";
|
|
31
|
+
protected readConfig(configPath: string): McpConfig;
|
|
32
|
+
protected buildMcpConfigEntry(isReadOnly: boolean, env: Record<string, string>): McpConfigEntry | OpenCodeMcpEntry;
|
|
33
|
+
updateConfig(configPath: string, env: Record<string, string>, isReadOnly: boolean): void;
|
|
34
|
+
getOpenConfigCommand(configPath: string, platform: Platform, editor: AIToolType): string | null;
|
|
35
|
+
openConfigSettings(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* The skills.sh agent ID this tool maps to, or null if [skills.sh](https://skills.sh)
|
|
38
|
+
* has no entry for it (e.g. Claude Desktop — no filesystem skills).
|
|
39
|
+
* Install paths are owned by `skills add`; we only map identity.
|
|
40
|
+
*/
|
|
41
|
+
get skillsAgentId(): string | null;
|
|
42
|
+
}
|
|
43
|
+
export declare const openConfigSettings: (tool: AIToolType) => Promise<void>;
|
|
44
|
+
export declare const AI_TOOL_REGISTRY: Record<AIToolType, AITool>;
|
|
45
|
+
export {};
|
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C;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,SAAS,CAAC,aAAa,IAAI,UAAU;IAIrC,SAAS,CAAC,iBAAiB,IAAI,KAAK,GAAG,aAAa;IAIpD,SAAS,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS;IAmBnD,SAAS,CAAC,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,GAAG,gBAAgB;IAYlH,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI;IA+BxF,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAazF,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBzC;;;;OAIG;IACH,IAAI,aAAa,IAAI,MAAM,GAAG,IAAI,CAEjC;CACJ;AA8JD,eAAO,MAAM,kBAAkB,GAAI,MAAM,UAAU,KAAG,OAAO,CAAC,IAAI,CAEjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAOvD,CAAC"}
|
package/dist/aiTool.js
ADDED
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
import { applyEdits, findNodeAtLocation, modify, parseTree } from "jsonc-parser";
|
|
5
|
+
import { exec } from "child_process";
|
|
6
|
+
import { formatError, getPlatform } from "./setupAiToolsUtils.js";
|
|
7
|
+
// These are tools that don't have a designated editor to open the config file
|
|
8
|
+
export const TOOLS_WITHOUT_EDITORS = ["claudeDesktop", "claudeCode", "opencode"];
|
|
9
|
+
// Mac: open path in default app, or in editor (e.g. "cursor") if supported
|
|
10
|
+
const getOpenCommandMac = (configPath, tool) => tool && !TOOLS_WITHOUT_EDITORS.includes(tool) ? `open "${tool}://file${configPath}"` : `open "${configPath}"`;
|
|
11
|
+
// Linux: open path in default app, or in editor if supported
|
|
12
|
+
const getOpenCommandLinux = (configPath, tool) => tool && !TOOLS_WITHOUT_EDITORS.includes(tool)
|
|
13
|
+
? `xdg-open "${tool}://file${configPath}"`
|
|
14
|
+
: `xdg-open "${configPath}"`;
|
|
15
|
+
// Windows: open path in default app (for tools without a dedicated editor)
|
|
16
|
+
const getOpenCommandWindowsDefault = (configPath) => `start "" "${configPath}"`;
|
|
17
|
+
const MCP_SERVER_KEY = "mongodb-mcp-server";
|
|
18
|
+
const getBasePath = (useDefaultPath) => {
|
|
19
|
+
const platform = getPlatform();
|
|
20
|
+
const isWindows = platform === "windows";
|
|
21
|
+
// Sometimes in Windows we want to use the user home directory instead of APPDATA
|
|
22
|
+
if (isWindows && !useDefaultPath) {
|
|
23
|
+
return process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return os.homedir();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
// Gets an existing servers: {}, mcpServers: {}, or mcp: {} object in the config file or create it if it doesn't exist
|
|
30
|
+
const getOrCreateServersEntry = (config, serversKey) => {
|
|
31
|
+
const mutable = config;
|
|
32
|
+
if (!mutable[serversKey]) {
|
|
33
|
+
mutable[serversKey] = {};
|
|
34
|
+
}
|
|
35
|
+
// Cast so callers can assign OpenCodeMcpEntry when serversKey is "mcp" (avoids TS narrowing)
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
37
|
+
return mutable[serversKey];
|
|
38
|
+
};
|
|
39
|
+
// Ensures the directory for the config file exists
|
|
40
|
+
const ensureConfigDir = (configPath) => {
|
|
41
|
+
const resolvedPath = path.resolve(configPath);
|
|
42
|
+
const configDir = path.dirname(resolvedPath);
|
|
43
|
+
if (!fs.existsSync(configDir)) {
|
|
44
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const writeConfigFile = (configPath, config) => {
|
|
48
|
+
const resolvedPath = path.resolve(configPath);
|
|
49
|
+
ensureConfigDir(configPath);
|
|
50
|
+
try {
|
|
51
|
+
fs.writeFileSync(resolvedPath, JSON.stringify(config, null, 2), "utf-8");
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
throw new Error(`Could not write config to ${resolvedPath}: ${formatError(err)}. ` +
|
|
55
|
+
"Check that the path is correct and you have permission to write to that location.", { cause: err });
|
|
56
|
+
}
|
|
57
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
58
|
+
throw new Error(`Config file was not created at ${resolvedPath}.`);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function toPatch(entry, envKey) {
|
|
62
|
+
const envRecord = "env" in entry ? (entry.env ?? {}) : "environment" in entry ? (entry.environment ?? {}) : {};
|
|
63
|
+
const patch = {
|
|
64
|
+
command: entry.command,
|
|
65
|
+
args: "args" in entry ? entry.args : undefined,
|
|
66
|
+
envKey,
|
|
67
|
+
envRecord,
|
|
68
|
+
};
|
|
69
|
+
if ("type" in entry) {
|
|
70
|
+
patch.type = entry.type;
|
|
71
|
+
}
|
|
72
|
+
if ("enabled" in entry) {
|
|
73
|
+
patch.enabled = entry.enabled;
|
|
74
|
+
}
|
|
75
|
+
return patch;
|
|
76
|
+
}
|
|
77
|
+
// Updates existing config content in place using jsonc-parser; preserves comments and spacing.
|
|
78
|
+
const updateConfigInPlace = (existingContent, serversKey, patch, entry) => {
|
|
79
|
+
const parsedContent = parseTree(existingContent);
|
|
80
|
+
const basePath = [serversKey, MCP_SERVER_KEY];
|
|
81
|
+
const contentBlock = parsedContent ? findNodeAtLocation(parsedContent, basePath) : undefined;
|
|
82
|
+
const opts = { formattingOptions: { tabSize: 2, insertSpaces: true, eol: "\n" } };
|
|
83
|
+
if (contentBlock) {
|
|
84
|
+
let text = existingContent;
|
|
85
|
+
text = applyEdits(text, modify(text, [...basePath, "command"], patch.command, opts));
|
|
86
|
+
if (patch.args !== undefined) {
|
|
87
|
+
text = applyEdits(text, modify(text, [...basePath, "args"], patch.args, opts));
|
|
88
|
+
}
|
|
89
|
+
for (const [k, v] of Object.entries(patch.envRecord)) {
|
|
90
|
+
text = applyEdits(text, modify(text, [...basePath, patch.envKey, k], v, opts));
|
|
91
|
+
}
|
|
92
|
+
if (patch.enabled !== undefined) {
|
|
93
|
+
text = applyEdits(text, modify(text, [...basePath, "enabled"], patch.enabled, opts));
|
|
94
|
+
}
|
|
95
|
+
if (patch.type !== undefined) {
|
|
96
|
+
text = applyEdits(text, modify(text, [...basePath, "type"], patch.type, opts));
|
|
97
|
+
}
|
|
98
|
+
return text;
|
|
99
|
+
}
|
|
100
|
+
return applyEdits(existingContent, modify(existingContent, basePath, entry, opts));
|
|
101
|
+
};
|
|
102
|
+
export class AITool {
|
|
103
|
+
// Default key is mcpServers, but we will use this function to override in subclasses (e.g. VS Code uses "servers").
|
|
104
|
+
getServersKey() {
|
|
105
|
+
return "mcpServers";
|
|
106
|
+
}
|
|
107
|
+
getEnvironmentKey() {
|
|
108
|
+
return "env";
|
|
109
|
+
}
|
|
110
|
+
readConfig(configPath) {
|
|
111
|
+
const serversKey = this.getServersKey();
|
|
112
|
+
const emptyConfig = () => ({ [serversKey]: {} });
|
|
113
|
+
let config = emptyConfig();
|
|
114
|
+
if (fs.existsSync(configPath)) {
|
|
115
|
+
try {
|
|
116
|
+
const existingContent = fs.readFileSync(configPath, "utf-8");
|
|
117
|
+
config = JSON.parse(existingContent);
|
|
118
|
+
getOrCreateServersEntry(config, serversKey);
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
console.error(`Warning: Could not parse existing ${this.configFileName}, creating new config. Error is: ${formatError(e)}`);
|
|
122
|
+
config = emptyConfig();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return config;
|
|
126
|
+
}
|
|
127
|
+
buildMcpConfigEntry(isReadOnly, env) {
|
|
128
|
+
const args = ["-y", "mongodb-mcp-server@latest"];
|
|
129
|
+
if (isReadOnly) {
|
|
130
|
+
args.push("--readOnly");
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
command: "npx",
|
|
134
|
+
args: ["-y", "mongodb-mcp-server@latest"],
|
|
135
|
+
env,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
updateConfig(configPath, env, isReadOnly) {
|
|
139
|
+
const serversKey = this.getServersKey();
|
|
140
|
+
const environmentKey = this.getEnvironmentKey();
|
|
141
|
+
const updatedMcpConfigEntry = this.buildMcpConfigEntry(isReadOnly, env);
|
|
142
|
+
const existingContent = fs.existsSync(configPath) ? fs.readFileSync(configPath, "utf-8") : null;
|
|
143
|
+
if (existingContent !== null && existingContent.trim().length > 0) {
|
|
144
|
+
const resolvedPath = path.resolve(configPath);
|
|
145
|
+
ensureConfigDir(configPath);
|
|
146
|
+
try {
|
|
147
|
+
// Patch in place if file already has content
|
|
148
|
+
const patch = toPatch(updatedMcpConfigEntry, environmentKey);
|
|
149
|
+
const newContent = updateConfigInPlace(existingContent, serversKey, patch, updatedMcpConfigEntry);
|
|
150
|
+
fs.writeFileSync(resolvedPath, newContent, "utf-8");
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
// Fallback: write full config if in-place update fails (e.g. invalid JSONC)
|
|
154
|
+
const config = this.readConfig(configPath);
|
|
155
|
+
const servers = getOrCreateServersEntry(config, serversKey);
|
|
156
|
+
servers[MCP_SERVER_KEY] = updatedMcpConfigEntry;
|
|
157
|
+
writeConfigFile(configPath, config);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// New file: write full config
|
|
162
|
+
const config = this.readConfig(configPath);
|
|
163
|
+
const servers = getOrCreateServersEntry(config, serversKey);
|
|
164
|
+
servers[MCP_SERVER_KEY] = updatedMcpConfigEntry;
|
|
165
|
+
writeConfigFile(configPath, config);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Returns the shell command to open the config file. Override in subclasses for editor-specific behavior.
|
|
169
|
+
getOpenConfigCommand(configPath, platform, editor) {
|
|
170
|
+
switch (platform) {
|
|
171
|
+
case "mac":
|
|
172
|
+
return getOpenCommandMac(configPath, editor);
|
|
173
|
+
case "windows":
|
|
174
|
+
return getOpenCommandWindowsDefault(configPath);
|
|
175
|
+
case "linux":
|
|
176
|
+
return getOpenCommandLinux(configPath, editor);
|
|
177
|
+
default:
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async openConfigSettings() {
|
|
182
|
+
const platform = getPlatform();
|
|
183
|
+
if (!platform) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const cmd = this.getOpenConfigCommand(this.configPath, platform, this.toolType);
|
|
187
|
+
if (cmd) {
|
|
188
|
+
await new Promise((resolve, reject) => {
|
|
189
|
+
exec(cmd, (error) => {
|
|
190
|
+
if (error) {
|
|
191
|
+
reject(error);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
resolve(undefined);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The skills.sh agent ID this tool maps to, or null if [skills.sh](https://skills.sh)
|
|
202
|
+
* has no entry for it (e.g. Claude Desktop — no filesystem skills).
|
|
203
|
+
* Install paths are owned by `skills add`; we only map identity.
|
|
204
|
+
*/
|
|
205
|
+
get skillsAgentId() {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
class Cursor extends AITool {
|
|
210
|
+
constructor() {
|
|
211
|
+
super(...arguments);
|
|
212
|
+
this.name = "Cursor";
|
|
213
|
+
this.toolType = "cursor";
|
|
214
|
+
this.configFileName = "mcp.json";
|
|
215
|
+
this.tip = `Tip: Press ${getPlatform() === "mac" ? "Cmd+I" : "Ctrl+I"} in Cursor to open the Agent panel.\n`;
|
|
216
|
+
}
|
|
217
|
+
get configPath() {
|
|
218
|
+
return path.join(getBasePath(true), ".cursor", "mcp.json");
|
|
219
|
+
}
|
|
220
|
+
getOpenConfigCommand(configPath, platform) {
|
|
221
|
+
switch (platform) {
|
|
222
|
+
case "mac":
|
|
223
|
+
return getOpenCommandMac(configPath, "cursor");
|
|
224
|
+
case "windows":
|
|
225
|
+
return `cursor "${configPath}"`;
|
|
226
|
+
case "linux":
|
|
227
|
+
return getOpenCommandLinux(configPath, "cursor");
|
|
228
|
+
default:
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
get skillsAgentId() {
|
|
233
|
+
return "cursor";
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
class VSCode extends AITool {
|
|
237
|
+
constructor() {
|
|
238
|
+
super(...arguments);
|
|
239
|
+
this.name = "VS Code";
|
|
240
|
+
this.toolType = "vscode";
|
|
241
|
+
this.configFileName = "mcp.json";
|
|
242
|
+
this.tip = `Tip: Press ${getPlatform() === "mac" ? "Cmd+Shift+I" : "Ctrl+Shift+I"} in VS Code to open the Copilot panel.\n`;
|
|
243
|
+
}
|
|
244
|
+
getServersKey() {
|
|
245
|
+
return "servers";
|
|
246
|
+
}
|
|
247
|
+
get configPath() {
|
|
248
|
+
const platform = getPlatform();
|
|
249
|
+
switch (platform) {
|
|
250
|
+
case "windows":
|
|
251
|
+
return path.join(getBasePath(), "Code", "User", "mcp.json");
|
|
252
|
+
case "mac":
|
|
253
|
+
return path.join(getBasePath(), "Library", "Application Support", "Code", "User", "mcp.json");
|
|
254
|
+
case "linux":
|
|
255
|
+
return path.join(getBasePath(), ".config", "Code", "User", "mcp.json");
|
|
256
|
+
default:
|
|
257
|
+
return "";
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
getOpenConfigCommand(configPath, platform) {
|
|
261
|
+
switch (platform) {
|
|
262
|
+
case "mac":
|
|
263
|
+
return getOpenCommandMac(configPath, "vscode");
|
|
264
|
+
case "windows":
|
|
265
|
+
return `code "${configPath}"`;
|
|
266
|
+
case "linux":
|
|
267
|
+
return getOpenCommandLinux(configPath, "vscode");
|
|
268
|
+
default:
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
get skillsAgentId() {
|
|
273
|
+
return "github-copilot";
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
class Windsurf extends AITool {
|
|
277
|
+
constructor() {
|
|
278
|
+
super(...arguments);
|
|
279
|
+
this.name = "Windsurf";
|
|
280
|
+
this.toolType = "windsurf";
|
|
281
|
+
this.configFileName = "mcp_config.json";
|
|
282
|
+
this.tip = `Tip: Press ${getPlatform() === "mac" ? "Cmd+L" : "Ctrl+L"} in Windsurf to open the AI panel.\n`;
|
|
283
|
+
}
|
|
284
|
+
get configPath() {
|
|
285
|
+
return path.join(getBasePath(true), ".codeium", "windsurf", "mcp_config.json");
|
|
286
|
+
}
|
|
287
|
+
getOpenConfigCommand(configPath, platform) {
|
|
288
|
+
switch (platform) {
|
|
289
|
+
case "mac":
|
|
290
|
+
return getOpenCommandMac(configPath, "windsurf");
|
|
291
|
+
case "windows":
|
|
292
|
+
return `windsurf "${configPath}"`;
|
|
293
|
+
case "linux":
|
|
294
|
+
return getOpenCommandLinux(configPath, "windsurf");
|
|
295
|
+
default:
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
get skillsAgentId() {
|
|
300
|
+
return "windsurf";
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
class ClaudeDesktop extends AITool {
|
|
304
|
+
constructor() {
|
|
305
|
+
super(...arguments);
|
|
306
|
+
this.name = "Claude Desktop";
|
|
307
|
+
this.toolType = "claudeDesktop";
|
|
308
|
+
this.configFileName = "claude_desktop_config.json";
|
|
309
|
+
}
|
|
310
|
+
get configPath() {
|
|
311
|
+
const platform = getPlatform();
|
|
312
|
+
switch (platform) {
|
|
313
|
+
case "windows":
|
|
314
|
+
return path.join(getBasePath(), "Claude", "claude_desktop_config.json");
|
|
315
|
+
case "mac":
|
|
316
|
+
return path.join(getBasePath(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
317
|
+
case "linux":
|
|
318
|
+
return path.join(getBasePath(), ".config", "Claude", "claude_desktop_config.json");
|
|
319
|
+
default:
|
|
320
|
+
return "";
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
class ClaudeCode extends AITool {
|
|
325
|
+
constructor() {
|
|
326
|
+
super(...arguments);
|
|
327
|
+
this.name = "Claude Code";
|
|
328
|
+
this.toolType = "claudeCode";
|
|
329
|
+
this.configFileName = ".claude.json";
|
|
330
|
+
}
|
|
331
|
+
get configPath() {
|
|
332
|
+
return path.join(getBasePath(true), ".claude.json");
|
|
333
|
+
}
|
|
334
|
+
get skillsAgentId() {
|
|
335
|
+
return "claude-code";
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
class OpenCode extends AITool {
|
|
339
|
+
constructor() {
|
|
340
|
+
super(...arguments);
|
|
341
|
+
this.name = "Open Code";
|
|
342
|
+
this.toolType = "opencode";
|
|
343
|
+
this.configFileName = "opencode.json";
|
|
344
|
+
}
|
|
345
|
+
get configPath() {
|
|
346
|
+
return path.join(getBasePath(true), ".config", "opencode", "opencode.json");
|
|
347
|
+
}
|
|
348
|
+
getServersKey() {
|
|
349
|
+
return "mcp";
|
|
350
|
+
}
|
|
351
|
+
getEnvironmentKey() {
|
|
352
|
+
return "environment";
|
|
353
|
+
}
|
|
354
|
+
buildMcpConfigEntry(isReadOnly, env) {
|
|
355
|
+
const args = ["-y", "mongodb-mcp-server@latest"];
|
|
356
|
+
if (isReadOnly) {
|
|
357
|
+
args.push("--readOnly");
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
type: "local",
|
|
361
|
+
command: ["npx", ...args],
|
|
362
|
+
environment: Object.keys(env).length > 0 ? env : undefined,
|
|
363
|
+
enabled: true,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
get skillsAgentId() {
|
|
367
|
+
return "opencode";
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Opens the config file for the given tool using the tool's platform-specific command.
|
|
371
|
+
export const openConfigSettings = (tool) => {
|
|
372
|
+
return AI_TOOL_REGISTRY[tool].openConfigSettings();
|
|
373
|
+
};
|
|
374
|
+
export const AI_TOOL_REGISTRY = {
|
|
375
|
+
["cursor"]: new Cursor(),
|
|
376
|
+
["vscode"]: new VSCode(),
|
|
377
|
+
["windsurf"]: new Windsurf(),
|
|
378
|
+
["claudeDesktop"]: new ClaudeDesktop(),
|
|
379
|
+
["claudeCode"]: new ClaudeCode(),
|
|
380
|
+
["opencode"]: new OpenCode(),
|
|
381
|
+
};
|
|
382
|
+
//# sourceMappingURL=aiTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiTool.js","sourceRoot":"","sources":["../src/aiTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIlE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAiB,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAE/F,2EAA2E;AAC3E,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,IAAgB,EAAU,EAAE,CACvE,IAAI,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC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Ae,CAAC,EAAE,IAAI,aAAa,EAAE;IACtC,CAAC,YAAY,CAAC,EAAE,IAAI,UAAU,EAAE;IAChC,CAAC,UAAU,CAAC,EAAE,IAAI,QAAQ,EAAE;CAC/B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AI_TOOL_REGISTRY, type AIToolType } from "./aiTool.js";
|
|
2
|
+
export { buildSkillsAddArgs, installSkills, promptAndInstallSkills, type SkillsInstallOutcome, } from "./installSkills.js";
|
|
3
|
+
export { runSetup } from "./setupMcpServer.js";
|
|
4
|
+
export { SetupTelemetry, type SetupTelemetryContext, toBoolSet } from "./setupTelemetry.js";
|
|
5
|
+
export { formatError, getPlatform, type Platform } from "./setupAiToolsUtils.js";
|
|
6
|
+
export { openConfigSettings, TOOLS_WITHOUT_EDITORS } from "./aiTool.js";
|
|
7
|
+
export { SetupCliHandler } from "./setupCliHandler.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,KAAK,oBAAoB,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AI_TOOL_REGISTRY } from "./aiTool.js";
|
|
2
|
+
export { buildSkillsAddArgs, installSkills, promptAndInstallSkills, } from "./installSkills.js";
|
|
3
|
+
export { runSetup } from "./setupMcpServer.js";
|
|
4
|
+
export { SetupTelemetry, toBoolSet } from "./setupTelemetry.js";
|
|
5
|
+
export { formatError, getPlatform } from "./setupAiToolsUtils.js";
|
|
6
|
+
export { openConfigSettings, TOOLS_WITHOUT_EDITORS } from "./aiTool.js";
|
|
7
|
+
export { SetupCliHandler } from "./setupCliHandler.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAChE,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,sBAAsB,GAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAA8B,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,WAAW,EAAiB,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type AIToolType } from "./aiTool.js";
|
|
2
|
+
export type SkillsInstallOutcome = {
|
|
3
|
+
status: "installed";
|
|
4
|
+
} | {
|
|
5
|
+
status: "skipped";
|
|
6
|
+
reason: "no-agent-id" | "user-declined";
|
|
7
|
+
} | {
|
|
8
|
+
status: "failed";
|
|
9
|
+
exitCode: number;
|
|
10
|
+
};
|
|
11
|
+
export interface InstallSkillsOptions {
|
|
12
|
+
agentId: string;
|
|
13
|
+
cwd: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PromptAndInstallSkillsOptions {
|
|
16
|
+
tool: AIToolType;
|
|
17
|
+
cwd: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const NO_SKILLS_MESSAGE: string;
|
|
20
|
+
/**
|
|
21
|
+
* Assemble the args for `npx` to invoke the pinned skills CLI. Skills are
|
|
22
|
+
* always installed globally (`-g`) so they're available across the user's
|
|
23
|
+
* projects, matching how the MCP server itself is installed.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildSkillsAddArgs(agentId: string): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Shell out to `skills add`.
|
|
28
|
+
* Non-zero exit is reported to the user but does not throw
|
|
29
|
+
* since setup has already succeeded by this point.
|
|
30
|
+
*/
|
|
31
|
+
export declare function installSkills(opts: InstallSkillsOptions): Promise<SkillsInstallOutcome>;
|
|
32
|
+
/**
|
|
33
|
+
* Prompt the user for whether to install skills and call `installSkills`.
|
|
34
|
+
* Null-agent tools (Claude Desktop) skip prompts entirely.
|
|
35
|
+
*
|
|
36
|
+
* Never throws — except `ExitPromptError`, which is re-thrown so `runSetup`'s
|
|
37
|
+
* outer Ctrl+C handler can print "Setup cancelled". All other errors
|
|
38
|
+
* (unexpected prompt failure, etc.) are logged as warnings and converted to a
|
|
39
|
+
* `failed` outcome so setup can still print its success summary.
|
|
40
|
+
*/
|
|
41
|
+
export declare function promptAndInstallSkills(opts: PromptAndInstallSkillsOptions): Promise<SkillsInstallOutcome>;
|
|
42
|
+
//# sourceMappingURL=installSkills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installSkills.d.ts","sourceRoot":"","sources":["../src/installSkills.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,MAAM,oBAAoB,GAC1B;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAAA;CAAE,GAC9D;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,6BAA6B;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACf;AAID,eAAO,MAAM,iBAAiB,QAKJ,CAAC;AAK3B;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAE5D;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAU7F;AAgDD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA4B/G"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { confirm } from "@inquirer/prompts";
|
|
4
|
+
import { AI_TOOL_REGISTRY } from "./aiTool.js";
|
|
5
|
+
const SKILLS_REPO = "mongodb/agent-skills";
|
|
6
|
+
const SKILLS_REPO_URL = `https://github.com/${SKILLS_REPO}`;
|
|
7
|
+
export const NO_SKILLS_MESSAGE = `We're unable to install the MongoDB Agent Skills for this tool.\n` +
|
|
8
|
+
`\n` +
|
|
9
|
+
`See the MongoDB Agent Skills repo for manual install instructions:\n` +
|
|
10
|
+
`\n` +
|
|
11
|
+
` ${SKILLS_REPO_URL}`;
|
|
12
|
+
const SKILLS_PACKAGE_VERSION = "1";
|
|
13
|
+
const SKILLS_CLI_PIN = `skills@${SKILLS_PACKAGE_VERSION}`;
|
|
14
|
+
/**
|
|
15
|
+
* Assemble the args for `npx` to invoke the pinned skills CLI. Skills are
|
|
16
|
+
* always installed globally (`-g`) so they're available across the user's
|
|
17
|
+
* projects, matching how the MCP server itself is installed.
|
|
18
|
+
*/
|
|
19
|
+
export function buildSkillsAddArgs(agentId) {
|
|
20
|
+
return ["--yes", SKILLS_CLI_PIN, "add", SKILLS_REPO, "--agent", agentId, "-y", "-g"];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Shell out to `skills add`.
|
|
24
|
+
* Non-zero exit is reported to the user but does not throw
|
|
25
|
+
* since setup has already succeeded by this point.
|
|
26
|
+
*/
|
|
27
|
+
export async function installSkills(opts) {
|
|
28
|
+
const args = buildSkillsAddArgs(opts.agentId);
|
|
29
|
+
const exitCode = await runSkillsAdd(args, opts.cwd);
|
|
30
|
+
if (exitCode === 0) {
|
|
31
|
+
return { status: "installed" };
|
|
32
|
+
}
|
|
33
|
+
printInstallFailure(exitCode, args);
|
|
34
|
+
return { status: "failed", exitCode };
|
|
35
|
+
}
|
|
36
|
+
// Sentinel exit code used when `spawn` itself fails before the process runs
|
|
37
|
+
// (e.g. `npx` not on PATH). Real exit codes are 0–255, so -1 is unambiguous.
|
|
38
|
+
const SPAWN_ERROR_EXIT_CODE = -1;
|
|
39
|
+
function runSkillsAdd(args, cwd) {
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
// `shell: true` is required on Windows so `npx` (a `.cmd` shim) resolves
|
|
42
|
+
// through PATHEXT. Our args are controlled and contain no shell
|
|
43
|
+
// metacharacters, so there's no injection risk.
|
|
44
|
+
const child = spawn("npx", args, { stdio: "inherit", cwd, shell: true });
|
|
45
|
+
child.on("close", (code, signal) => {
|
|
46
|
+
if (signal !== null) {
|
|
47
|
+
// Killed by a signal (Ctrl+C, OOM, etc.). `code` is null in this
|
|
48
|
+
// case, so falling through to `code ?? 0` would mis-report the
|
|
49
|
+
// install as successful. Surface it as a non-zero sentinel.
|
|
50
|
+
console.error(chalk.red(`The skills CLI was terminated by signal ${signal}.`));
|
|
51
|
+
resolve(SPAWN_ERROR_EXIT_CODE);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
resolve(code ?? 0);
|
|
55
|
+
});
|
|
56
|
+
child.on("error", (err) => {
|
|
57
|
+
// Spawn-level error (npx missing, etc.). Print the message ourselves
|
|
58
|
+
// — nothing streamed to stderr because the process never started —
|
|
59
|
+
// then surface as a non-zero exit so the graceful-failure path runs.
|
|
60
|
+
console.error(chalk.red(`Failed to spawn the skills CLI: ${err.message}`));
|
|
61
|
+
resolve(SPAWN_ERROR_EXIT_CODE);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function printInstallFailure(exitCode, args) {
|
|
66
|
+
console.log("");
|
|
67
|
+
console.log(chalk.red(`Agent skills install failed (exit ${exitCode}). Setup completed, but skills were not installed. See the CLI output above for details.`));
|
|
68
|
+
console.log("");
|
|
69
|
+
console.log("You can retry manually:");
|
|
70
|
+
console.log(` npx ${args.join(" ")}`);
|
|
71
|
+
console.log("");
|
|
72
|
+
console.log(`Skills repo: ${SKILLS_REPO_URL}`);
|
|
73
|
+
console.log("");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Prompt the user for whether to install skills and call `installSkills`.
|
|
77
|
+
* Null-agent tools (Claude Desktop) skip prompts entirely.
|
|
78
|
+
*
|
|
79
|
+
* Never throws — except `ExitPromptError`, which is re-thrown so `runSetup`'s
|
|
80
|
+
* outer Ctrl+C handler can print "Setup cancelled". All other errors
|
|
81
|
+
* (unexpected prompt failure, etc.) are logged as warnings and converted to a
|
|
82
|
+
* `failed` outcome so setup can still print its success summary.
|
|
83
|
+
*/
|
|
84
|
+
export async function promptAndInstallSkills(opts) {
|
|
85
|
+
try {
|
|
86
|
+
const tool = AI_TOOL_REGISTRY[opts.tool];
|
|
87
|
+
const agentId = tool.skillsAgentId;
|
|
88
|
+
if (agentId === null) {
|
|
89
|
+
console.log(NO_SKILLS_MESSAGE);
|
|
90
|
+
return { status: "skipped", reason: "no-agent-id" };
|
|
91
|
+
}
|
|
92
|
+
const shouldInstall = await confirm({
|
|
93
|
+
message: `Install the MongoDB Agent Skills for ${tool.name}?`,
|
|
94
|
+
default: true,
|
|
95
|
+
});
|
|
96
|
+
if (!shouldInstall) {
|
|
97
|
+
return { status: "skipped", reason: "user-declined" };
|
|
98
|
+
}
|
|
99
|
+
return await installSkills({ agentId, cwd: opts.cwd });
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
// Ctrl+C: inquirer throws ExitPromptError. Let it propagate so the
|
|
103
|
+
// top-level runSetup handler can exit cleanly.
|
|
104
|
+
if (error && typeof error === "object" && "name" in error && error.name === "ExitPromptError") {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
108
|
+
console.warn(chalk.yellow(`\nWarning: skills install step failed: ${message}`));
|
|
109
|
+
return { status: "failed", exitCode: SPAWN_ERROR_EXIT_CODE };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=installSkills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installSkills.js","sourceRoot":"","sources":["../src/installSkills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAiBhE,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAC3C,MAAM,eAAe,GAAG,sBAAsB,WAAW,EAAE,CAAC;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAC1B,mEAAmE;IACnE,IAAI;IACJ,sEAAsE;IACtE,IAAI;IACJ,KAAK,eAAe,EAAE,CAAC;AAE3B,MAAM,sBA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