prpm 2.1.24 → 2.1.25
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/index.js +769 -24
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -170,7 +170,8 @@ async function addPackage(packageInfo) {
|
|
|
170
170
|
subtype: packageInfo.subtype,
|
|
171
171
|
sourceFormat: packageInfo.sourceFormat,
|
|
172
172
|
sourceSubtype: packageInfo.sourceSubtype,
|
|
173
|
-
installedPath: packageInfo.installedPath
|
|
173
|
+
installedPath: packageInfo.installedPath,
|
|
174
|
+
pluginMetadata: packageInfo.pluginMetadata
|
|
174
175
|
});
|
|
175
176
|
await writeLockfile(lockfile);
|
|
176
177
|
}
|
|
@@ -6885,9 +6886,9 @@ var require_stringify = __commonJS({
|
|
|
6885
6886
|
"../../node_modules/@iarna/toml/stringify.js"(exports2, module2) {
|
|
6886
6887
|
"use strict";
|
|
6887
6888
|
init_cjs_shims();
|
|
6888
|
-
module2.exports =
|
|
6889
|
+
module2.exports = stringify3;
|
|
6889
6890
|
module2.exports.value = stringifyInline;
|
|
6890
|
-
function
|
|
6891
|
+
function stringify3(obj) {
|
|
6891
6892
|
if (obj === null) throw typeError("null");
|
|
6892
6893
|
if (obj === void 0) throw typeError("undefined");
|
|
6893
6894
|
if (typeof obj !== "object") throw typeError(typeof obj);
|
|
@@ -14943,6 +14944,99 @@ function getMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
|
14943
14944
|
}
|
|
14944
14945
|
return (0, import_path11.join)(projectDir, ".mcp.json");
|
|
14945
14946
|
}
|
|
14947
|
+
function getCodexMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14948
|
+
if (global2) {
|
|
14949
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".codex", "config.toml");
|
|
14950
|
+
}
|
|
14951
|
+
return (0, import_path11.join)(projectDir, "codex.toml");
|
|
14952
|
+
}
|
|
14953
|
+
function getCursorMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14954
|
+
if (global2) {
|
|
14955
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".cursor", "mcp.json");
|
|
14956
|
+
}
|
|
14957
|
+
return (0, import_path11.join)(projectDir, ".cursor", "mcp.json");
|
|
14958
|
+
}
|
|
14959
|
+
function getWindsurfMCPConfigPath() {
|
|
14960
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".codeium", "windsurf", "mcp_config.json");
|
|
14961
|
+
}
|
|
14962
|
+
function getVSCodeMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14963
|
+
if (global2) {
|
|
14964
|
+
if (process.platform === "darwin") {
|
|
14965
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), "Library", "Application Support", "Code", "User", "mcp.json");
|
|
14966
|
+
} else if (process.platform === "win32") {
|
|
14967
|
+
return (0, import_path11.join)(process.env.APPDATA || (0, import_path11.join)((0, import_os3.homedir)(), "AppData", "Roaming"), "Code", "User", "mcp.json");
|
|
14968
|
+
} else {
|
|
14969
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".config", "Code", "User", "mcp.json");
|
|
14970
|
+
}
|
|
14971
|
+
}
|
|
14972
|
+
return (0, import_path11.join)(projectDir, ".vscode", "mcp.json");
|
|
14973
|
+
}
|
|
14974
|
+
function getGeminiMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14975
|
+
if (global2) {
|
|
14976
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".gemini", "settings.json");
|
|
14977
|
+
}
|
|
14978
|
+
return (0, import_path11.join)(projectDir, ".gemini", "settings.json");
|
|
14979
|
+
}
|
|
14980
|
+
function getOpenCodeMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14981
|
+
if (global2) {
|
|
14982
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".config", "opencode", "opencode.json");
|
|
14983
|
+
}
|
|
14984
|
+
return (0, import_path11.join)(projectDir, "opencode.json");
|
|
14985
|
+
}
|
|
14986
|
+
function getKiroMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14987
|
+
if (global2) {
|
|
14988
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".kiro", "settings", "mcp.json");
|
|
14989
|
+
}
|
|
14990
|
+
return (0, import_path11.join)(projectDir, ".kiro", "settings", "mcp.json");
|
|
14991
|
+
}
|
|
14992
|
+
function getTraeMCPConfigPath(projectDir = process.cwd()) {
|
|
14993
|
+
return (0, import_path11.join)(projectDir, ".trae", "mcp.json");
|
|
14994
|
+
}
|
|
14995
|
+
function getAmpMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
14996
|
+
if (global2) {
|
|
14997
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".amp", "settings.json");
|
|
14998
|
+
}
|
|
14999
|
+
return (0, import_path11.join)(projectDir, ".amp", "settings.json");
|
|
15000
|
+
}
|
|
15001
|
+
function getZedMCPConfigPath() {
|
|
15002
|
+
if (process.platform === "darwin") {
|
|
15003
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".config", "zed", "settings.json");
|
|
15004
|
+
} else if (process.platform === "win32") {
|
|
15005
|
+
return (0, import_path11.join)(process.env.APPDATA || (0, import_path11.join)((0, import_os3.homedir)(), "AppData", "Roaming"), "Zed", "settings.json");
|
|
15006
|
+
}
|
|
15007
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".config", "zed", "settings.json");
|
|
15008
|
+
}
|
|
15009
|
+
function getMCPConfigLocation(editor, global2) {
|
|
15010
|
+
switch (editor) {
|
|
15011
|
+
case "codex":
|
|
15012
|
+
return global2 ? "~/.codex/config.toml" : "codex.toml";
|
|
15013
|
+
case "cursor":
|
|
15014
|
+
return global2 ? "~/.cursor/mcp.json" : ".cursor/mcp.json";
|
|
15015
|
+
case "windsurf":
|
|
15016
|
+
return "~/.codeium/windsurf/mcp_config.json";
|
|
15017
|
+
case "vscode": {
|
|
15018
|
+
if (!global2) return ".vscode/mcp.json";
|
|
15019
|
+
if (process.platform === "win32") return "%APPDATA%/Code/User/mcp.json";
|
|
15020
|
+
if (process.platform === "darwin") return "~/Library/Application Support/Code/User/mcp.json";
|
|
15021
|
+
return "~/.config/Code/User/mcp.json";
|
|
15022
|
+
}
|
|
15023
|
+
case "gemini":
|
|
15024
|
+
return global2 ? "~/.gemini/settings.json" : ".gemini/settings.json";
|
|
15025
|
+
case "opencode":
|
|
15026
|
+
return global2 ? "~/.config/opencode/opencode.json" : "opencode.json";
|
|
15027
|
+
case "kiro":
|
|
15028
|
+
return global2 ? "~/.kiro/settings/mcp.json" : ".kiro/settings/mcp.json";
|
|
15029
|
+
case "trae":
|
|
15030
|
+
return ".trae/mcp.json";
|
|
15031
|
+
case "amp":
|
|
15032
|
+
return global2 ? "~/.amp/settings.json" : ".amp/settings.json";
|
|
15033
|
+
case "zed":
|
|
15034
|
+
return "~/.config/zed/settings.json";
|
|
15035
|
+
case "claude":
|
|
15036
|
+
default:
|
|
15037
|
+
return global2 ? "~/.claude/settings.json" : ".mcp.json";
|
|
15038
|
+
}
|
|
15039
|
+
}
|
|
14946
15040
|
function readMCPConfig(configPath) {
|
|
14947
15041
|
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
14948
15042
|
return { mcpServers: {} };
|
|
@@ -14961,7 +15055,284 @@ function writeMCPConfig(configPath, config) {
|
|
|
14961
15055
|
}
|
|
14962
15056
|
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
14963
15057
|
}
|
|
14964
|
-
function
|
|
15058
|
+
function readVSCodeMCPConfig(configPath) {
|
|
15059
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15060
|
+
return { servers: {} };
|
|
15061
|
+
}
|
|
15062
|
+
try {
|
|
15063
|
+
const content = (0, import_fs10.readFileSync)(configPath, "utf-8");
|
|
15064
|
+
return JSON.parse(content);
|
|
15065
|
+
} catch (error) {
|
|
15066
|
+
return { servers: {} };
|
|
15067
|
+
}
|
|
15068
|
+
}
|
|
15069
|
+
function writeVSCodeMCPConfig(configPath, config) {
|
|
15070
|
+
const dir = (0, import_path11.dirname)(configPath);
|
|
15071
|
+
if (!(0, import_fs10.existsSync)(dir)) {
|
|
15072
|
+
(0, import_fs10.mkdirSync)(dir, { recursive: true });
|
|
15073
|
+
}
|
|
15074
|
+
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
15075
|
+
}
|
|
15076
|
+
function readCodexConfig(configPath) {
|
|
15077
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15078
|
+
return { mcp_servers: {} };
|
|
15079
|
+
}
|
|
15080
|
+
try {
|
|
15081
|
+
const content = (0, import_fs10.readFileSync)(configPath, "utf-8");
|
|
15082
|
+
const parsed = TOML3.parse(content);
|
|
15083
|
+
return parsed;
|
|
15084
|
+
} catch (error) {
|
|
15085
|
+
return { mcp_servers: {} };
|
|
15086
|
+
}
|
|
15087
|
+
}
|
|
15088
|
+
function writeCodexConfig(configPath, config) {
|
|
15089
|
+
const dir = (0, import_path11.dirname)(configPath);
|
|
15090
|
+
if (!(0, import_fs10.existsSync)(dir)) {
|
|
15091
|
+
(0, import_fs10.mkdirSync)(dir, { recursive: true });
|
|
15092
|
+
}
|
|
15093
|
+
(0, import_fs10.writeFileSync)(configPath, TOML3.stringify(config) + "\n");
|
|
15094
|
+
}
|
|
15095
|
+
function toCodexServerConfig(server) {
|
|
15096
|
+
const codexServer = {};
|
|
15097
|
+
if (server.command) {
|
|
15098
|
+
codexServer.command = server.command;
|
|
15099
|
+
if (server.args && server.args.length > 0) {
|
|
15100
|
+
codexServer.args = server.args;
|
|
15101
|
+
}
|
|
15102
|
+
if (server.cwd) {
|
|
15103
|
+
codexServer.cwd = server.cwd;
|
|
15104
|
+
}
|
|
15105
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
15106
|
+
codexServer.env = server.env;
|
|
15107
|
+
}
|
|
15108
|
+
}
|
|
15109
|
+
if (server.url) {
|
|
15110
|
+
codexServer.url = server.url;
|
|
15111
|
+
if (server.bearer_token_env_var) {
|
|
15112
|
+
codexServer.bearer_token_env_var = server.bearer_token_env_var;
|
|
15113
|
+
}
|
|
15114
|
+
if (server.http_headers && Object.keys(server.http_headers).length > 0) {
|
|
15115
|
+
codexServer.http_headers = server.http_headers;
|
|
15116
|
+
}
|
|
15117
|
+
if (server.env_http_headers && Object.keys(server.env_http_headers).length > 0) {
|
|
15118
|
+
codexServer.env_http_headers = server.env_http_headers;
|
|
15119
|
+
}
|
|
15120
|
+
}
|
|
15121
|
+
if (server.enabled !== void 0) {
|
|
15122
|
+
codexServer.enabled = server.enabled;
|
|
15123
|
+
}
|
|
15124
|
+
if (server.enabled_tools && server.enabled_tools.length > 0) {
|
|
15125
|
+
codexServer.enabled_tools = server.enabled_tools;
|
|
15126
|
+
}
|
|
15127
|
+
if (server.disabled_tools && server.disabled_tools.length > 0) {
|
|
15128
|
+
codexServer.disabled_tools = server.disabled_tools;
|
|
15129
|
+
}
|
|
15130
|
+
if (server.startup_timeout_sec !== void 0) {
|
|
15131
|
+
codexServer.startup_timeout_sec = server.startup_timeout_sec;
|
|
15132
|
+
}
|
|
15133
|
+
if (server.tool_timeout_sec !== void 0) {
|
|
15134
|
+
codexServer.tool_timeout_sec = server.tool_timeout_sec;
|
|
15135
|
+
}
|
|
15136
|
+
return codexServer;
|
|
15137
|
+
}
|
|
15138
|
+
function toVSCodeServerConfig(server) {
|
|
15139
|
+
const vscodeServer = { ...server };
|
|
15140
|
+
if (vscodeServer.command) {
|
|
15141
|
+
vscodeServer.type = "stdio";
|
|
15142
|
+
} else if (vscodeServer.url) {
|
|
15143
|
+
vscodeServer.type = "http";
|
|
15144
|
+
}
|
|
15145
|
+
return vscodeServer;
|
|
15146
|
+
}
|
|
15147
|
+
function mergeCodexMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15148
|
+
const result = {
|
|
15149
|
+
added: [],
|
|
15150
|
+
skipped: [],
|
|
15151
|
+
warnings: []
|
|
15152
|
+
};
|
|
15153
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15154
|
+
return result;
|
|
15155
|
+
}
|
|
15156
|
+
const configPath = getCodexMCPConfigPath(global2, projectDir);
|
|
15157
|
+
const config = readCodexConfig(configPath);
|
|
15158
|
+
if (!config.mcp_servers) {
|
|
15159
|
+
config.mcp_servers = {};
|
|
15160
|
+
}
|
|
15161
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
15162
|
+
if (config.mcp_servers[name]) {
|
|
15163
|
+
result.skipped.push(name);
|
|
15164
|
+
result.warnings.push(`MCP server '${name}' already exists in Codex config, keeping existing configuration`);
|
|
15165
|
+
} else {
|
|
15166
|
+
config.mcp_servers[name] = toCodexServerConfig(server);
|
|
15167
|
+
result.added.push(name);
|
|
15168
|
+
}
|
|
15169
|
+
}
|
|
15170
|
+
if (result.added.length > 0) {
|
|
15171
|
+
writeCodexConfig(configPath, config);
|
|
15172
|
+
}
|
|
15173
|
+
return result;
|
|
15174
|
+
}
|
|
15175
|
+
function removeCodexMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15176
|
+
const result = {
|
|
15177
|
+
removed: [],
|
|
15178
|
+
kept: [],
|
|
15179
|
+
warnings: []
|
|
15180
|
+
};
|
|
15181
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15182
|
+
return result;
|
|
15183
|
+
}
|
|
15184
|
+
const configPath = getCodexMCPConfigPath(global2, projectDir);
|
|
15185
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15186
|
+
return result;
|
|
15187
|
+
}
|
|
15188
|
+
const config = readCodexConfig(configPath);
|
|
15189
|
+
if (!config.mcp_servers) {
|
|
15190
|
+
return result;
|
|
15191
|
+
}
|
|
15192
|
+
for (const [name, originalServer] of Object.entries(servers)) {
|
|
15193
|
+
const currentServer = config.mcp_servers[name];
|
|
15194
|
+
if (!currentServer) {
|
|
15195
|
+
continue;
|
|
15196
|
+
}
|
|
15197
|
+
const originalCodexServer = toCodexServerConfig(originalServer);
|
|
15198
|
+
if (serversEqual(currentServer, originalCodexServer)) {
|
|
15199
|
+
delete config.mcp_servers[name];
|
|
15200
|
+
result.removed.push(name);
|
|
15201
|
+
} else {
|
|
15202
|
+
result.kept.push(name);
|
|
15203
|
+
result.warnings.push(`Keeping modified MCP server '${name}' in Codex config`);
|
|
15204
|
+
}
|
|
15205
|
+
}
|
|
15206
|
+
if (Object.keys(config.mcp_servers).length === 0) {
|
|
15207
|
+
delete config.mcp_servers;
|
|
15208
|
+
}
|
|
15209
|
+
if (result.removed.length > 0) {
|
|
15210
|
+
writeCodexConfig(configPath, config);
|
|
15211
|
+
}
|
|
15212
|
+
return result;
|
|
15213
|
+
}
|
|
15214
|
+
function mergeVSCodeMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15215
|
+
const result = {
|
|
15216
|
+
added: [],
|
|
15217
|
+
skipped: [],
|
|
15218
|
+
warnings: []
|
|
15219
|
+
};
|
|
15220
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15221
|
+
return result;
|
|
15222
|
+
}
|
|
15223
|
+
const configPath = getVSCodeMCPConfigPath(global2, projectDir);
|
|
15224
|
+
const config = readVSCodeMCPConfig(configPath);
|
|
15225
|
+
if (!config.servers) {
|
|
15226
|
+
config.servers = {};
|
|
15227
|
+
}
|
|
15228
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
15229
|
+
if (config.servers[name]) {
|
|
15230
|
+
result.skipped.push(name);
|
|
15231
|
+
result.warnings.push(`MCP server '${name}' already exists in VS Code config, keeping existing configuration`);
|
|
15232
|
+
} else {
|
|
15233
|
+
config.servers[name] = toVSCodeServerConfig(server);
|
|
15234
|
+
result.added.push(name);
|
|
15235
|
+
}
|
|
15236
|
+
}
|
|
15237
|
+
if (result.added.length > 0) {
|
|
15238
|
+
writeVSCodeMCPConfig(configPath, config);
|
|
15239
|
+
}
|
|
15240
|
+
return result;
|
|
15241
|
+
}
|
|
15242
|
+
function removeVSCodeMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15243
|
+
const result = {
|
|
15244
|
+
removed: [],
|
|
15245
|
+
kept: [],
|
|
15246
|
+
warnings: []
|
|
15247
|
+
};
|
|
15248
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15249
|
+
return result;
|
|
15250
|
+
}
|
|
15251
|
+
const configPath = getVSCodeMCPConfigPath(global2, projectDir);
|
|
15252
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15253
|
+
return result;
|
|
15254
|
+
}
|
|
15255
|
+
const config = readVSCodeMCPConfig(configPath);
|
|
15256
|
+
if (!config.servers) {
|
|
15257
|
+
return result;
|
|
15258
|
+
}
|
|
15259
|
+
for (const [name, originalServer] of Object.entries(servers)) {
|
|
15260
|
+
const currentServer = config.servers[name];
|
|
15261
|
+
if (!currentServer) {
|
|
15262
|
+
continue;
|
|
15263
|
+
}
|
|
15264
|
+
const originalVSCodeServer = toVSCodeServerConfig(originalServer);
|
|
15265
|
+
if (serversEqual(currentServer, originalVSCodeServer)) {
|
|
15266
|
+
delete config.servers[name];
|
|
15267
|
+
result.removed.push(name);
|
|
15268
|
+
} else {
|
|
15269
|
+
result.kept.push(name);
|
|
15270
|
+
result.warnings.push(`Keeping modified MCP server '${name}' in VS Code config`);
|
|
15271
|
+
}
|
|
15272
|
+
}
|
|
15273
|
+
if (Object.keys(config.servers).length === 0) {
|
|
15274
|
+
delete config.servers;
|
|
15275
|
+
}
|
|
15276
|
+
if (result.removed.length > 0) {
|
|
15277
|
+
writeVSCodeMCPConfig(configPath, config);
|
|
15278
|
+
}
|
|
15279
|
+
return result;
|
|
15280
|
+
}
|
|
15281
|
+
function mergeEditorMCPServers(servers, editor = "claude", global2 = false, projectDir = process.cwd()) {
|
|
15282
|
+
switch (editor) {
|
|
15283
|
+
case "codex":
|
|
15284
|
+
return mergeCodexMCPServers(servers, global2, projectDir);
|
|
15285
|
+
case "cursor":
|
|
15286
|
+
return mergeCursorMCPServers(servers, global2, projectDir);
|
|
15287
|
+
case "windsurf":
|
|
15288
|
+
return mergeWindsurfMCPServers(servers);
|
|
15289
|
+
case "vscode":
|
|
15290
|
+
return mergeVSCodeMCPServers(servers, global2, projectDir);
|
|
15291
|
+
case "gemini":
|
|
15292
|
+
return mergeGeminiSettingsMCPServers(servers, global2, projectDir);
|
|
15293
|
+
case "opencode":
|
|
15294
|
+
return mergeOpenCodeMCPServers(servers, global2, projectDir);
|
|
15295
|
+
case "kiro":
|
|
15296
|
+
return mergeKiroMCPServers(servers, global2, projectDir);
|
|
15297
|
+
case "trae":
|
|
15298
|
+
return mergeTraeMCPServers(servers, projectDir);
|
|
15299
|
+
case "amp":
|
|
15300
|
+
return mergeAmpMCPServers(servers, global2, projectDir);
|
|
15301
|
+
case "zed":
|
|
15302
|
+
return mergeZedMCPServers(servers);
|
|
15303
|
+
case "claude":
|
|
15304
|
+
default:
|
|
15305
|
+
return mergeMCPServers2(servers, global2, projectDir);
|
|
15306
|
+
}
|
|
15307
|
+
}
|
|
15308
|
+
function removeEditorMCPServers(servers, editor = "claude", global2 = false, projectDir = process.cwd()) {
|
|
15309
|
+
switch (editor) {
|
|
15310
|
+
case "codex":
|
|
15311
|
+
return removeCodexMCPServers(servers, global2, projectDir);
|
|
15312
|
+
case "cursor":
|
|
15313
|
+
return removeCursorMCPServers(servers, global2, projectDir);
|
|
15314
|
+
case "windsurf":
|
|
15315
|
+
return removeWindsurfMCPServers(servers);
|
|
15316
|
+
case "vscode":
|
|
15317
|
+
return removeVSCodeMCPServers(servers, global2, projectDir);
|
|
15318
|
+
case "gemini":
|
|
15319
|
+
return removeGeminiSettingsMCPServers(servers, global2, projectDir);
|
|
15320
|
+
case "opencode":
|
|
15321
|
+
return removeOpenCodeMCPServers(servers, global2, projectDir);
|
|
15322
|
+
case "kiro":
|
|
15323
|
+
return removeKiroMCPServers(servers, global2, projectDir);
|
|
15324
|
+
case "trae":
|
|
15325
|
+
return removeTraeMCPServers(servers, projectDir);
|
|
15326
|
+
case "amp":
|
|
15327
|
+
return removeAmpMCPServers(servers, global2, projectDir);
|
|
15328
|
+
case "zed":
|
|
15329
|
+
return removeZedMCPServers(servers);
|
|
15330
|
+
case "claude":
|
|
15331
|
+
default:
|
|
15332
|
+
return removeMCPServers(servers, global2, projectDir);
|
|
15333
|
+
}
|
|
15334
|
+
}
|
|
15335
|
+
function mergeMCPServersToPath(servers, configPath) {
|
|
14965
15336
|
const result = {
|
|
14966
15337
|
added: [],
|
|
14967
15338
|
skipped: [],
|
|
@@ -14970,7 +15341,6 @@ function mergeMCPServers2(servers, global2 = false, projectDir = process.cwd())
|
|
|
14970
15341
|
if (!servers || Object.keys(servers).length === 0) {
|
|
14971
15342
|
return result;
|
|
14972
15343
|
}
|
|
14973
|
-
const configPath = getMCPConfigPath(global2, projectDir);
|
|
14974
15344
|
const config = readMCPConfig(configPath);
|
|
14975
15345
|
if (!config.mcpServers) {
|
|
14976
15346
|
config.mcpServers = {};
|
|
@@ -14989,7 +15359,7 @@ function mergeMCPServers2(servers, global2 = false, projectDir = process.cwd())
|
|
|
14989
15359
|
}
|
|
14990
15360
|
return result;
|
|
14991
15361
|
}
|
|
14992
|
-
function
|
|
15362
|
+
function removeMCPServersFromPath(servers, configPath) {
|
|
14993
15363
|
const result = {
|
|
14994
15364
|
removed: [],
|
|
14995
15365
|
kept: [],
|
|
@@ -14998,7 +15368,6 @@ function removeMCPServers(servers, global2 = false, projectDir = process.cwd())
|
|
|
14998
15368
|
if (!servers || Object.keys(servers).length === 0) {
|
|
14999
15369
|
return result;
|
|
15000
15370
|
}
|
|
15001
|
-
const configPath = getMCPConfigPath(global2, projectDir);
|
|
15002
15371
|
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15003
15372
|
return result;
|
|
15004
15373
|
}
|
|
@@ -15027,6 +15396,323 @@ function removeMCPServers(servers, global2 = false, projectDir = process.cwd())
|
|
|
15027
15396
|
}
|
|
15028
15397
|
return result;
|
|
15029
15398
|
}
|
|
15399
|
+
function mergeMCPServers2(servers, global2 = false, projectDir = process.cwd()) {
|
|
15400
|
+
return mergeMCPServersToPath(servers, getMCPConfigPath(global2, projectDir));
|
|
15401
|
+
}
|
|
15402
|
+
function removeMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15403
|
+
return removeMCPServersFromPath(servers, getMCPConfigPath(global2, projectDir));
|
|
15404
|
+
}
|
|
15405
|
+
function mergeCursorMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15406
|
+
return mergeMCPServersToPath(servers, getCursorMCPConfigPath(global2, projectDir));
|
|
15407
|
+
}
|
|
15408
|
+
function removeCursorMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15409
|
+
return removeMCPServersFromPath(servers, getCursorMCPConfigPath(global2, projectDir));
|
|
15410
|
+
}
|
|
15411
|
+
function mergeWindsurfMCPServers(servers) {
|
|
15412
|
+
return mergeMCPServersToPath(servers, getWindsurfMCPConfigPath());
|
|
15413
|
+
}
|
|
15414
|
+
function removeWindsurfMCPServers(servers) {
|
|
15415
|
+
return removeMCPServersFromPath(servers, getWindsurfMCPConfigPath());
|
|
15416
|
+
}
|
|
15417
|
+
function readOpenCodeConfig(configPath) {
|
|
15418
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15419
|
+
return { mcp: {} };
|
|
15420
|
+
}
|
|
15421
|
+
try {
|
|
15422
|
+
const content = (0, import_fs10.readFileSync)(configPath, "utf-8");
|
|
15423
|
+
return JSON.parse(content);
|
|
15424
|
+
} catch (error) {
|
|
15425
|
+
return { mcp: {} };
|
|
15426
|
+
}
|
|
15427
|
+
}
|
|
15428
|
+
function writeOpenCodeConfig(configPath, config) {
|
|
15429
|
+
const dir = (0, import_path11.dirname)(configPath);
|
|
15430
|
+
if (!(0, import_fs10.existsSync)(dir)) {
|
|
15431
|
+
(0, import_fs10.mkdirSync)(dir, { recursive: true });
|
|
15432
|
+
}
|
|
15433
|
+
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
15434
|
+
}
|
|
15435
|
+
function toOpenCodeServerConfig(server) {
|
|
15436
|
+
const ocServer = {};
|
|
15437
|
+
if (server.command) {
|
|
15438
|
+
ocServer.type = "local";
|
|
15439
|
+
ocServer.command = server.command;
|
|
15440
|
+
if (server.args && server.args.length > 0) {
|
|
15441
|
+
ocServer.args = server.args;
|
|
15442
|
+
}
|
|
15443
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
15444
|
+
ocServer.env = server.env;
|
|
15445
|
+
}
|
|
15446
|
+
}
|
|
15447
|
+
if (server.url) {
|
|
15448
|
+
ocServer.url = server.url;
|
|
15449
|
+
}
|
|
15450
|
+
return ocServer;
|
|
15451
|
+
}
|
|
15452
|
+
function mergeOpenCodeMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15453
|
+
const result = {
|
|
15454
|
+
added: [],
|
|
15455
|
+
skipped: [],
|
|
15456
|
+
warnings: []
|
|
15457
|
+
};
|
|
15458
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15459
|
+
return result;
|
|
15460
|
+
}
|
|
15461
|
+
const configPath = getOpenCodeMCPConfigPath(global2, projectDir);
|
|
15462
|
+
const config = readOpenCodeConfig(configPath);
|
|
15463
|
+
if (!config.mcp) {
|
|
15464
|
+
config.mcp = {};
|
|
15465
|
+
}
|
|
15466
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
15467
|
+
if (config.mcp[name]) {
|
|
15468
|
+
result.skipped.push(name);
|
|
15469
|
+
result.warnings.push(`MCP server '${name}' already exists in OpenCode config, keeping existing configuration`);
|
|
15470
|
+
} else {
|
|
15471
|
+
config.mcp[name] = toOpenCodeServerConfig(server);
|
|
15472
|
+
result.added.push(name);
|
|
15473
|
+
}
|
|
15474
|
+
}
|
|
15475
|
+
if (result.added.length > 0) {
|
|
15476
|
+
writeOpenCodeConfig(configPath, config);
|
|
15477
|
+
}
|
|
15478
|
+
return result;
|
|
15479
|
+
}
|
|
15480
|
+
function removeOpenCodeMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15481
|
+
const result = {
|
|
15482
|
+
removed: [],
|
|
15483
|
+
kept: [],
|
|
15484
|
+
warnings: []
|
|
15485
|
+
};
|
|
15486
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15487
|
+
return result;
|
|
15488
|
+
}
|
|
15489
|
+
const configPath = getOpenCodeMCPConfigPath(global2, projectDir);
|
|
15490
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15491
|
+
return result;
|
|
15492
|
+
}
|
|
15493
|
+
const config = readOpenCodeConfig(configPath);
|
|
15494
|
+
if (!config.mcp) {
|
|
15495
|
+
return result;
|
|
15496
|
+
}
|
|
15497
|
+
for (const [name, originalServer] of Object.entries(servers)) {
|
|
15498
|
+
const currentServer = config.mcp[name];
|
|
15499
|
+
if (!currentServer) {
|
|
15500
|
+
continue;
|
|
15501
|
+
}
|
|
15502
|
+
const originalOCServer = toOpenCodeServerConfig(originalServer);
|
|
15503
|
+
if (serversEqual(currentServer, originalOCServer)) {
|
|
15504
|
+
delete config.mcp[name];
|
|
15505
|
+
result.removed.push(name);
|
|
15506
|
+
} else {
|
|
15507
|
+
result.kept.push(name);
|
|
15508
|
+
result.warnings.push(`Keeping modified MCP server '${name}' in OpenCode config`);
|
|
15509
|
+
}
|
|
15510
|
+
}
|
|
15511
|
+
if (Object.keys(config.mcp).length === 0) {
|
|
15512
|
+
delete config.mcp;
|
|
15513
|
+
}
|
|
15514
|
+
if (result.removed.length > 0) {
|
|
15515
|
+
writeOpenCodeConfig(configPath, config);
|
|
15516
|
+
}
|
|
15517
|
+
return result;
|
|
15518
|
+
}
|
|
15519
|
+
function mergeKiroMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15520
|
+
return mergeMCPServersToPath(servers, getKiroMCPConfigPath(global2, projectDir));
|
|
15521
|
+
}
|
|
15522
|
+
function removeKiroMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15523
|
+
return removeMCPServersFromPath(servers, getKiroMCPConfigPath(global2, projectDir));
|
|
15524
|
+
}
|
|
15525
|
+
function mergeTraeMCPServers(servers, projectDir = process.cwd()) {
|
|
15526
|
+
return mergeMCPServersToPath(servers, getTraeMCPConfigPath(projectDir));
|
|
15527
|
+
}
|
|
15528
|
+
function removeTraeMCPServers(servers, projectDir = process.cwd()) {
|
|
15529
|
+
return removeMCPServersFromPath(servers, getTraeMCPConfigPath(projectDir));
|
|
15530
|
+
}
|
|
15531
|
+
function readAmpConfig(configPath) {
|
|
15532
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15533
|
+
return { "amp.mcpServers": {} };
|
|
15534
|
+
}
|
|
15535
|
+
try {
|
|
15536
|
+
const content = (0, import_fs10.readFileSync)(configPath, "utf-8");
|
|
15537
|
+
return JSON.parse(content);
|
|
15538
|
+
} catch (error) {
|
|
15539
|
+
return { "amp.mcpServers": {} };
|
|
15540
|
+
}
|
|
15541
|
+
}
|
|
15542
|
+
function writeAmpConfig(configPath, config) {
|
|
15543
|
+
const dir = (0, import_path11.dirname)(configPath);
|
|
15544
|
+
if (!(0, import_fs10.existsSync)(dir)) {
|
|
15545
|
+
(0, import_fs10.mkdirSync)(dir, { recursive: true });
|
|
15546
|
+
}
|
|
15547
|
+
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
15548
|
+
}
|
|
15549
|
+
function mergeAmpMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15550
|
+
const result = {
|
|
15551
|
+
added: [],
|
|
15552
|
+
skipped: [],
|
|
15553
|
+
warnings: []
|
|
15554
|
+
};
|
|
15555
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15556
|
+
return result;
|
|
15557
|
+
}
|
|
15558
|
+
const configPath = getAmpMCPConfigPath(global2, projectDir);
|
|
15559
|
+
const config = readAmpConfig(configPath);
|
|
15560
|
+
if (!config["amp.mcpServers"]) {
|
|
15561
|
+
config["amp.mcpServers"] = {};
|
|
15562
|
+
}
|
|
15563
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
15564
|
+
if (config["amp.mcpServers"][name]) {
|
|
15565
|
+
result.skipped.push(name);
|
|
15566
|
+
result.warnings.push(`MCP server '${name}' already exists in Amp config, keeping existing configuration`);
|
|
15567
|
+
} else {
|
|
15568
|
+
config["amp.mcpServers"][name] = server;
|
|
15569
|
+
result.added.push(name);
|
|
15570
|
+
}
|
|
15571
|
+
}
|
|
15572
|
+
if (result.added.length > 0) {
|
|
15573
|
+
writeAmpConfig(configPath, config);
|
|
15574
|
+
}
|
|
15575
|
+
return result;
|
|
15576
|
+
}
|
|
15577
|
+
function removeAmpMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15578
|
+
const result = {
|
|
15579
|
+
removed: [],
|
|
15580
|
+
kept: [],
|
|
15581
|
+
warnings: []
|
|
15582
|
+
};
|
|
15583
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15584
|
+
return result;
|
|
15585
|
+
}
|
|
15586
|
+
const configPath = getAmpMCPConfigPath(global2, projectDir);
|
|
15587
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15588
|
+
return result;
|
|
15589
|
+
}
|
|
15590
|
+
const config = readAmpConfig(configPath);
|
|
15591
|
+
if (!config["amp.mcpServers"]) {
|
|
15592
|
+
return result;
|
|
15593
|
+
}
|
|
15594
|
+
for (const [name, originalServer] of Object.entries(servers)) {
|
|
15595
|
+
const currentServer = config["amp.mcpServers"][name];
|
|
15596
|
+
if (!currentServer) {
|
|
15597
|
+
continue;
|
|
15598
|
+
}
|
|
15599
|
+
if (serversEqual(currentServer, originalServer)) {
|
|
15600
|
+
delete config["amp.mcpServers"][name];
|
|
15601
|
+
result.removed.push(name);
|
|
15602
|
+
} else {
|
|
15603
|
+
result.kept.push(name);
|
|
15604
|
+
result.warnings.push(`Keeping modified MCP server '${name}' in Amp config`);
|
|
15605
|
+
}
|
|
15606
|
+
}
|
|
15607
|
+
if (Object.keys(config["amp.mcpServers"]).length === 0) {
|
|
15608
|
+
delete config["amp.mcpServers"];
|
|
15609
|
+
}
|
|
15610
|
+
if (result.removed.length > 0) {
|
|
15611
|
+
writeAmpConfig(configPath, config);
|
|
15612
|
+
}
|
|
15613
|
+
return result;
|
|
15614
|
+
}
|
|
15615
|
+
function readZedConfig(configPath) {
|
|
15616
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15617
|
+
return { context_servers: {} };
|
|
15618
|
+
}
|
|
15619
|
+
try {
|
|
15620
|
+
const content = (0, import_fs10.readFileSync)(configPath, "utf-8");
|
|
15621
|
+
return JSON.parse(content);
|
|
15622
|
+
} catch (error) {
|
|
15623
|
+
return { context_servers: {} };
|
|
15624
|
+
}
|
|
15625
|
+
}
|
|
15626
|
+
function writeZedConfig(configPath, config) {
|
|
15627
|
+
const dir = (0, import_path11.dirname)(configPath);
|
|
15628
|
+
if (!(0, import_fs10.existsSync)(dir)) {
|
|
15629
|
+
(0, import_fs10.mkdirSync)(dir, { recursive: true });
|
|
15630
|
+
}
|
|
15631
|
+
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
15632
|
+
}
|
|
15633
|
+
function toZedServerConfig(server) {
|
|
15634
|
+
const zedServer = {};
|
|
15635
|
+
if (server.command) {
|
|
15636
|
+
zedServer.command = server.command;
|
|
15637
|
+
if (server.args && server.args.length > 0) {
|
|
15638
|
+
zedServer.args = server.args;
|
|
15639
|
+
}
|
|
15640
|
+
if (server.env && Object.keys(server.env).length > 0) {
|
|
15641
|
+
zedServer.env = server.env;
|
|
15642
|
+
}
|
|
15643
|
+
}
|
|
15644
|
+
if (server.url) {
|
|
15645
|
+
zedServer.url = server.url;
|
|
15646
|
+
}
|
|
15647
|
+
return zedServer;
|
|
15648
|
+
}
|
|
15649
|
+
function mergeZedMCPServers(servers) {
|
|
15650
|
+
const result = {
|
|
15651
|
+
added: [],
|
|
15652
|
+
skipped: [],
|
|
15653
|
+
warnings: []
|
|
15654
|
+
};
|
|
15655
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15656
|
+
return result;
|
|
15657
|
+
}
|
|
15658
|
+
const configPath = getZedMCPConfigPath();
|
|
15659
|
+
const config = readZedConfig(configPath);
|
|
15660
|
+
if (!config.context_servers) {
|
|
15661
|
+
config.context_servers = {};
|
|
15662
|
+
}
|
|
15663
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
15664
|
+
if (config.context_servers[name]) {
|
|
15665
|
+
result.skipped.push(name);
|
|
15666
|
+
result.warnings.push(`MCP server '${name}' already exists in Zed config, keeping existing configuration`);
|
|
15667
|
+
} else {
|
|
15668
|
+
config.context_servers[name] = toZedServerConfig(server);
|
|
15669
|
+
result.added.push(name);
|
|
15670
|
+
}
|
|
15671
|
+
}
|
|
15672
|
+
if (result.added.length > 0) {
|
|
15673
|
+
writeZedConfig(configPath, config);
|
|
15674
|
+
}
|
|
15675
|
+
return result;
|
|
15676
|
+
}
|
|
15677
|
+
function removeZedMCPServers(servers) {
|
|
15678
|
+
const result = {
|
|
15679
|
+
removed: [],
|
|
15680
|
+
kept: [],
|
|
15681
|
+
warnings: []
|
|
15682
|
+
};
|
|
15683
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
15684
|
+
return result;
|
|
15685
|
+
}
|
|
15686
|
+
const configPath = getZedMCPConfigPath();
|
|
15687
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
15688
|
+
return result;
|
|
15689
|
+
}
|
|
15690
|
+
const config = readZedConfig(configPath);
|
|
15691
|
+
if (!config.context_servers) {
|
|
15692
|
+
return result;
|
|
15693
|
+
}
|
|
15694
|
+
for (const [name, originalServer] of Object.entries(servers)) {
|
|
15695
|
+
const currentServer = config.context_servers[name];
|
|
15696
|
+
if (!currentServer) {
|
|
15697
|
+
continue;
|
|
15698
|
+
}
|
|
15699
|
+
const originalZedServer = toZedServerConfig(originalServer);
|
|
15700
|
+
if (serversEqual(currentServer, originalZedServer)) {
|
|
15701
|
+
delete config.context_servers[name];
|
|
15702
|
+
result.removed.push(name);
|
|
15703
|
+
} else {
|
|
15704
|
+
result.kept.push(name);
|
|
15705
|
+
result.warnings.push(`Keeping modified MCP server '${name}' in Zed config`);
|
|
15706
|
+
}
|
|
15707
|
+
}
|
|
15708
|
+
if (Object.keys(config.context_servers).length === 0) {
|
|
15709
|
+
delete config.context_servers;
|
|
15710
|
+
}
|
|
15711
|
+
if (result.removed.length > 0) {
|
|
15712
|
+
writeZedConfig(configPath, config);
|
|
15713
|
+
}
|
|
15714
|
+
return result;
|
|
15715
|
+
}
|
|
15030
15716
|
function serversEqual(a, b) {
|
|
15031
15717
|
return JSON.stringify(sortObject(a)) === JSON.stringify(sortObject(b));
|
|
15032
15718
|
}
|
|
@@ -15042,7 +15728,13 @@ function sortObject(obj) {
|
|
|
15042
15728
|
}
|
|
15043
15729
|
return sorted;
|
|
15044
15730
|
}
|
|
15045
|
-
|
|
15731
|
+
function mergeGeminiSettingsMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15732
|
+
return mergeMCPServersToPath(servers, getGeminiMCPConfigPath(global2, projectDir));
|
|
15733
|
+
}
|
|
15734
|
+
function removeGeminiSettingsMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
15735
|
+
return removeMCPServersFromPath(servers, getGeminiMCPConfigPath(global2, projectDir));
|
|
15736
|
+
}
|
|
15737
|
+
var import_fs10, import_path11, import_os3, TOML3, MCP_EDITORS;
|
|
15046
15738
|
var init_mcp = __esm({
|
|
15047
15739
|
"src/core/mcp.ts"() {
|
|
15048
15740
|
"use strict";
|
|
@@ -15050,6 +15742,8 @@ var init_mcp = __esm({
|
|
|
15050
15742
|
import_fs10 = require("fs");
|
|
15051
15743
|
import_path11 = require("path");
|
|
15052
15744
|
import_os3 = require("os");
|
|
15745
|
+
TOML3 = __toESM(require("smol-toml"));
|
|
15746
|
+
MCP_EDITORS = ["claude", "codex", "cursor", "windsurf", "vscode", "gemini", "opencode", "kiro", "trae", "amp", "zed"];
|
|
15053
15747
|
}
|
|
15054
15748
|
});
|
|
15055
15749
|
|
|
@@ -17119,13 +17813,25 @@ This could indicate:
|
|
|
17119
17813
|
console.log(` \u2713 Installed ${commandFiles.length} commands to .claude/commands/`);
|
|
17120
17814
|
}
|
|
17121
17815
|
if (pluginConfig.mcpServers && Object.keys(pluginConfig.mcpServers).length > 0) {
|
|
17122
|
-
const
|
|
17816
|
+
const editor = options.editor || "claude";
|
|
17817
|
+
const globalOnlyEditors = ["windsurf", "zed"];
|
|
17818
|
+
const localOnlyEditors = ["trae"];
|
|
17819
|
+
const isGlobal = globalOnlyEditors.includes(editor) ? true : options.global || false;
|
|
17820
|
+
if (globalOnlyEditors.includes(editor)) {
|
|
17821
|
+
console.log(` Note: ${editor.charAt(0).toUpperCase() + editor.slice(1)} only supports global MCP configuration`);
|
|
17822
|
+
}
|
|
17823
|
+
if (localOnlyEditors.includes(editor) && options.global) {
|
|
17824
|
+
console.log(` Note: ${editor.charAt(0).toUpperCase() + editor.slice(1)} only supports project-local MCP configuration, ignoring --global`);
|
|
17825
|
+
}
|
|
17826
|
+
const mcpResult = mergeEditorMCPServers(
|
|
17123
17827
|
pluginConfig.mcpServers,
|
|
17124
|
-
|
|
17828
|
+
editor,
|
|
17829
|
+
isGlobal,
|
|
17125
17830
|
process.cwd()
|
|
17126
17831
|
);
|
|
17127
17832
|
if (mcpResult.added.length > 0) {
|
|
17128
|
-
|
|
17833
|
+
const location = getMCPConfigLocation(editor, isGlobal);
|
|
17834
|
+
console.log(` \u2713 Added MCP servers to ${location}: ${mcpResult.added.join(", ")}`);
|
|
17129
17835
|
}
|
|
17130
17836
|
if (mcpResult.skipped.length > 0) {
|
|
17131
17837
|
console.log(` \u26A0\uFE0F Skipped existing MCP servers: ${mcpResult.skipped.join(", ")}`);
|
|
@@ -17133,7 +17839,8 @@ This could indicate:
|
|
|
17133
17839
|
pluginMetadata = {
|
|
17134
17840
|
files: installedFiles,
|
|
17135
17841
|
mcpServers: pluginConfig.mcpServers,
|
|
17136
|
-
mcpGlobal:
|
|
17842
|
+
mcpGlobal: isGlobal,
|
|
17843
|
+
mcpEditor: editor
|
|
17137
17844
|
};
|
|
17138
17845
|
} else {
|
|
17139
17846
|
pluginMetadata = {
|
|
@@ -17156,9 +17863,23 @@ This could indicate:
|
|
|
17156
17863
|
} catch (error2) {
|
|
17157
17864
|
throw new Error(`Failed to parse MCP server config: ${error2 instanceof Error ? error2.message : error2}`);
|
|
17158
17865
|
}
|
|
17159
|
-
const
|
|
17866
|
+
const editor = options.editor || "claude";
|
|
17867
|
+
const globalOnlyEditors = ["windsurf", "zed"];
|
|
17868
|
+
const localOnlyEditors = ["trae"];
|
|
17869
|
+
const isGlobal = globalOnlyEditors.includes(editor) ? true : options.global || false;
|
|
17870
|
+
if (globalOnlyEditors.includes(editor)) {
|
|
17871
|
+
console.log(` Note: ${editor.charAt(0).toUpperCase() + editor.slice(1)} only supports global MCP configuration`);
|
|
17872
|
+
}
|
|
17873
|
+
if (localOnlyEditors.includes(editor) && options.global) {
|
|
17874
|
+
console.log(` Note: ${editor.charAt(0).toUpperCase() + editor.slice(1)} only supports project-local MCP configuration, ignoring --global`);
|
|
17875
|
+
}
|
|
17876
|
+
const mcpResult = mergeEditorMCPServers(
|
|
17877
|
+
mcpServerConfig.mcpServers,
|
|
17878
|
+
editor,
|
|
17879
|
+
isGlobal
|
|
17880
|
+
);
|
|
17160
17881
|
if (mcpResult.added.length > 0) {
|
|
17161
|
-
const location =
|
|
17882
|
+
const location = getMCPConfigLocation(editor, isGlobal);
|
|
17162
17883
|
console.log(` \u2713 Added MCP servers to ${location}: ${mcpResult.added.join(", ")}`);
|
|
17163
17884
|
}
|
|
17164
17885
|
if (mcpResult.skipped.length > 0) {
|
|
@@ -17171,9 +17892,10 @@ This could indicate:
|
|
|
17171
17892
|
files: [],
|
|
17172
17893
|
// No files to track for MCP server packages
|
|
17173
17894
|
mcpServers: mcpServerConfig.mcpServers,
|
|
17174
|
-
mcpGlobal:
|
|
17895
|
+
mcpGlobal: isGlobal,
|
|
17896
|
+
mcpEditor: editor
|
|
17175
17897
|
};
|
|
17176
|
-
destPath =
|
|
17898
|
+
destPath = getMCPConfigLocation(editor, isGlobal);
|
|
17177
17899
|
fileCount = Object.keys(mcpServerConfig.mcpServers).length;
|
|
17178
17900
|
} else if (effectiveSubtype === "snippet") {
|
|
17179
17901
|
console.log(` \u{1F4CE} Installing Snippet...`);
|
|
@@ -17815,7 +18537,7 @@ async function installFromLockfile(options) {
|
|
|
17815
18537
|
}
|
|
17816
18538
|
function createInstallCommand() {
|
|
17817
18539
|
const command = new import_commander12.Command("install");
|
|
17818
|
-
command.description("Install a package from the registry, or install all packages from prpm.lock if no package specified").argument("[package]", "Package to install (e.g., react-rules or react-rules@1.2.0). If omitted, installs all packages from prpm.lock").option("--version <version>", "Specific version to install").option("--as <format>", `Convert and install in specific format (${import_types.FORMATS.join(", ")})`).option("--format <format>", "Alias for --as").option("--location <path>", "Custom location for installed files (Agents.md or nested Cursor rules)").option("--subtype <subtype>", "Specify subtype when converting (skill, agent, rule, etc.)").option("--hook-mapping <strategy>", "Hook mapping strategy: auto (default), strict, skip", "auto").option("--frozen-lockfile", "Fail if lock file needs to be updated (for CI)").option("-y, --yes", "Auto-confirm prompts (overwrite files without asking)").option("--no-append", "Skip adding skill to manifest file (skill files only)").option("--manifest-file <filename>", "Custom manifest filename for progressive disclosure").option("--eager", "Force skill/agent to always activate (not on-demand)").option("--lazy", "Use default on-demand activation (overrides package eager setting)").action(async (packageSpec, options) => {
|
|
18540
|
+
command.description("Install a package from the registry, or install all packages from prpm.lock if no package specified").argument("[package]", "Package to install (e.g., react-rules or react-rules@1.2.0). If omitted, installs all packages from prpm.lock").option("--version <version>", "Specific version to install").option("--as <format>", `Convert and install in specific format (${import_types.FORMATS.join(", ")})`).option("--format <format>", "Alias for --as").option("--location <path>", "Custom location for installed files (Agents.md or nested Cursor rules)").option("--subtype <subtype>", "Specify subtype when converting (skill, agent, rule, etc.)").option("--hook-mapping <strategy>", "Hook mapping strategy: auto (default), strict, skip", "auto").option("--frozen-lockfile", "Fail if lock file needs to be updated (for CI)").option("-y, --yes", "Auto-confirm prompts (overwrite files without asking)").option("--no-append", "Skip adding skill to manifest file (skill files only)").option("--manifest-file <filename>", "Custom manifest filename for progressive disclosure").option("--eager", "Force skill/agent to always activate (not on-demand)").option("--lazy", "Use default on-demand activation (overrides package eager setting)").option("--global", "Install MCP servers to global config (e.g., ~/.claude/settings.json, ~/.codex/config.toml, ~/.cursor/mcp.json, ~/.kiro/settings/mcp.json)").option("--editor <editor>", "Target editor for MCP server installation (claude, codex, cursor, windsurf, vscode, gemini, opencode, kiro, trae, amp, zed)", "claude").action(async (packageSpec, options) => {
|
|
17819
18541
|
const convertTo = options.format || options.as;
|
|
17820
18542
|
const validFormats = import_types.FORMATS;
|
|
17821
18543
|
if (convertTo && !validFormats.includes(convertTo)) {
|
|
@@ -17830,6 +18552,26 @@ function createInstallCommand() {
|
|
|
17830
18552
|
prpm install my-package --format gemini.md # Convert to Gemini format
|
|
17831
18553
|
prpm install my-package # Install in native format`, 1);
|
|
17832
18554
|
}
|
|
18555
|
+
if (options.editor && !MCP_EDITORS.includes(options.editor)) {
|
|
18556
|
+
throw new CLIError(
|
|
18557
|
+
`Invalid MCP editor: ${options.editor}
|
|
18558
|
+
|
|
18559
|
+
Supported editors: ${MCP_EDITORS.join(", ")}
|
|
18560
|
+
|
|
18561
|
+
\u{1F4A1} Examples:
|
|
18562
|
+
prpm install my-mcp-server --editor claude # Install to .mcp.json
|
|
18563
|
+
prpm install my-mcp-server --editor codex # Install to codex.toml
|
|
18564
|
+
prpm install my-mcp-server --editor cursor # Install to .cursor/mcp.json
|
|
18565
|
+
prpm install my-mcp-server --editor windsurf # Install to ~/.codeium/windsurf/mcp_config.json
|
|
18566
|
+
prpm install my-mcp-server --editor vscode # Install to .vscode/mcp.json
|
|
18567
|
+
prpm install my-mcp-server --editor gemini # Install to .gemini/settings.json
|
|
18568
|
+
prpm install my-mcp-server --editor opencode # Install to opencode.json
|
|
18569
|
+
prpm install my-mcp-server --editor kiro # Install to .kiro/settings/mcp.json
|
|
18570
|
+
prpm install my-mcp-server --editor trae # Install to .trae/mcp.json
|
|
18571
|
+
prpm install my-mcp-server --editor amp # Install to .amp/settings.json
|
|
18572
|
+
prpm install my-mcp-server --editor zed # Install to ~/.config/zed/settings.json`
|
|
18573
|
+
);
|
|
18574
|
+
}
|
|
17833
18575
|
if (options.hookMapping && !isValidHookMappingStrategy(options.hookMapping)) {
|
|
17834
18576
|
throw new CLIError(
|
|
17835
18577
|
`Invalid hook mapping strategy: ${options.hookMapping}
|
|
@@ -17858,7 +18600,9 @@ Valid strategies: ${VALID_HOOK_MAPPING_STRATEGIES.join(", ")}`
|
|
|
17858
18600
|
noAppend: options.noAppend,
|
|
17859
18601
|
manifestFile: options.manifestFile,
|
|
17860
18602
|
hookMapping: options.hookMapping,
|
|
17861
|
-
eager
|
|
18603
|
+
eager,
|
|
18604
|
+
global: options.global,
|
|
18605
|
+
editor: options.editor
|
|
17862
18606
|
});
|
|
17863
18607
|
});
|
|
17864
18608
|
return command;
|
|
@@ -19729,7 +20473,7 @@ async function uninstallSinglePackage(lockfileKey, packageId, lockfile) {
|
|
|
19729
20473
|
}
|
|
19730
20474
|
}
|
|
19731
20475
|
if (pkg.pluginMetadata) {
|
|
19732
|
-
const { files, mcpServers, mcpGlobal } = pkg.pluginMetadata;
|
|
20476
|
+
const { files, mcpServers, mcpGlobal, mcpEditor } = pkg.pluginMetadata;
|
|
19733
20477
|
for (const filePath of files) {
|
|
19734
20478
|
try {
|
|
19735
20479
|
await import_fs12.promises.unlink(filePath);
|
|
@@ -19740,7 +20484,7 @@ async function uninstallSinglePackage(lockfileKey, packageId, lockfile) {
|
|
|
19740
20484
|
}
|
|
19741
20485
|
}
|
|
19742
20486
|
if (mcpServers && Object.keys(mcpServers).length > 0) {
|
|
19743
|
-
|
|
20487
|
+
removeEditorMCPServers(mcpServers, mcpEditor || "claude", mcpGlobal || false);
|
|
19744
20488
|
}
|
|
19745
20489
|
return;
|
|
19746
20490
|
}
|
|
@@ -19868,8 +20612,9 @@ async function handleUninstall(name, options = {}) {
|
|
|
19868
20612
|
}
|
|
19869
20613
|
if (pkg.pluginMetadata) {
|
|
19870
20614
|
const isMCPServerOnly = pkg.pluginMetadata.files.length === 0 && pkg.pluginMetadata.mcpServers;
|
|
19871
|
-
console.log(isMCPServerOnly ? ` \u{1F527} Uninstalling MCP server...` : ` \u{1F50C} Uninstalling
|
|
19872
|
-
const { files, mcpServers, mcpGlobal } = pkg.pluginMetadata;
|
|
20615
|
+
console.log(isMCPServerOnly ? ` \u{1F527} Uninstalling MCP server...` : ` \u{1F50C} Uninstalling plugin...`);
|
|
20616
|
+
const { files, mcpServers, mcpGlobal, mcpEditor } = pkg.pluginMetadata;
|
|
20617
|
+
const editor = mcpEditor || "claude";
|
|
19873
20618
|
let filesRemoved = 0;
|
|
19874
20619
|
for (const filePath of files) {
|
|
19875
20620
|
try {
|
|
@@ -19887,9 +20632,9 @@ async function handleUninstall(name, options = {}) {
|
|
|
19887
20632
|
console.log(` \u{1F4E6} Removed ${filesRemoved} file(s)`);
|
|
19888
20633
|
}
|
|
19889
20634
|
if (mcpServers && Object.keys(mcpServers).length > 0) {
|
|
19890
|
-
const mcpResult =
|
|
20635
|
+
const mcpResult = removeEditorMCPServers(mcpServers, editor, mcpGlobal || false);
|
|
19891
20636
|
if (mcpResult.removed.length > 0) {
|
|
19892
|
-
const location = mcpGlobal
|
|
20637
|
+
const location = getMCPConfigLocation(editor, mcpGlobal || false);
|
|
19893
20638
|
console.log(` \u{1F527} Removed ${mcpResult.removed.length} MCP server(s) from ${location}`);
|
|
19894
20639
|
}
|
|
19895
20640
|
for (const warning of mcpResult.warnings) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prpm",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.25",
|
|
4
4
|
"description": "Prompt Package Manager CLI - Install and manage prompt-based files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@octokit/rest": "^22.0.0",
|
|
48
|
-
"@pr-pm/converters": "^2.1.
|
|
49
|
-
"@pr-pm/registry-client": "^2.3.
|
|
50
|
-
"@pr-pm/types": "^2.1.
|
|
48
|
+
"@pr-pm/converters": "^2.1.26",
|
|
49
|
+
"@pr-pm/registry-client": "^2.3.25",
|
|
50
|
+
"@pr-pm/types": "^2.1.26",
|
|
51
51
|
"ajv": "^8.17.1",
|
|
52
52
|
"ajv-formats": "^3.0.1",
|
|
53
53
|
"chalk": "^5.6.2",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"jsonwebtoken": "^9.0.2",
|
|
56
56
|
"posthog-node": "^5.10.0",
|
|
57
57
|
"semver": "^7.7.3",
|
|
58
|
+
"smol-toml": "^1.6.0",
|
|
58
59
|
"tar": "^6.2.1"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|