@rb2b/rb2b-apis-mcp 1.1.2 → 1.1.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/README.md +23 -11
- package/dist/init.js +54 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Resolve IP addresses to companies, look up LinkedIn profiles from emails, find c
|
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
11
|
+
- **An MCP-compatible AI client** — [Claude Desktop](https://claude.ai/download) or [Claude Code](https://claude.ai/code) must be installed before setting up this server
|
|
11
12
|
- Node.js 18+
|
|
12
13
|
- An [RB2B APIs](https://ui.api.rb2b.com) account and API key. Don't have an account? Get your first 100 credits for just $9.
|
|
13
14
|
|
|
@@ -15,19 +16,36 @@ Resolve IP addresses to companies, look up LinkedIn profiles from emails, find c
|
|
|
15
16
|
|
|
16
17
|
## Quick Start
|
|
17
18
|
|
|
18
|
-
### 1.
|
|
19
|
+
### 1. Install Claude Desktop or Claude Code
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
This server requires an MCP-compatible client. Install one first:
|
|
22
|
+
|
|
23
|
+
- **[Claude Desktop](https://claude.ai/download)** — the Claude desktop app for macOS and Windows
|
|
24
|
+
- **[Claude Code](https://claude.ai/code)** — the Claude CLI for developers
|
|
25
|
+
|
|
26
|
+
### 2. Run the setup wizard
|
|
21
27
|
|
|
22
28
|
```bash
|
|
23
29
|
npx @rb2b/rb2b-apis-mcp init
|
|
24
30
|
```
|
|
25
31
|
|
|
26
|
-
This will
|
|
32
|
+
This will:
|
|
33
|
+
- Prompt for your RB2B API key and validate it
|
|
34
|
+
- Store it securely in `~/.rb2b/config.json` (permissions: `600`)
|
|
35
|
+
- Automatically register the server with Claude Code and Claude Desktop if detected
|
|
36
|
+
|
|
37
|
+
That's it. No manual config editing needed in most cases.
|
|
38
|
+
|
|
39
|
+
### Manual registration (if needed)
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
If auto-registration didn't run or you're using a different MCP client:
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
**Claude Code:**
|
|
44
|
+
```bash
|
|
45
|
+
claude mcp add rb2b -- npx @rb2b/rb2b-apis-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Claude Desktop** — edit your config file:
|
|
31
49
|
|
|
32
50
|
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
33
51
|
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
@@ -45,12 +63,6 @@ Edit your Claude Desktop config file:
|
|
|
45
63
|
|
|
46
64
|
Restart Claude Desktop after saving.
|
|
47
65
|
|
|
48
|
-
### 3. Add to Claude Code
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
claude mcp add rb2b -- npx @rb2b/rb2b-apis-mcp
|
|
52
|
-
```
|
|
53
|
-
|
|
54
66
|
---
|
|
55
67
|
|
|
56
68
|
## Tools
|
package/dist/init.js
CHANGED
|
@@ -1,10 +1,61 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createInterface } from "readline";
|
|
3
|
+
import { spawnSync } from "child_process";
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
5
|
+
import { homedir, platform } from "os";
|
|
6
|
+
import { join } from "path";
|
|
3
7
|
import { BASE_URL, loadConfig, saveConfig } from "./config.js";
|
|
4
8
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
5
9
|
function prompt(question) {
|
|
6
10
|
return new Promise((resolve) => rl.question(question, resolve));
|
|
7
11
|
}
|
|
12
|
+
function registerClaudeCode() {
|
|
13
|
+
// Check if the claude CLI is available.
|
|
14
|
+
const check = spawnSync("claude", ["mcp", "list"], { encoding: "utf-8" });
|
|
15
|
+
if (check.error || check.status !== 0)
|
|
16
|
+
return;
|
|
17
|
+
// Skip if already registered.
|
|
18
|
+
if (check.stdout?.includes("rb2b")) {
|
|
19
|
+
console.log("Claude Code: already registered.");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const result = spawnSync("claude", ["mcp", "add", "rb2b", "--", "npx", "@rb2b/rb2b-apis-mcp"], { encoding: "utf-8" });
|
|
23
|
+
if (result.error || result.status !== 0) {
|
|
24
|
+
console.log("Claude Code: could not auto-register. Run manually:");
|
|
25
|
+
console.log(" claude mcp add rb2b -- npx @rb2b/rb2b-apis-mcp");
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.log("Claude Code: registered successfully.");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function registerClaudeDesktop() {
|
|
32
|
+
const configPath = platform() === "win32"
|
|
33
|
+
? join(process.env.APPDATA ?? homedir(), "Claude", "claude_desktop_config.json")
|
|
34
|
+
: join(homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
35
|
+
if (!existsSync(configPath))
|
|
36
|
+
return;
|
|
37
|
+
let config = {};
|
|
38
|
+
try {
|
|
39
|
+
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const mcpServers = (config.mcpServers ?? {});
|
|
45
|
+
if (mcpServers.rb2b) {
|
|
46
|
+
console.log("Claude Desktop: already registered.");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
mcpServers.rb2b = { command: "npx", args: ["@rb2b/rb2b-apis-mcp"] };
|
|
50
|
+
config.mcpServers = mcpServers;
|
|
51
|
+
try {
|
|
52
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
53
|
+
console.log("Claude Desktop: registered successfully. Restart Claude Desktop to apply.");
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
console.log("Claude Desktop: could not auto-register. Add manually to:", configPath);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
8
59
|
async function main() {
|
|
9
60
|
const existing = loadConfig();
|
|
10
61
|
if (existing) {
|
|
@@ -44,15 +95,9 @@ async function main() {
|
|
|
44
95
|
console.log("Credits info:", JSON.stringify(data, null, 2));
|
|
45
96
|
saveConfig({ apiKey });
|
|
46
97
|
console.log("\nConfiguration saved to ~/.rb2b/config.json");
|
|
47
|
-
console.log("\
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
rb2b: {
|
|
51
|
-
command: "npx",
|
|
52
|
-
args: ["@rb2b/rb2b-apis-mcp"],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
}, null, 2));
|
|
98
|
+
console.log("\nRegistering with MCP clients...");
|
|
99
|
+
registerClaudeCode();
|
|
100
|
+
registerClaudeDesktop();
|
|
56
101
|
}
|
|
57
102
|
catch (err) {
|
|
58
103
|
const message = err instanceof Error ? err.message : String(err);
|