mcpick 0.0.18 → 0.0.20
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/.github/workflows/ci.yml +26 -0
- package/.vscode/settings.json +5 -0
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/dist/add-BDyaBew0.js +113 -0
- package/dist/add-json-BjgzdeG-.js +58 -0
- package/dist/atomic-write-BqEykHp9.js +26 -0
- package/dist/backup-DSDhHI5f.js +64 -0
- package/dist/cache-D6kd7qE8.js +226 -0
- package/dist/claude-cli-DnmBJrjg.js +445 -0
- package/dist/cli-CsFfnWBo.js +84 -0
- package/dist/clone-DYKPEsar.js +88 -0
- package/dist/config-DijVdEFn.js +176 -0
- package/dist/dev-DRJRNp7y.js +265 -0
- package/dist/disable-xJXZfUR_.js +39 -0
- package/dist/enable-RrpcN6la.js +40 -0
- package/dist/get-Bb1eOOIZ.js +41 -0
- package/dist/hook-state-Di8lUsPr.js +171 -0
- package/dist/hooks-Bmn7pUZa.js +280 -0
- package/dist/index.js +1232 -305
- package/dist/list-B8YeDWt6.js +64 -0
- package/dist/marketplace-DcKk5dc1.js +168 -0
- package/dist/output-BchYq0mR.js +15 -0
- package/dist/paths-BPISiJi4.js +124 -0
- package/dist/plugin-cache-Bby9Dxm9.js +405 -0
- package/dist/plugins-Dc7DN6R_.js +212 -0
- package/dist/profile-CX97sMGp.js +120 -0
- package/dist/profile-DkY_lBEm.js +70 -0
- package/dist/redact-O35tjnRD.js +26 -0
- package/dist/registry-CfUKT7_C.js +92 -0
- package/dist/reload-CYDhkCVZ.js +31 -0
- package/dist/remove-D1owHLhG.js +31 -0
- package/dist/reset-project-choices-BfRSNN3m.js +28 -0
- package/dist/restore-DdMfUljI.js +84 -0
- package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
- package/dist/settings-DEcWtzLE.js +201 -0
- package/dist/validation-xMlbgGCF.js +44 -0
- package/package.json +23 -22
- package/dist/cli/commands/add-json.js +0 -60
- package/dist/cli/commands/add.js +0 -135
- package/dist/cli/commands/backup.js +0 -83
- package/dist/cli/commands/cache.js +0 -296
- package/dist/cli/commands/clone.js +0 -108
- package/dist/cli/commands/dev.js +0 -167
- package/dist/cli/commands/disable.js +0 -36
- package/dist/cli/commands/enable.js +0 -39
- package/dist/cli/commands/get.js +0 -45
- package/dist/cli/commands/hooks.js +0 -314
- package/dist/cli/commands/list.js +0 -64
- package/dist/cli/commands/marketplace.js +0 -211
- package/dist/cli/commands/plugins.js +0 -265
- package/dist/cli/commands/profile.js +0 -134
- package/dist/cli/commands/reload.js +0 -36
- package/dist/cli/commands/remove.js +0 -35
- package/dist/cli/commands/reset-project-choices.js +0 -32
- package/dist/cli/commands/restore.js +0 -105
- package/dist/cli/index.js +0 -29
- package/dist/cli/output.js +0 -21
- package/dist/commands/add-server.js +0 -310
- package/dist/commands/backup.js +0 -60
- package/dist/commands/edit-config.js +0 -109
- package/dist/commands/edit-plugins.js +0 -201
- package/dist/commands/manage-cache.js +0 -155
- package/dist/commands/manage-hooks.js +0 -99
- package/dist/commands/manage-marketplace.js +0 -293
- package/dist/commands/restore.js +0 -118
- package/dist/core/config.js +0 -200
- package/dist/core/dev-override.js +0 -155
- package/dist/core/hook-state.js +0 -220
- package/dist/core/plugin-cache.js +0 -506
- package/dist/core/profile.js +0 -94
- package/dist/core/registry.js +0 -121
- package/dist/core/settings.js +0 -243
- package/dist/core/validation.js +0 -49
- package/dist/types.js +0 -2
- package/dist/utils/atomic-write.js +0 -27
- package/dist/utils/claude-cli.js +0 -485
- package/dist/utils/paths.js +0 -114
- package/dist/utils/redact.js +0 -28
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { c as write_claude_config } from "./config-DijVdEFn.js";
|
|
2
|
+
import { s as write_claude_settings } from "./settings-DEcWtzLE.js";
|
|
3
|
+
import { n as load_profile, r as save_profile, t as list_profiles } from "./profile-DkY_lBEm.js";
|
|
4
|
+
import { n as output, t as error } from "./output-BchYq0mR.js";
|
|
5
|
+
import { defineCommand } from "citty";
|
|
6
|
+
var profile_default = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "profile",
|
|
9
|
+
description: "Manage profiles (MCP servers + plugins)"
|
|
10
|
+
},
|
|
11
|
+
subCommands: {
|
|
12
|
+
list: defineCommand({
|
|
13
|
+
meta: {
|
|
14
|
+
name: "list",
|
|
15
|
+
description: "List all saved profiles"
|
|
16
|
+
},
|
|
17
|
+
args: { json: {
|
|
18
|
+
type: "boolean",
|
|
19
|
+
description: "Output as JSON",
|
|
20
|
+
default: false
|
|
21
|
+
} },
|
|
22
|
+
async run({ args }) {
|
|
23
|
+
const profiles = await list_profiles();
|
|
24
|
+
if (args.json) output(profiles, true);
|
|
25
|
+
else {
|
|
26
|
+
if (profiles.length === 0) {
|
|
27
|
+
console.log("No profiles found.");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
for (const p of profiles) {
|
|
31
|
+
const parts = [`${p.serverCount} servers`];
|
|
32
|
+
if (p.pluginCount > 0) parts.push(`${p.pluginCount} plugins`);
|
|
33
|
+
console.log(`${p.name} (${parts.join(", ")})`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
load: defineCommand({
|
|
39
|
+
meta: {
|
|
40
|
+
name: "load",
|
|
41
|
+
description: "Load and apply a saved profile"
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
name: {
|
|
45
|
+
type: "positional",
|
|
46
|
+
description: "Profile name",
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
json: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Output as JSON",
|
|
52
|
+
default: false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
async run({ args }) {
|
|
56
|
+
try {
|
|
57
|
+
const profile = await load_profile(args.name);
|
|
58
|
+
await write_claude_config(profile.config);
|
|
59
|
+
const server_count = Object.keys(profile.config.mcpServers || {}).length;
|
|
60
|
+
let plugin_count = 0;
|
|
61
|
+
if (profile.enabledPlugins) {
|
|
62
|
+
await write_claude_settings({ enabledPlugins: profile.enabledPlugins });
|
|
63
|
+
plugin_count = Object.keys(profile.enabledPlugins).length;
|
|
64
|
+
}
|
|
65
|
+
if (args.json) output({
|
|
66
|
+
profile: args.name,
|
|
67
|
+
servers: server_count,
|
|
68
|
+
plugins: plugin_count
|
|
69
|
+
}, true);
|
|
70
|
+
else {
|
|
71
|
+
const parts = [`${server_count} servers`];
|
|
72
|
+
if (plugin_count > 0) parts.push(`${plugin_count} plugins`);
|
|
73
|
+
console.log(`Profile '${args.name}' applied (${parts.join(", ")})`);
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
error(err instanceof Error ? err.message : "Failed to load profile");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
save: defineCommand({
|
|
81
|
+
meta: {
|
|
82
|
+
name: "save",
|
|
83
|
+
description: "Save current config as a profile"
|
|
84
|
+
},
|
|
85
|
+
args: {
|
|
86
|
+
name: {
|
|
87
|
+
type: "positional",
|
|
88
|
+
description: "Profile name",
|
|
89
|
+
required: true
|
|
90
|
+
},
|
|
91
|
+
json: {
|
|
92
|
+
type: "boolean",
|
|
93
|
+
description: "Output as JSON",
|
|
94
|
+
default: false
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
async run({ args }) {
|
|
98
|
+
try {
|
|
99
|
+
const counts = await save_profile(args.name);
|
|
100
|
+
if (args.json) output({
|
|
101
|
+
profile: args.name,
|
|
102
|
+
servers: counts.serverCount,
|
|
103
|
+
plugins: counts.pluginCount
|
|
104
|
+
}, true);
|
|
105
|
+
else {
|
|
106
|
+
const parts = [`${counts.serverCount} servers`];
|
|
107
|
+
if (counts.pluginCount > 0) parts.push(`${counts.pluginCount} plugins`);
|
|
108
|
+
console.log(`Profile '${args.name}' saved (${parts.join(", ")})`);
|
|
109
|
+
}
|
|
110
|
+
} catch (err) {
|
|
111
|
+
error(err instanceof Error ? err.message : "Failed to save profile");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
//#endregion
|
|
118
|
+
export { profile_default as default };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=profile-CX97sMGp.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { _ as get_profiles_dir, g as get_profile_path, t as ensure_directory_exists } from "./paths-BPISiJi4.js";
|
|
2
|
+
import { t as validate_claude_config } from "./validation-xMlbgGCF.js";
|
|
3
|
+
import { s as read_claude_config } from "./config-DijVdEFn.js";
|
|
4
|
+
import { a as read_claude_settings } from "./settings-DEcWtzLE.js";
|
|
5
|
+
import { access, readFile, readdir, writeFile } from "node:fs/promises";
|
|
6
|
+
//#region src/core/profile.ts
|
|
7
|
+
async function load_profile(name) {
|
|
8
|
+
const profile_path = get_profile_path(name);
|
|
9
|
+
try {
|
|
10
|
+
await access(profile_path);
|
|
11
|
+
const content = await readFile(profile_path, "utf-8");
|
|
12
|
+
const parsed = JSON.parse(content);
|
|
13
|
+
let config;
|
|
14
|
+
if (parsed.mcpServers) config = validate_claude_config(parsed);
|
|
15
|
+
else if (!parsed.enabledPlugins) config = validate_claude_config({ mcpServers: parsed });
|
|
16
|
+
else config = validate_claude_config({ mcpServers: parsed.mcpServers || {} });
|
|
17
|
+
return {
|
|
18
|
+
config,
|
|
19
|
+
enabledPlugins: parsed.enabledPlugins
|
|
20
|
+
};
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") throw new Error(`Profile '${name}' not found at ${profile_path}`);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function list_profiles() {
|
|
27
|
+
const profiles_dir = get_profiles_dir();
|
|
28
|
+
try {
|
|
29
|
+
await access(profiles_dir);
|
|
30
|
+
const json_files = (await readdir(profiles_dir)).filter((f) => f.endsWith(".json"));
|
|
31
|
+
const profiles = [];
|
|
32
|
+
for (const file of json_files) try {
|
|
33
|
+
const path = get_profile_path(file);
|
|
34
|
+
const content = await readFile(path, "utf-8");
|
|
35
|
+
const parsed = JSON.parse(content);
|
|
36
|
+
const servers = parsed.mcpServers || parsed;
|
|
37
|
+
const plugins = parsed.enabledPlugins || {};
|
|
38
|
+
profiles.push({
|
|
39
|
+
name: file.replace(".json", ""),
|
|
40
|
+
path,
|
|
41
|
+
serverCount: Object.keys(servers).length,
|
|
42
|
+
pluginCount: Object.keys(plugins).length
|
|
43
|
+
});
|
|
44
|
+
} catch {}
|
|
45
|
+
return profiles;
|
|
46
|
+
} catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async function save_profile(name) {
|
|
51
|
+
const config = await read_claude_config();
|
|
52
|
+
const settings = await read_claude_settings();
|
|
53
|
+
const servers = config.mcpServers || {};
|
|
54
|
+
const plugins = settings.enabledPlugins || {};
|
|
55
|
+
const server_count = Object.keys(servers).length;
|
|
56
|
+
const plugin_count = Object.keys(plugins).length;
|
|
57
|
+
if (server_count === 0 && plugin_count === 0) throw new Error("No MCP servers or plugins configured to save");
|
|
58
|
+
await ensure_directory_exists(get_profiles_dir());
|
|
59
|
+
const profile_data = { mcpServers: servers };
|
|
60
|
+
if (plugin_count > 0) profile_data.enabledPlugins = plugins;
|
|
61
|
+
await writeFile(get_profile_path(name), JSON.stringify(profile_data, null, 2), "utf-8");
|
|
62
|
+
return {
|
|
63
|
+
serverCount: server_count,
|
|
64
|
+
pluginCount: plugin_count
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { load_profile as n, save_profile as r, list_profiles as t };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=profile-DkY_lBEm.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/utils/redact.ts
|
|
2
|
+
/**
|
|
3
|
+
* Redact sensitive values (env, headers) from a server config.
|
|
4
|
+
* Shows key names but replaces values with "***".
|
|
5
|
+
*/
|
|
6
|
+
function redact_server_base(server) {
|
|
7
|
+
const redacted = { ...server };
|
|
8
|
+
if ("env" in redacted && redacted.env) redacted.env = redact_record(redacted.env);
|
|
9
|
+
if ("headers" in redacted && redacted.headers) redacted.headers = redact_record(redacted.headers);
|
|
10
|
+
return redacted;
|
|
11
|
+
}
|
|
12
|
+
function redact_server(server) {
|
|
13
|
+
return {
|
|
14
|
+
...redact_server_base(server),
|
|
15
|
+
name: server.name
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function redact_record(record) {
|
|
19
|
+
const redacted = {};
|
|
20
|
+
for (const key of Object.keys(record)) redacted[key] = "***";
|
|
21
|
+
return redacted;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { redact_server_base as n, redact_server as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=redact-O35tjnRD.js.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { p as get_mcpick_dir, r as get_backups_dir, t as ensure_directory_exists, y as get_server_registry_path } from "./paths-BPISiJi4.js";
|
|
2
|
+
import { r as validate_server_registry } from "./validation-xMlbgGCF.js";
|
|
3
|
+
import { access, readFile, readdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
//#region src/core/registry.ts
|
|
6
|
+
async function read_server_registry() {
|
|
7
|
+
const registry_path = get_server_registry_path();
|
|
8
|
+
try {
|
|
9
|
+
await access(registry_path);
|
|
10
|
+
const registry_content = await readFile(registry_path, "utf-8");
|
|
11
|
+
return validate_server_registry(JSON.parse(registry_content));
|
|
12
|
+
} catch (error) {
|
|
13
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
14
|
+
await ensure_directory_exists(get_mcpick_dir());
|
|
15
|
+
const default_registry = { servers: [] };
|
|
16
|
+
await write_server_registry(default_registry);
|
|
17
|
+
return default_registry;
|
|
18
|
+
}
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function write_server_registry(registry) {
|
|
23
|
+
const registry_path = get_server_registry_path();
|
|
24
|
+
await ensure_directory_exists(get_mcpick_dir());
|
|
25
|
+
await writeFile(registry_path, JSON.stringify(registry, null, 2), "utf-8");
|
|
26
|
+
}
|
|
27
|
+
async function add_server_to_registry(server) {
|
|
28
|
+
const registry = await read_server_registry();
|
|
29
|
+
const existing_index = registry.servers.findIndex((s) => s.name === server.name);
|
|
30
|
+
if (existing_index >= 0) registry.servers[existing_index] = server;
|
|
31
|
+
else registry.servers.push(server);
|
|
32
|
+
await write_server_registry(registry);
|
|
33
|
+
}
|
|
34
|
+
async function get_all_available_servers() {
|
|
35
|
+
const { get_enabled_servers, read_claude_config } = await import("./config-DijVdEFn.js").then((n) => n.t);
|
|
36
|
+
const registry = await read_server_registry();
|
|
37
|
+
const config_servers = get_enabled_servers(await read_claude_config());
|
|
38
|
+
const config_by_name = new Map(config_servers.map((s) => [s.name, s]));
|
|
39
|
+
const known_names = /* @__PURE__ */ new Set();
|
|
40
|
+
let registry_updated = false;
|
|
41
|
+
for (let i = 0; i < registry.servers.length; i++) {
|
|
42
|
+
const name = registry.servers[i].name;
|
|
43
|
+
known_names.add(name);
|
|
44
|
+
const config_server = config_by_name.get(name);
|
|
45
|
+
if (config_server) {
|
|
46
|
+
registry.servers[i] = config_server;
|
|
47
|
+
registry_updated = true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const server of config_servers) if (!known_names.has(server.name)) {
|
|
51
|
+
registry.servers.push(server);
|
|
52
|
+
registry_updated = true;
|
|
53
|
+
}
|
|
54
|
+
if (registry_updated) await write_server_registry(registry);
|
|
55
|
+
return registry.servers;
|
|
56
|
+
}
|
|
57
|
+
async function sync_servers_to_registry(servers) {
|
|
58
|
+
const registry = await read_server_registry();
|
|
59
|
+
servers.forEach((server) => {
|
|
60
|
+
const existing_index = registry.servers.findIndex((s) => s.name === server.name);
|
|
61
|
+
if (existing_index >= 0) registry.servers[existing_index] = server;
|
|
62
|
+
else registry.servers.push(server);
|
|
63
|
+
});
|
|
64
|
+
await write_server_registry(registry);
|
|
65
|
+
}
|
|
66
|
+
function parse_backups(prefix, pattern) {
|
|
67
|
+
return async () => {
|
|
68
|
+
const backups_dir = get_backups_dir();
|
|
69
|
+
try {
|
|
70
|
+
await access(backups_dir);
|
|
71
|
+
return (await readdir(backups_dir)).filter((file) => file.startsWith(prefix) && file.endsWith(".json")).map((file) => {
|
|
72
|
+
const timestamp_match = file.match(pattern);
|
|
73
|
+
if (!timestamp_match) return null;
|
|
74
|
+
const [, year, month, day, hour, minute, second] = timestamp_match;
|
|
75
|
+
return {
|
|
76
|
+
filename: file,
|
|
77
|
+
timestamp: new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(minute), parseInt(second)),
|
|
78
|
+
path: join(backups_dir, file)
|
|
79
|
+
};
|
|
80
|
+
}).filter((backup) => backup !== null).sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return [];
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const list_backups = parse_backups("mcp-servers-", /mcp-servers-(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})(\d{2})\.json/);
|
|
88
|
+
const list_plugin_backups = parse_backups("plugins-", /plugins-(\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})(\d{2})\.json/);
|
|
89
|
+
//#endregion
|
|
90
|
+
export { read_server_registry as a, list_plugin_backups as i, get_all_available_servers as n, sync_servers_to_registry as o, list_backups as r, write_server_registry as s, add_server_to_registry as t };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=registry-CfUKT7_C.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { n as output } from "./output-BchYq0mR.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
//#region src/cli/commands/reload.ts
|
|
4
|
+
var reload_default = defineCommand({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "reload",
|
|
7
|
+
description: "Reload plugins in Claude Code"
|
|
8
|
+
},
|
|
9
|
+
args: { json: {
|
|
10
|
+
type: "boolean",
|
|
11
|
+
description: "Output as JSON",
|
|
12
|
+
default: false
|
|
13
|
+
} },
|
|
14
|
+
async run({ args }) {
|
|
15
|
+
const info = {
|
|
16
|
+
supported: false,
|
|
17
|
+
message: "Claude Code does not expose a programmatic reload API.",
|
|
18
|
+
instructions: ["Run /reload-plugins inside an active Claude Code session", "Or restart your Claude Code session to pick up changes"]
|
|
19
|
+
};
|
|
20
|
+
if (args.json) output(info, true);
|
|
21
|
+
else {
|
|
22
|
+
console.log(info.message);
|
|
23
|
+
console.log("\nTo reload plugins:");
|
|
24
|
+
for (const instruction of info.instructions) console.log(` - ${instruction}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { reload_default as default };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=reload-CYDhkCVZ.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { a as read_server_registry, n as get_all_available_servers, s as write_server_registry } from "./registry-CfUKT7_C.js";
|
|
2
|
+
import { p as remove_mcp_via_cli } from "./claude-cli-DnmBJrjg.js";
|
|
3
|
+
import { t as error } from "./output-BchYq0mR.js";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
//#region src/cli/commands/remove.ts
|
|
6
|
+
var remove_default = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "remove",
|
|
9
|
+
description: "Remove an MCP server from the registry and disable it"
|
|
10
|
+
},
|
|
11
|
+
args: { server: {
|
|
12
|
+
type: "positional",
|
|
13
|
+
description: "Server name to remove",
|
|
14
|
+
required: true
|
|
15
|
+
} },
|
|
16
|
+
async run({ args }) {
|
|
17
|
+
if (!(await get_all_available_servers()).find((s) => s.name === args.server)) error(`Server '${args.server}' not found. Run 'mcpick list' to see available servers.`);
|
|
18
|
+
const registry = await read_server_registry();
|
|
19
|
+
const index = registry.servers.findIndex((s) => s.name === args.server);
|
|
20
|
+
if (index >= 0) {
|
|
21
|
+
registry.servers.splice(index, 1);
|
|
22
|
+
await write_server_registry(registry);
|
|
23
|
+
}
|
|
24
|
+
await remove_mcp_via_cli(args.server);
|
|
25
|
+
console.log(`Removed '${args.server}'`);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { remove_default as default };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=remove-D1owHLhG.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { f as mcp_reset_project_choices_via_cli } from "./claude-cli-DnmBJrjg.js";
|
|
2
|
+
import { n as output, t as error } from "./output-BchYq0mR.js";
|
|
3
|
+
import { defineCommand } from "citty";
|
|
4
|
+
//#region src/cli/commands/reset-project-choices.ts
|
|
5
|
+
var reset_project_choices_default = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "reset-project-choices",
|
|
8
|
+
description: "Reset all approved and rejected project-scoped MCP servers"
|
|
9
|
+
},
|
|
10
|
+
args: { json: {
|
|
11
|
+
type: "boolean",
|
|
12
|
+
description: "Output as JSON",
|
|
13
|
+
default: false
|
|
14
|
+
} },
|
|
15
|
+
async run({ args }) {
|
|
16
|
+
const result = await mcp_reset_project_choices_via_cli();
|
|
17
|
+
if (args.json) output({
|
|
18
|
+
success: result.success,
|
|
19
|
+
error: result.error
|
|
20
|
+
}, true);
|
|
21
|
+
else if (result.success) console.log("Project MCP server choices have been reset.");
|
|
22
|
+
else error(result.error || "Unknown error");
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { reset_project_choices_default as default };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=reset-project-choices-BfRSNN3m.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { t as validate_claude_config } from "./validation-xMlbgGCF.js";
|
|
2
|
+
import { i as list_plugin_backups, r as list_backups } from "./registry-CfUKT7_C.js";
|
|
3
|
+
import { c as write_claude_config } from "./config-DijVdEFn.js";
|
|
4
|
+
import { s as write_claude_settings } from "./settings-DEcWtzLE.js";
|
|
5
|
+
import { n as output, t as error } from "./output-BchYq0mR.js";
|
|
6
|
+
import { readFile } from "node:fs/promises";
|
|
7
|
+
import { defineCommand } from "citty";
|
|
8
|
+
//#region src/cli/commands/restore.ts
|
|
9
|
+
var restore_default = defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: "restore",
|
|
12
|
+
description: "Restore config from a backup (latest if no file specified)"
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
file: {
|
|
16
|
+
type: "positional",
|
|
17
|
+
description: "Backup filename or path (optional, defaults to latest)",
|
|
18
|
+
required: false
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "What to restore: mcp (default), plugins, or all",
|
|
23
|
+
default: "mcp"
|
|
24
|
+
},
|
|
25
|
+
json: {
|
|
26
|
+
type: "boolean",
|
|
27
|
+
description: "Output as JSON",
|
|
28
|
+
default: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
async run({ args }) {
|
|
32
|
+
const restore_type = args.type;
|
|
33
|
+
const results = {};
|
|
34
|
+
if (restore_type === "mcp" || restore_type === "all") {
|
|
35
|
+
const backups = await list_backups();
|
|
36
|
+
if (backups.length === 0) {
|
|
37
|
+
if (restore_type === "mcp") error("No MCP backups found. Run \"mcpick backup\" first.");
|
|
38
|
+
} else {
|
|
39
|
+
let backup_path;
|
|
40
|
+
if (args.file && restore_type === "mcp") {
|
|
41
|
+
const found = backups.find((b) => b.filename === args.file || b.path === args.file);
|
|
42
|
+
if (!found) error(`Backup '${args.file}' not found. Available: ${backups.map((b) => b.filename).join(", ")}`);
|
|
43
|
+
backup_path = found.path;
|
|
44
|
+
} else backup_path = backups[0].path;
|
|
45
|
+
const content = await readFile(backup_path, "utf-8");
|
|
46
|
+
const config = validate_claude_config(JSON.parse(content));
|
|
47
|
+
await write_claude_config(config);
|
|
48
|
+
const server_count = Object.keys(config.mcpServers || {}).length;
|
|
49
|
+
results.mcp = {
|
|
50
|
+
restored: backup_path,
|
|
51
|
+
servers: server_count
|
|
52
|
+
};
|
|
53
|
+
if (!args.json) console.log(`Restored MCP: ${backup_path} (${server_count} servers)`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (restore_type === "plugins" || restore_type === "all") {
|
|
57
|
+
const backups = await list_plugin_backups();
|
|
58
|
+
if (backups.length === 0) {
|
|
59
|
+
if (restore_type === "plugins") error("No plugin backups found. Run \"mcpick backup\" first.");
|
|
60
|
+
} else {
|
|
61
|
+
let backup_path;
|
|
62
|
+
if (args.file && restore_type === "plugins") {
|
|
63
|
+
const found = backups.find((b) => b.filename === args.file || b.path === args.file);
|
|
64
|
+
if (!found) error(`Backup '${args.file}' not found. Available: ${backups.map((b) => b.filename).join(", ")}`);
|
|
65
|
+
backup_path = found.path;
|
|
66
|
+
} else backup_path = backups[0].path;
|
|
67
|
+
const content = await readFile(backup_path, "utf-8");
|
|
68
|
+
const parsed = JSON.parse(content);
|
|
69
|
+
await write_claude_settings({ enabledPlugins: parsed.enabledPlugins || {} });
|
|
70
|
+
const plugin_count = Object.keys(parsed.enabledPlugins || {}).length;
|
|
71
|
+
results.plugins = {
|
|
72
|
+
restored: backup_path,
|
|
73
|
+
plugins: plugin_count
|
|
74
|
+
};
|
|
75
|
+
if (!args.json) console.log(`Restored plugins: ${backup_path} (${plugin_count} plugins)`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (args.json) output(results, true);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//#endregion
|
|
82
|
+
export { restore_default as default };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=restore-DdMfUljI.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|