mcpick 0.0.18 → 0.0.19
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/.vscode/settings.json +5 -0
- package/CHANGELOG.md +7 -0
- package/dist/add-B9nVyh8T.js +113 -0
- package/dist/add-json-CXNDl3al.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-BeA-bmoW.js +394 -0
- package/dist/cli-DNNZjJYL.js +84 -0
- package/dist/clone-DLFLewBY.js +88 -0
- package/dist/config-DijVdEFn.js +176 -0
- package/dist/dev-DRJRNp7y.js +265 -0
- package/dist/disable-BA8tXPJN.js +39 -0
- package/dist/enable-Bdnnn_Cq.js +40 -0
- package/dist/get-BPjMXTMc.js +41 -0
- package/dist/hook-state-Di8lUsPr.js +171 -0
- package/dist/hooks-Bmn7pUZa.js +280 -0
- package/dist/index.js +1230 -305
- package/dist/list-B8YeDWt6.js +64 -0
- package/dist/marketplace-Br89Tg-Z.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-DHYJF5CP.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-DIPWYMpk.js +31 -0
- package/dist/reset-project-choices-DRM5KByw.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 +20 -19
- 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,176 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
+
import { i as get_claude_config_path, o as get_current_project_path, v as get_project_mcp_json_path } from "./paths-BPISiJi4.js";
|
|
3
|
+
import { t as validate_claude_config } from "./validation-xMlbgGCF.js";
|
|
4
|
+
import { t as atomic_json_write } from "./atomic-write-BqEykHp9.js";
|
|
5
|
+
import { access, readFile } from "node:fs/promises";
|
|
6
|
+
//#region src/core/config.ts
|
|
7
|
+
var config_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
create_config_from_servers: () => create_config_from_servers,
|
|
9
|
+
detect_server_scope: () => detect_server_scope,
|
|
10
|
+
find_server_in_scope: () => find_server_in_scope,
|
|
11
|
+
get_enabled_servers: () => get_enabled_servers,
|
|
12
|
+
get_enabled_servers_for_scope: () => get_enabled_servers_for_scope,
|
|
13
|
+
read_claude_config: () => read_claude_config,
|
|
14
|
+
write_claude_config: () => write_claude_config
|
|
15
|
+
});
|
|
16
|
+
async function read_claude_config() {
|
|
17
|
+
const config_path = get_claude_config_path();
|
|
18
|
+
try {
|
|
19
|
+
await access(config_path);
|
|
20
|
+
const config_content = await readFile(config_path, "utf-8");
|
|
21
|
+
return validate_claude_config(JSON.parse(config_content));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return { mcpServers: {} };
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function write_claude_config(config) {
|
|
28
|
+
await atomic_json_write(get_claude_config_path(), (existing) => {
|
|
29
|
+
existing.mcpServers = config.mcpServers;
|
|
30
|
+
return existing;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function get_enabled_servers(config) {
|
|
34
|
+
if (!config.mcpServers) return [];
|
|
35
|
+
return Object.entries(config.mcpServers).map(([name, server]) => ({
|
|
36
|
+
...server,
|
|
37
|
+
name
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
function create_config_from_servers(selected_servers) {
|
|
41
|
+
const mcp_servers = {};
|
|
42
|
+
selected_servers.forEach((server) => {
|
|
43
|
+
const { name, ...server_config } = server;
|
|
44
|
+
mcp_servers[name] = server_config;
|
|
45
|
+
});
|
|
46
|
+
return { mcpServers: mcp_servers };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Find a server's full config in a specific scope.
|
|
50
|
+
*/
|
|
51
|
+
async function find_server_in_scope(name, scope) {
|
|
52
|
+
if (scope === "user" || scope === "local") {
|
|
53
|
+
const config_path = get_claude_config_path();
|
|
54
|
+
try {
|
|
55
|
+
await access(config_path);
|
|
56
|
+
const content = await readFile(config_path, "utf-8");
|
|
57
|
+
const parsed = JSON.parse(content);
|
|
58
|
+
if (scope === "user") {
|
|
59
|
+
const server = parsed.mcpServers?.[name];
|
|
60
|
+
if (server) return {
|
|
61
|
+
server,
|
|
62
|
+
scope: "user"
|
|
63
|
+
};
|
|
64
|
+
} else {
|
|
65
|
+
const cwd = get_current_project_path();
|
|
66
|
+
const server = parsed.projects?.[cwd]?.mcpServers?.[name];
|
|
67
|
+
if (server) return {
|
|
68
|
+
server,
|
|
69
|
+
scope: "local"
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
} catch {}
|
|
73
|
+
} else if (scope === "project") {
|
|
74
|
+
const mcp_path = get_project_mcp_json_path();
|
|
75
|
+
try {
|
|
76
|
+
await access(mcp_path);
|
|
77
|
+
const content = await readFile(mcp_path, "utf-8");
|
|
78
|
+
const server = JSON.parse(content).mcpServers?.[name];
|
|
79
|
+
if (server) return {
|
|
80
|
+
server,
|
|
81
|
+
scope: "project"
|
|
82
|
+
};
|
|
83
|
+
} catch {}
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Auto-detect which scope a server lives in.
|
|
89
|
+
* Searches local → project → user.
|
|
90
|
+
*/
|
|
91
|
+
async function detect_server_scope(name) {
|
|
92
|
+
for (const scope of [
|
|
93
|
+
"local",
|
|
94
|
+
"project",
|
|
95
|
+
"user"
|
|
96
|
+
]) {
|
|
97
|
+
const result = await find_server_in_scope(name, scope);
|
|
98
|
+
if (result) return result;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Read full Claude config including projects section
|
|
104
|
+
*/
|
|
105
|
+
async function read_claude_config_full() {
|
|
106
|
+
const config_path = get_claude_config_path();
|
|
107
|
+
try {
|
|
108
|
+
await access(config_path);
|
|
109
|
+
const config_content = await readFile(config_path, "utf-8");
|
|
110
|
+
return JSON.parse(config_content);
|
|
111
|
+
} catch {
|
|
112
|
+
return {
|
|
113
|
+
mcpServers: {},
|
|
114
|
+
projects: {}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Read MCP servers for local scope (current project)
|
|
120
|
+
* Stored in ~/.claude.json -> projects[cwd].mcpServers
|
|
121
|
+
* Also searches parent directories since Claude CLI may store config at parent level
|
|
122
|
+
*/
|
|
123
|
+
async function read_local_mcp_servers() {
|
|
124
|
+
const { dirname } = await import("node:path");
|
|
125
|
+
const { homedir } = await import("node:os");
|
|
126
|
+
const full_config = await read_claude_config_full();
|
|
127
|
+
const home = homedir();
|
|
128
|
+
let current_dir = get_current_project_path();
|
|
129
|
+
while (current_dir && current_dir !== "/" && current_dir.length >= home.length) {
|
|
130
|
+
const project_config = full_config.projects?.[current_dir];
|
|
131
|
+
if (project_config?.mcpServers && Object.keys(project_config.mcpServers).length > 0) return Object.keys(project_config.mcpServers);
|
|
132
|
+
current_dir = dirname(current_dir);
|
|
133
|
+
}
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Read MCP servers from ~/.claude.json -> mcpServers (user scope)
|
|
138
|
+
*/
|
|
139
|
+
async function read_user_mcp_servers() {
|
|
140
|
+
const config = await read_claude_config();
|
|
141
|
+
return Object.keys(config.mcpServers || {});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Read MCP servers from .mcp.json files (project scope)
|
|
145
|
+
* Searches current directory and parents for .mcp.json
|
|
146
|
+
*/
|
|
147
|
+
async function find_and_read_project_mcp_json() {
|
|
148
|
+
const { dirname } = await import("node:path");
|
|
149
|
+
let current_dir = get_current_project_path();
|
|
150
|
+
const home = (await import("node:os")).homedir();
|
|
151
|
+
while (current_dir && current_dir !== "/" && current_dir.length >= home.length) {
|
|
152
|
+
const mcp_path = `${current_dir}/.mcp.json`;
|
|
153
|
+
try {
|
|
154
|
+
await access(mcp_path);
|
|
155
|
+
const content = await readFile(mcp_path, "utf-8");
|
|
156
|
+
const servers = JSON.parse(content).mcpServers || {};
|
|
157
|
+
return Object.keys(servers);
|
|
158
|
+
} catch {}
|
|
159
|
+
current_dir = dirname(current_dir);
|
|
160
|
+
}
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get currently enabled server names for a specific scope
|
|
165
|
+
*/
|
|
166
|
+
async function get_enabled_servers_for_scope(scope) {
|
|
167
|
+
switch (scope) {
|
|
168
|
+
case "local": return read_local_mcp_servers();
|
|
169
|
+
case "project": return find_and_read_project_mcp_json();
|
|
170
|
+
case "user": return read_user_mcp_servers();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
export { get_enabled_servers as a, write_claude_config as c, find_server_in_scope as i, create_config_from_servers as n, get_enabled_servers_for_scope as o, detect_server_scope as r, read_claude_config as s, config_exports as t };
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=config-DijVdEFn.js.map
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { i as get_claude_config_path, o as get_current_project_path, s as get_dev_overrides_path, v as get_project_mcp_json_path } from "./paths-BPISiJi4.js";
|
|
2
|
+
import { t as atomic_json_write } from "./atomic-write-BqEykHp9.js";
|
|
3
|
+
import { i as find_server_in_scope, r as detect_server_scope } from "./config-DijVdEFn.js";
|
|
4
|
+
import { n as output, t as error } from "./output-BchYq0mR.js";
|
|
5
|
+
import { n as redact_server_base } from "./redact-O35tjnRD.js";
|
|
6
|
+
import { readFile } from "node:fs/promises";
|
|
7
|
+
import { defineCommand } from "citty";
|
|
8
|
+
//#region src/core/dev-override.ts
|
|
9
|
+
const EMPTY_OVERRIDES = {
|
|
10
|
+
version: 1,
|
|
11
|
+
overrides: {}
|
|
12
|
+
};
|
|
13
|
+
async function read_dev_overrides() {
|
|
14
|
+
try {
|
|
15
|
+
const content = await readFile(get_dev_overrides_path(), "utf-8");
|
|
16
|
+
return JSON.parse(content);
|
|
17
|
+
} catch {
|
|
18
|
+
return {
|
|
19
|
+
...EMPTY_OVERRIDES,
|
|
20
|
+
overrides: {}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function write_dev_overrides(data) {
|
|
25
|
+
await atomic_json_write(get_dev_overrides_path(), () => data);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Write a server config into the appropriate scope config file.
|
|
29
|
+
*/
|
|
30
|
+
async function write_server_to_scope(name, server, scope) {
|
|
31
|
+
if (scope === "user") await atomic_json_write(get_claude_config_path(), (existing) => {
|
|
32
|
+
if (!existing.mcpServers) existing.mcpServers = {};
|
|
33
|
+
existing.mcpServers[name] = server;
|
|
34
|
+
return existing;
|
|
35
|
+
});
|
|
36
|
+
else if (scope === "local") {
|
|
37
|
+
const cwd = get_current_project_path();
|
|
38
|
+
await atomic_json_write(get_claude_config_path(), (existing) => {
|
|
39
|
+
if (!existing.projects) existing.projects = {};
|
|
40
|
+
const projects = existing.projects;
|
|
41
|
+
if (!projects[cwd]) projects[cwd] = {};
|
|
42
|
+
if (!projects[cwd].mcpServers) projects[cwd].mcpServers = {};
|
|
43
|
+
projects[cwd].mcpServers[name] = server;
|
|
44
|
+
return existing;
|
|
45
|
+
});
|
|
46
|
+
} else if (scope === "project") await atomic_json_write(get_project_mcp_json_path(), (existing) => {
|
|
47
|
+
if (!existing.mcpServers) existing.mcpServers = {};
|
|
48
|
+
existing.mcpServers[name] = server;
|
|
49
|
+
return existing;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Apply a dev override: store original config, swap in local dev command.
|
|
54
|
+
*/
|
|
55
|
+
async function apply_dev_override(name, command, args, scope) {
|
|
56
|
+
let found;
|
|
57
|
+
if (scope) found = await find_server_in_scope(name, scope);
|
|
58
|
+
else found = await detect_server_scope(name);
|
|
59
|
+
if (!found) return {
|
|
60
|
+
success: false,
|
|
61
|
+
scope: scope || "local",
|
|
62
|
+
error: `Server '${name}' not found${scope ? ` in ${scope} scope` : " in any scope"}`
|
|
63
|
+
};
|
|
64
|
+
const overrides = await read_dev_overrides();
|
|
65
|
+
if (overrides.overrides[name]) return {
|
|
66
|
+
success: false,
|
|
67
|
+
scope: found.scope,
|
|
68
|
+
error: `Server '${name}' already has a dev override. Run 'mcpick dev --restore ${name}' first.`
|
|
69
|
+
};
|
|
70
|
+
const dev_server = {
|
|
71
|
+
command,
|
|
72
|
+
...args.length > 0 ? { args } : {}
|
|
73
|
+
};
|
|
74
|
+
overrides.overrides[name] = {
|
|
75
|
+
original: found.server,
|
|
76
|
+
dev: dev_server,
|
|
77
|
+
scope: found.scope,
|
|
78
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
79
|
+
};
|
|
80
|
+
await write_dev_overrides(overrides);
|
|
81
|
+
await write_server_to_scope(name, dev_server, found.scope);
|
|
82
|
+
return {
|
|
83
|
+
success: true,
|
|
84
|
+
scope: found.scope
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Restore original server config from dev override.
|
|
89
|
+
*/
|
|
90
|
+
async function restore_dev_override(name) {
|
|
91
|
+
const overrides = await read_dev_overrides();
|
|
92
|
+
const entry = overrides.overrides[name];
|
|
93
|
+
if (!entry) return {
|
|
94
|
+
success: false,
|
|
95
|
+
error: `No dev override found for '${name}'`
|
|
96
|
+
};
|
|
97
|
+
await write_server_to_scope(name, entry.original, entry.scope);
|
|
98
|
+
delete overrides.overrides[name];
|
|
99
|
+
await write_dev_overrides(overrides);
|
|
100
|
+
return { success: true };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Restore all dev overrides.
|
|
104
|
+
*/
|
|
105
|
+
async function restore_all_dev_overrides() {
|
|
106
|
+
const overrides = await read_dev_overrides();
|
|
107
|
+
const restored = [];
|
|
108
|
+
const errors = [];
|
|
109
|
+
for (const name of Object.keys(overrides.overrides)) {
|
|
110
|
+
const result = await restore_dev_override(name);
|
|
111
|
+
if (result.success) restored.push(name);
|
|
112
|
+
else errors.push(`${name}: ${result.error}`);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
restored,
|
|
116
|
+
errors
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* List all active dev overrides.
|
|
121
|
+
*/
|
|
122
|
+
async function list_dev_overrides() {
|
|
123
|
+
const overrides = await read_dev_overrides();
|
|
124
|
+
return Object.entries(overrides.overrides).map(([name, entry]) => ({
|
|
125
|
+
name,
|
|
126
|
+
...entry
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
var dev_default = defineCommand({
|
|
130
|
+
meta: {
|
|
131
|
+
name: "dev",
|
|
132
|
+
description: "MCP server local development workflow"
|
|
133
|
+
},
|
|
134
|
+
subCommands: {
|
|
135
|
+
apply: defineCommand({
|
|
136
|
+
meta: {
|
|
137
|
+
name: "apply",
|
|
138
|
+
description: "Override an MCP server with a local dev command"
|
|
139
|
+
},
|
|
140
|
+
args: {
|
|
141
|
+
name: {
|
|
142
|
+
type: "positional",
|
|
143
|
+
description: "Server name to override",
|
|
144
|
+
required: true
|
|
145
|
+
},
|
|
146
|
+
command: {
|
|
147
|
+
type: "string",
|
|
148
|
+
description: "Local command to run",
|
|
149
|
+
required: true
|
|
150
|
+
},
|
|
151
|
+
args: {
|
|
152
|
+
type: "string",
|
|
153
|
+
description: "Comma-separated arguments"
|
|
154
|
+
},
|
|
155
|
+
scope: {
|
|
156
|
+
type: "string",
|
|
157
|
+
description: "Scope to search: local, project, or user (default: auto-detect)"
|
|
158
|
+
},
|
|
159
|
+
json: {
|
|
160
|
+
type: "boolean",
|
|
161
|
+
description: "Output as JSON",
|
|
162
|
+
default: false
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
async run({ args }) {
|
|
166
|
+
const scope = args.scope;
|
|
167
|
+
if (scope && ![
|
|
168
|
+
"local",
|
|
169
|
+
"project",
|
|
170
|
+
"user"
|
|
171
|
+
].includes(scope)) error(`Invalid scope: ${scope}. Use local, project, or user.`);
|
|
172
|
+
const cmd_args = args.args ? args.args.split(",") : [];
|
|
173
|
+
const result = await apply_dev_override(args.name, args.command, cmd_args, scope);
|
|
174
|
+
if (args.json) output(result, true);
|
|
175
|
+
else if (result.success) {
|
|
176
|
+
console.log(`Dev override applied for '${args.name}' (scope: ${result.scope})`);
|
|
177
|
+
console.log(` command: ${args.command}${cmd_args.length > 0 ? ` ${cmd_args.join(" ")}` : ""}`);
|
|
178
|
+
console.log("\nRestart Claude Code or run /reload-plugins to pick up changes.");
|
|
179
|
+
} else error(result.error || "Unknown error");
|
|
180
|
+
}
|
|
181
|
+
}),
|
|
182
|
+
restore: defineCommand({
|
|
183
|
+
meta: {
|
|
184
|
+
name: "restore",
|
|
185
|
+
description: "Restore original server config from dev override"
|
|
186
|
+
},
|
|
187
|
+
args: {
|
|
188
|
+
name: {
|
|
189
|
+
type: "positional",
|
|
190
|
+
description: "Server name to restore (omit with --all to restore all)",
|
|
191
|
+
required: false
|
|
192
|
+
},
|
|
193
|
+
all: {
|
|
194
|
+
type: "boolean",
|
|
195
|
+
description: "Restore all dev overrides",
|
|
196
|
+
default: false
|
|
197
|
+
},
|
|
198
|
+
json: {
|
|
199
|
+
type: "boolean",
|
|
200
|
+
description: "Output as JSON",
|
|
201
|
+
default: false
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
async run({ args }) {
|
|
205
|
+
if (args.all) {
|
|
206
|
+
const result = await restore_all_dev_overrides();
|
|
207
|
+
if (args.json) output(result, true);
|
|
208
|
+
else if (result.restored.length === 0 && result.errors.length === 0) console.log("No dev overrides to restore.");
|
|
209
|
+
else {
|
|
210
|
+
for (const name of result.restored) console.log(`Restored: ${name}`);
|
|
211
|
+
for (const err of result.errors) console.error(`Error: ${err}`);
|
|
212
|
+
}
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!args.name) error("Specify a server name or use --all. Run \"mcpick dev list\" to see active overrides.");
|
|
216
|
+
const result = await restore_dev_override(args.name);
|
|
217
|
+
if (args.json) output(result, true);
|
|
218
|
+
else if (result.success) {
|
|
219
|
+
console.log(`Restored original config for '${args.name}'`);
|
|
220
|
+
console.log("\nRestart Claude Code or run /reload-plugins to pick up changes.");
|
|
221
|
+
} else error(result.error || "Unknown error");
|
|
222
|
+
}
|
|
223
|
+
}),
|
|
224
|
+
list: defineCommand({
|
|
225
|
+
meta: {
|
|
226
|
+
name: "list",
|
|
227
|
+
description: "List active dev overrides"
|
|
228
|
+
},
|
|
229
|
+
args: { json: {
|
|
230
|
+
type: "boolean",
|
|
231
|
+
description: "Output as JSON",
|
|
232
|
+
default: false
|
|
233
|
+
} },
|
|
234
|
+
async run({ args }) {
|
|
235
|
+
const overrides = await list_dev_overrides();
|
|
236
|
+
if (args.json) {
|
|
237
|
+
output(overrides.map((o) => ({
|
|
238
|
+
...o,
|
|
239
|
+
original: redact_server_base(o.original),
|
|
240
|
+
dev: redact_server_base(o.dev)
|
|
241
|
+
})), true);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (overrides.length === 0) {
|
|
245
|
+
console.log("No active dev overrides.");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
for (const o of overrides) {
|
|
249
|
+
const orig = o.original;
|
|
250
|
+
const dev = o.dev;
|
|
251
|
+
const original_cmd = "command" in orig ? `${orig.command}${"args" in orig && orig.args ? " " + orig.args.join(" ") : ""}` : "url" in orig ? orig.url : "?";
|
|
252
|
+
const dev_cmd = "command" in dev ? `${dev.command}${"args" in dev && dev.args ? " " + dev.args.join(" ") : ""}` : "url" in dev ? dev.url : "?";
|
|
253
|
+
console.log(`${o.name} (scope: ${o.scope})`);
|
|
254
|
+
console.log(` original: ${original_cmd}`);
|
|
255
|
+
console.log(` dev: ${dev_cmd}`);
|
|
256
|
+
console.log(` since: ${o.createdAt}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
//#endregion
|
|
263
|
+
export { dev_default as default };
|
|
264
|
+
|
|
265
|
+
//# sourceMappingURL=dev-DRJRNp7y.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { n as get_all_available_servers } from "./registry-CfUKT7_C.js";
|
|
2
|
+
import { p as remove_mcp_via_cli } from "./claude-cli-BeA-bmoW.js";
|
|
3
|
+
import { t as error } from "./output-BchYq0mR.js";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
//#region src/cli/commands/disable.ts
|
|
6
|
+
var disable_default = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "disable",
|
|
9
|
+
description: "Disable an MCP server"
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
server: {
|
|
13
|
+
type: "positional",
|
|
14
|
+
description: "Server name to disable",
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
scope: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Scope: local, project, or user (default: local)",
|
|
20
|
+
default: "local"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
async run({ args }) {
|
|
24
|
+
const scope = args.scope;
|
|
25
|
+
if (![
|
|
26
|
+
"local",
|
|
27
|
+
"project",
|
|
28
|
+
"user"
|
|
29
|
+
].includes(scope)) error(`Invalid scope: ${scope}. Use local, project, or user.`);
|
|
30
|
+
await get_all_available_servers();
|
|
31
|
+
const result = await remove_mcp_via_cli(args.server);
|
|
32
|
+
if (!result.success) error(result.error || "Failed to disable server");
|
|
33
|
+
console.log(`Disabled '${args.server}' (scope: ${scope})`);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
//#endregion
|
|
37
|
+
export { disable_default as default };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=disable-BA8tXPJN.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { n as get_all_available_servers } from "./registry-CfUKT7_C.js";
|
|
2
|
+
import { t as add_mcp_via_cli } from "./claude-cli-BeA-bmoW.js";
|
|
3
|
+
import { t as error } from "./output-BchYq0mR.js";
|
|
4
|
+
import { defineCommand } from "citty";
|
|
5
|
+
//#region src/cli/commands/enable.ts
|
|
6
|
+
var enable_default = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "enable",
|
|
9
|
+
description: "Enable an MCP server"
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
server: {
|
|
13
|
+
type: "positional",
|
|
14
|
+
description: "Server name to enable",
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
scope: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description: "Scope: local, project, or user (default: local)",
|
|
20
|
+
default: "local"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
async run({ args }) {
|
|
24
|
+
const scope = args.scope;
|
|
25
|
+
if (![
|
|
26
|
+
"local",
|
|
27
|
+
"project",
|
|
28
|
+
"user"
|
|
29
|
+
].includes(scope)) error(`Invalid scope: ${scope}. Use local, project, or user.`);
|
|
30
|
+
const server = (await get_all_available_servers()).find((s) => s.name === args.server);
|
|
31
|
+
if (!server) error(`Server '${args.server}' not found in registry. Run 'mcpick list' to see available servers.`);
|
|
32
|
+
const result = await add_mcp_via_cli(server, scope);
|
|
33
|
+
if (!result.success) error(result.error || "Failed to enable server");
|
|
34
|
+
console.log(`Enabled '${server.name}' (scope: ${scope})`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { enable_default as default };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=enable-Bdnnn_Cq.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { d as mcp_get_via_cli } from "./claude-cli-BeA-bmoW.js";
|
|
2
|
+
import { n as output, t as error } from "./output-BchYq0mR.js";
|
|
3
|
+
import { defineCommand } from "citty";
|
|
4
|
+
//#region src/cli/commands/get.ts
|
|
5
|
+
var get_default = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "get",
|
|
8
|
+
description: "Get details about an MCP server"
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
name: {
|
|
12
|
+
type: "positional",
|
|
13
|
+
description: "Server name",
|
|
14
|
+
required: true
|
|
15
|
+
},
|
|
16
|
+
json: {
|
|
17
|
+
type: "boolean",
|
|
18
|
+
description: "Output as JSON",
|
|
19
|
+
default: false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
async run({ args }) {
|
|
23
|
+
const result = await mcp_get_via_cli(args.name);
|
|
24
|
+
if (args.json) try {
|
|
25
|
+
output(JSON.parse(result.stdout || "{}"), true);
|
|
26
|
+
} catch {
|
|
27
|
+
output({
|
|
28
|
+
name: args.name,
|
|
29
|
+
success: result.success,
|
|
30
|
+
output: result.stdout,
|
|
31
|
+
error: result.error
|
|
32
|
+
}, true);
|
|
33
|
+
}
|
|
34
|
+
else if (result.success) console.log(result.stdout || "No details available.");
|
|
35
|
+
else error(result.error || "Unknown error");
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { get_default as default };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=get-BPjMXTMc.js.map
|