mcpick 0.0.12 → 0.0.13
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/CHANGELOG.md +7 -0
- package/dist/cli/commands/disable.js +3 -0
- package/dist/core/registry.js +18 -2
- package/dist/utils/claude-cli.js +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineCommand } from 'citty';
|
|
2
|
+
import { get_all_available_servers } from '../../core/registry.js';
|
|
2
3
|
import { remove_mcp_via_cli } from '../../utils/claude-cli.js';
|
|
3
4
|
import { error } from '../output.js';
|
|
4
5
|
export default defineCommand({
|
|
@@ -23,6 +24,8 @@ export default defineCommand({
|
|
|
23
24
|
if (!['local', 'project', 'user'].includes(scope)) {
|
|
24
25
|
error(`Invalid scope: ${scope}. Use local, project, or user.`);
|
|
25
26
|
}
|
|
27
|
+
// Sync config→registry before removing so headers/env are preserved
|
|
28
|
+
await get_all_available_servers();
|
|
26
29
|
const result = await remove_mcp_via_cli(args.server);
|
|
27
30
|
if (!result.success) {
|
|
28
31
|
error(result.error || 'Failed to disable server');
|
package/dist/core/registry.js
CHANGED
|
@@ -44,13 +44,29 @@ export async function get_all_available_servers() {
|
|
|
44
44
|
const registry = await read_server_registry();
|
|
45
45
|
const config = await read_claude_config();
|
|
46
46
|
const config_servers = get_enabled_servers(config);
|
|
47
|
-
// Merge:
|
|
48
|
-
const
|
|
47
|
+
// Merge: config is the live truth, so update registry entries with config data
|
|
48
|
+
const config_by_name = new Map(config_servers.map((s) => [s.name, s]));
|
|
49
|
+
const known_names = new Set();
|
|
50
|
+
let registry_updated = false;
|
|
51
|
+
for (let i = 0; i < registry.servers.length; i++) {
|
|
52
|
+
const name = registry.servers[i].name;
|
|
53
|
+
known_names.add(name);
|
|
54
|
+
const config_server = config_by_name.get(name);
|
|
55
|
+
if (config_server) {
|
|
56
|
+
registry.servers[i] = config_server;
|
|
57
|
+
registry_updated = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
49
60
|
for (const server of config_servers) {
|
|
50
61
|
if (!known_names.has(server.name)) {
|
|
51
62
|
registry.servers.push(server);
|
|
63
|
+
registry_updated = true;
|
|
52
64
|
}
|
|
53
65
|
}
|
|
66
|
+
// Persist updated data back to registry so it survives disable/enable cycles
|
|
67
|
+
if (registry_updated) {
|
|
68
|
+
await write_server_registry(registry);
|
|
69
|
+
}
|
|
54
70
|
return registry.servers;
|
|
55
71
|
}
|
|
56
72
|
export async function sync_servers_to_registry(servers) {
|
package/dist/utils/claude-cli.js
CHANGED
|
@@ -59,10 +59,15 @@ function build_add_command(server, scope) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
|
-
// HTTP or SSE transport
|
|
62
|
+
// HTTP or SSE transport — URL must come before header flags
|
|
63
63
|
if ('url' in server && server.url) {
|
|
64
64
|
parts.push(shell_escape(server.url));
|
|
65
65
|
}
|
|
66
|
+
if ('headers' in server && server.headers) {
|
|
67
|
+
for (const [key, value] of Object.entries(server.headers)) {
|
|
68
|
+
parts.push('-H', shell_escape(`${key}: ${value}`));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
66
71
|
}
|
|
67
72
|
return parts.join(' ');
|
|
68
73
|
}
|