@rb2b/rb2b-apis-mcp 1.1.1 → 1.1.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/dist/init.js +12 -4
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -16,15 +16,23 @@ async function main() {
|
|
|
16
16
|
console.log("RB2B MCP Server — Initial Setup");
|
|
17
17
|
console.log("=================================\n");
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const input = await prompt(existing
|
|
20
|
+
? "Enter a new RB2B API key (or press Enter to keep the existing one): "
|
|
21
|
+
: "Enter your RB2B API key: ");
|
|
22
|
+
if (!input.trim()) {
|
|
23
|
+
if (existing) {
|
|
24
|
+
console.log("\nKeeping existing API key. No changes made.");
|
|
25
|
+
rl.close();
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
21
28
|
console.error("Error: API key cannot be empty.");
|
|
22
29
|
process.exit(1);
|
|
23
30
|
}
|
|
31
|
+
const apiKey = input.trim();
|
|
24
32
|
console.log("\nValidating API key...");
|
|
25
33
|
try {
|
|
26
34
|
const res = await fetch(`${BASE_URL}/credits`, {
|
|
27
|
-
headers: { "Api-Key": apiKey
|
|
35
|
+
headers: { "Api-Key": apiKey },
|
|
28
36
|
});
|
|
29
37
|
if (!res.ok) {
|
|
30
38
|
const text = await res.text().catch(() => res.statusText);
|
|
@@ -34,7 +42,7 @@ async function main() {
|
|
|
34
42
|
const data = await res.json();
|
|
35
43
|
console.log("\nAPI key valid!");
|
|
36
44
|
console.log("Credits info:", JSON.stringify(data, null, 2));
|
|
37
|
-
saveConfig({ apiKey
|
|
45
|
+
saveConfig({ apiKey });
|
|
38
46
|
console.log("\nConfiguration saved to ~/.rb2b/config.json");
|
|
39
47
|
console.log("\nYou can now add the MCP server to your Claude config:\n");
|
|
40
48
|
console.log(JSON.stringify({
|