brilliant-directories-mcp 1.3.0 → 1.4.2
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/README.md +10 -0
- package/index.js +105 -39
- package/openapi/bd-api.json +8693 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -23,6 +23,16 @@ Restart your app, then ask your AI:
|
|
|
23
23
|
|
|
24
24
|
Get your API key from **BD Admin > Developer Hub > Generate API Key**.
|
|
25
25
|
|
|
26
|
+
### For AI agents / scripts (non-interactive)
|
|
27
|
+
|
|
28
|
+
If an AI agent is guiding you, it can have you paste a single command with everything prefilled:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx brilliant-directories-mcp --setup --url https://your-site.com --api-key YOUR_KEY --client cursor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This runs the full setup end-to-end with no prompts. Replace `cursor` with `claude-desktop`, `windsurf`, `claude-code`, or `print` (prints the JSON config instead of writing a file).
|
|
35
|
+
|
|
26
36
|
---
|
|
27
37
|
|
|
28
38
|
## Setup by Platform
|
package/index.js
CHANGED
|
@@ -49,6 +49,8 @@ function parseArgs() {
|
|
|
49
49
|
setup: false,
|
|
50
50
|
help: false,
|
|
51
51
|
debug: process.env.BD_DEBUG === "1" || process.env.BD_DEBUG === "true",
|
|
52
|
+
client: "", // "cursor" | "claude-desktop" | "windsurf" | "claude-code" | "print" | ""
|
|
53
|
+
yes: false, // auto-confirm any "continue anyway?" prompts (for non-interactive use)
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -60,6 +62,10 @@ function parseArgs() {
|
|
|
60
62
|
config.verify = true;
|
|
61
63
|
} else if (args[i] === "--setup") {
|
|
62
64
|
config.setup = true;
|
|
65
|
+
} else if (args[i] === "--client" && args[i + 1]) {
|
|
66
|
+
config.client = args[++i].toLowerCase();
|
|
67
|
+
} else if (args[i] === "--yes" || args[i] === "-y") {
|
|
68
|
+
config.yes = true;
|
|
63
69
|
} else if (args[i] === "--debug") {
|
|
64
70
|
config.debug = true;
|
|
65
71
|
} else if (args[i] === "--help" || args[i] === "-h") {
|
|
@@ -104,15 +110,26 @@ FIRST TIME? Just run this and answer 2 questions:
|
|
|
104
110
|
npx brilliant-directories-mcp --setup
|
|
105
111
|
|
|
106
112
|
Usage:
|
|
107
|
-
brilliant-directories-mcp --setup
|
|
108
|
-
brilliant-directories-mcp --api-key KEY --
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
brilliant-directories-mcp --setup Interactive wizard (recommended for humans)
|
|
114
|
+
brilliant-directories-mcp --setup --url URL --api-key KEY --client cursor [--yes]
|
|
115
|
+
Non-interactive setup (for AI agents / scripts)
|
|
116
|
+
brilliant-directories-mcp --api-key KEY --url URL Run the MCP server
|
|
117
|
+
brilliant-directories-mcp --verify --api-key KEY --url URL Test credentials and exit
|
|
118
|
+
BD_API_KEY=KEY BD_API_URL=URL brilliant-directories-mcp Run via env vars
|
|
111
119
|
|
|
112
120
|
Options:
|
|
113
|
-
--setup
|
|
121
|
+
--setup Run setup. If --url, --api-key, and --client are all provided, runs non-interactively.
|
|
122
|
+
Otherwise prompts interactively for any missing value.
|
|
114
123
|
--api-key KEY Your BD API key (or set BD_API_KEY env var)
|
|
115
124
|
--url URL Your BD site URL, e.g. https://mysite.com (or BD_API_URL env var)
|
|
125
|
+
--client NAME Which MCP client to configure. One of:
|
|
126
|
+
cursor writes to ~/.cursor/mcp.json
|
|
127
|
+
claude-desktop writes to the Claude Desktop config
|
|
128
|
+
windsurf writes to ~/.codeium/windsurf/mcp_config.json
|
|
129
|
+
claude-code prints the "claude mcp add" command to run
|
|
130
|
+
print prints the JSON config only, does not write any file
|
|
131
|
+
If omitted in interactive setup, the wizard asks.
|
|
132
|
+
--yes, -y Auto-confirm any "continue anyway?" prompts (non-interactive safety)
|
|
116
133
|
--verify Test credentials against /api/v2/token/verify and exit
|
|
117
134
|
--debug Log every HTTP request + response to stderr (or set BD_DEBUG=1)
|
|
118
135
|
--help, -h Show this help
|
|
@@ -126,12 +143,21 @@ Docs: https://github.com/brilliantdirectories/brilliant-directories-mcp`);
|
|
|
126
143
|
// ---------------------------------------------------------------------------
|
|
127
144
|
|
|
128
145
|
function loadSpec() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
146
|
+
// Try the in-package location first (what npm ships), then fall back to the
|
|
147
|
+
// monorepo location (repo-root openapi/ sibling of mcp/) for local development.
|
|
148
|
+
const candidates = [
|
|
149
|
+
path.join(__dirname, "openapi", "bd-api.json"),
|
|
150
|
+
path.join(__dirname, "..", "openapi", "bd-api.json"),
|
|
151
|
+
];
|
|
152
|
+
for (const p of candidates) {
|
|
153
|
+
if (fs.existsSync(p)) {
|
|
154
|
+
return JSON.parse(fs.readFileSync(p, "utf8"));
|
|
155
|
+
}
|
|
133
156
|
}
|
|
134
|
-
|
|
157
|
+
console.error(`Error: OpenAPI spec not found. Looked in:`);
|
|
158
|
+
for (const p of candidates) console.error(` ${p}`);
|
|
159
|
+
console.error(`This is a packaging bug — please open an issue at https://github.com/brilliantdirectories/brilliant-directories-mcp/issues`);
|
|
160
|
+
process.exit(1);
|
|
135
161
|
}
|
|
136
162
|
|
|
137
163
|
/**
|
|
@@ -435,15 +461,29 @@ function writeClientConfig(configPath, serverName, entry) {
|
|
|
435
461
|
return true;
|
|
436
462
|
}
|
|
437
463
|
|
|
438
|
-
async function runSetup() {
|
|
464
|
+
async function runSetup(cliConfig) {
|
|
465
|
+
cliConfig = cliConfig || {};
|
|
466
|
+
const flagUrl = cliConfig.apiUrl || "";
|
|
467
|
+
const flagKey = cliConfig.apiKey || "";
|
|
468
|
+
const flagClient = (cliConfig.client || "").toLowerCase();
|
|
469
|
+
const autoYes = !!cliConfig.yes;
|
|
470
|
+
|
|
471
|
+
// Non-interactive when all three required values are provided via flags or env
|
|
472
|
+
const nonInteractive = !!(flagUrl && flagKey && flagClient);
|
|
473
|
+
|
|
439
474
|
console.log("");
|
|
440
475
|
console.log("Brilliant Directories MCP — Setup Wizard");
|
|
441
476
|
console.log("=========================================");
|
|
477
|
+
if (nonInteractive) {
|
|
478
|
+
console.log("(non-interactive mode — all values supplied via flags)");
|
|
479
|
+
}
|
|
442
480
|
console.log("");
|
|
443
481
|
|
|
444
482
|
// URL
|
|
445
|
-
let apiUrl =
|
|
446
|
-
if (
|
|
483
|
+
let apiUrl = flagUrl;
|
|
484
|
+
if (apiUrl) {
|
|
485
|
+
apiUrl = normalizeUrl(apiUrl);
|
|
486
|
+
} else {
|
|
447
487
|
while (!apiUrl) {
|
|
448
488
|
const raw = await prompt("Your BD site URL (e.g. https://mysite.com): ");
|
|
449
489
|
if (!raw) {
|
|
@@ -455,7 +495,7 @@ async function runSetup() {
|
|
|
455
495
|
}
|
|
456
496
|
|
|
457
497
|
// API Key
|
|
458
|
-
let apiKey =
|
|
498
|
+
let apiKey = flagKey;
|
|
459
499
|
if (!apiKey) {
|
|
460
500
|
console.log("");
|
|
461
501
|
console.log("Get an API key from: BD Admin > Developer Hub > Generate API Key");
|
|
@@ -481,42 +521,68 @@ async function runSetup() {
|
|
|
481
521
|
console.log(` HTTP ${result.status}: ${JSON.stringify(result.body)}`);
|
|
482
522
|
console.log("");
|
|
483
523
|
console.log("Setup will still write the config, but your AI agent won't be able to call the API until this is fixed.");
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
524
|
+
if (autoYes || nonInteractive) {
|
|
525
|
+
console.log("Continuing because --yes or --url/--api-key/--client were all provided.");
|
|
526
|
+
} else {
|
|
527
|
+
const proceed = await prompt("Continue anyway? (y/N): ");
|
|
528
|
+
if (!/^y/i.test(proceed)) {
|
|
529
|
+
console.log("Setup cancelled.");
|
|
530
|
+
process.exit(1);
|
|
531
|
+
}
|
|
488
532
|
}
|
|
489
533
|
}
|
|
490
534
|
} catch (err) {
|
|
491
535
|
console.log("FAILED");
|
|
492
536
|
console.log(` ${err.message}`);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
537
|
+
if (autoYes || nonInteractive) {
|
|
538
|
+
console.log("Continuing because --yes or --url/--api-key/--client were all provided.");
|
|
539
|
+
} else {
|
|
540
|
+
const proceed = await prompt("Continue anyway? (y/N): ");
|
|
541
|
+
if (!/^y/i.test(proceed)) {
|
|
542
|
+
console.log("Setup cancelled.");
|
|
543
|
+
process.exit(1);
|
|
544
|
+
}
|
|
497
545
|
}
|
|
498
546
|
}
|
|
499
547
|
|
|
500
|
-
// Client
|
|
501
|
-
console.log("");
|
|
502
|
-
console.log("Where are you using this?");
|
|
503
|
-
console.log(" 1) Cursor");
|
|
504
|
-
console.log(" 2) Claude Desktop");
|
|
505
|
-
console.log(" 3) Windsurf");
|
|
506
|
-
console.log(" 4) Claude Code (CLI)");
|
|
507
|
-
console.log(" 5) Other / just show me the config");
|
|
508
|
-
const choice = await prompt("Choice [1-5]: ");
|
|
509
|
-
|
|
548
|
+
// Client selection
|
|
510
549
|
const entry = buildMcpServerEntry(apiKey, apiUrl);
|
|
511
550
|
const serverName = "brilliant-directories";
|
|
512
551
|
|
|
552
|
+
const CLIENT_MAP = {
|
|
553
|
+
cursor: { key: "cursor", label: "Cursor" },
|
|
554
|
+
"claude-desktop":{ key: "claude-desktop", label: "Claude Desktop" },
|
|
555
|
+
windsurf: { key: "windsurf", label: "Windsurf" },
|
|
556
|
+
"claude-code": { key: "claude-code", label: "Claude Code" },
|
|
557
|
+
print: { key: "other", label: "Print-only" },
|
|
558
|
+
other: { key: "other", label: "Other" },
|
|
559
|
+
};
|
|
560
|
+
|
|
513
561
|
let clientKey, clientLabel;
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
562
|
+
if (flagClient) {
|
|
563
|
+
const picked = CLIENT_MAP[flagClient];
|
|
564
|
+
if (!picked) {
|
|
565
|
+
console.error(`Error: unknown --client value "${flagClient}". Expected one of: cursor, claude-desktop, windsurf, claude-code, print.`);
|
|
566
|
+
process.exit(1);
|
|
567
|
+
}
|
|
568
|
+
clientKey = picked.key;
|
|
569
|
+
clientLabel = picked.label;
|
|
570
|
+
} else {
|
|
571
|
+
console.log("");
|
|
572
|
+
console.log("Where are you using this?");
|
|
573
|
+
console.log(" 1) Cursor");
|
|
574
|
+
console.log(" 2) Claude Desktop");
|
|
575
|
+
console.log(" 3) Windsurf");
|
|
576
|
+
console.log(" 4) Claude Code (CLI)");
|
|
577
|
+
console.log(" 5) Other / just show me the config");
|
|
578
|
+
const choice = await prompt("Choice [1-5]: ");
|
|
579
|
+
switch ((choice || "").trim()) {
|
|
580
|
+
case "1": clientKey = "cursor"; clientLabel = "Cursor"; break;
|
|
581
|
+
case "2": clientKey = "claude-desktop"; clientLabel = "Claude Desktop"; break;
|
|
582
|
+
case "3": clientKey = "windsurf"; clientLabel = "Windsurf"; break;
|
|
583
|
+
case "4": clientKey = "claude-code"; clientLabel = "Claude Code"; break;
|
|
584
|
+
default: clientKey = "other"; clientLabel = "Other";
|
|
585
|
+
}
|
|
520
586
|
}
|
|
521
587
|
|
|
522
588
|
console.log("");
|
|
@@ -573,7 +639,7 @@ async function main() {
|
|
|
573
639
|
const config = parseArgs();
|
|
574
640
|
|
|
575
641
|
if (config.setup) {
|
|
576
|
-
await runSetup();
|
|
642
|
+
await runSetup(config);
|
|
577
643
|
return;
|
|
578
644
|
}
|
|
579
645
|
|