@brain-mcps/setup 0.2.2 → 0.2.3
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.d.ts +7 -0
- package/dist/index.js +16 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export interface ClientDef {
|
|
|
14
14
|
buildEntry: (url: string) => Record<string, unknown>;
|
|
15
15
|
/** If set, only these platforms are supported. Otherwise all platforms. */
|
|
16
16
|
supportedPlatforms?: NodeJS.Platform[];
|
|
17
|
+
/**
|
|
18
|
+
* ~-prefixed path whose existence marks the client as installed (used by
|
|
19
|
+
* detectInstalledClients). Defaults to the config file's parent directory.
|
|
20
|
+
* Needed when the config lives directly in the home dir (Claude Code's
|
|
21
|
+
* ~/.claude.json), where the parent is ~ and would always "exist".
|
|
22
|
+
*/
|
|
23
|
+
detectPath?: string;
|
|
17
24
|
}
|
|
18
25
|
export interface ClientConfig extends ClientDef {
|
|
19
26
|
configPath: string;
|
package/dist/index.js
CHANGED
|
@@ -66,9 +66,17 @@ exports.CLIENT_DEFS = {
|
|
|
66
66
|
"claude-code": {
|
|
67
67
|
id: "claude-code",
|
|
68
68
|
name: "Claude Code",
|
|
69
|
-
|
|
69
|
+
// Claude Code reads user-scoped MCP servers from ~/.claude.json (what
|
|
70
|
+
// `claude mcp add -s user` writes), NOT ~/.claude/settings.json (which is
|
|
71
|
+
// for settings and silently ignores an mcpServers key). Remote HTTP
|
|
72
|
+
// servers use transport type "http" (verified against Claude Code 2.1.x).
|
|
73
|
+
configPathTemplate: "~/.claude.json",
|
|
74
|
+
// ~/.claude.json sits directly in the home dir, so detect Claude Code by
|
|
75
|
+
// its ~/.claude directory instead of the config file's parent (which is ~,
|
|
76
|
+
// and would always report as installed).
|
|
77
|
+
detectPath: "~/.claude",
|
|
70
78
|
serversKey: ["mcpServers"],
|
|
71
|
-
buildEntry: (url) => ({ type: "
|
|
79
|
+
buildEntry: (url) => ({ type: "http", url }),
|
|
72
80
|
},
|
|
73
81
|
"claude-desktop": {
|
|
74
82
|
id: "claude-desktop",
|
|
@@ -206,12 +214,15 @@ function setupClient(clientId, product, options = {}) {
|
|
|
206
214
|
return { client: clientId, configPath, action, serverName };
|
|
207
215
|
}
|
|
208
216
|
function detectInstalledClients(homeDir) {
|
|
217
|
+
const home = homeDir ?? os.homedir();
|
|
209
218
|
return Object.keys(exports.CLIENT_DEFS).filter((id) => {
|
|
210
219
|
if (!isClientSupportedOnPlatform(id))
|
|
211
220
|
return false;
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
|
|
221
|
+
const def = exports.CLIENT_DEFS[id];
|
|
222
|
+
const marker = def.detectPath
|
|
223
|
+
? def.detectPath.replace(/^~/, home)
|
|
224
|
+
: path.dirname(resolveConfigPath(id, homeDir));
|
|
225
|
+
return fs.existsSync(marker);
|
|
215
226
|
});
|
|
216
227
|
}
|
|
217
228
|
function listClients(homeDir) {
|