@rb2b/rb2b-apis-mcp 1.1.2 → 1.1.4

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.
Files changed (3) hide show
  1. package/README.md +26 -14
  2. package/dist/init.js +53 -9
  3. 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. Initialize
19
+ ### 1. Install Claude Desktop or Claude Code
19
20
 
20
- Run the setup wizard to configure your API key:
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
- npx @rb2b/rb2b-apis-mcp init
29
+ npx -y @rb2b/rb2b-apis-mcp init
24
30
  ```
25
31
 
26
- This will prompt for your RB2B API key, validate it against the API, and store it securely in `~/.rb2b/config.json` (permissions: `600`).
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.
27
38
 
28
- ### 2. Add to Claude Desktop
39
+ ### Manual registration (if needed)
29
40
 
30
- Edit your Claude Desktop config file:
41
+ If auto-registration didn't run or you're using a different MCP client:
42
+
43
+ **Claude Code:**
44
+ ```bash
45
+ claude mcp add rb2b -- npx -y @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`
@@ -37,7 +55,7 @@ Edit your Claude Desktop config file:
37
55
  "mcpServers": {
38
56
  "rb2b": {
39
57
  "command": "npx",
40
- "args": ["@rb2b/rb2b-apis-mcp"]
58
+ "args": ["-y", "@rb2b/rb2b-apis-mcp"]
41
59
  }
42
60
  }
43
61
  }
@@ -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
@@ -124,7 +136,7 @@ The API key is stored at `~/.rb2b/config.json` with permissions `600` (owner rea
124
136
  **To update your API key**, use any of these methods:
125
137
 
126
138
  - **From Claude:** ask Claude to use the `set_api_key` tool — it validates the key before saving and takes effect immediately, no restart needed
127
- - **From the terminal:** run `npx @rb2b/rb2b-apis-mcp init` — detects an existing key and prompts for a replacement
139
+ - **From the terminal:** run `npx -y @rb2b/rb2b-apis-mcp init` — detects an existing key and prompts for a replacement
128
140
 
129
141
  ---
130
142
 
package/dist/init.js CHANGED
@@ -1,10 +1,60 @@
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
+ // Remove any existing registration so we always register with correct flags.
18
+ if (check.stdout?.includes("rb2b")) {
19
+ spawnSync("claude", ["mcp", "remove", "rb2b"], { encoding: "utf-8" });
20
+ }
21
+ const result = spawnSync("claude", ["mcp", "add", "rb2b", "--", "npx", "-y", "@rb2b/rb2b-apis-mcp"], { encoding: "utf-8" });
22
+ if (result.error || result.status !== 0) {
23
+ console.log("Claude Code: could not auto-register. Run manually:");
24
+ console.log(" claude mcp add rb2b -- npx -y @rb2b/rb2b-apis-mcp");
25
+ }
26
+ else {
27
+ console.log("Claude Code: registered successfully.");
28
+ }
29
+ }
30
+ function registerClaudeDesktop() {
31
+ const configPath = platform() === "win32"
32
+ ? join(process.env.APPDATA ?? homedir(), "Claude", "claude_desktop_config.json")
33
+ : join(homedir(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
34
+ if (!existsSync(configPath))
35
+ return;
36
+ let config = {};
37
+ try {
38
+ config = JSON.parse(readFileSync(configPath, "utf-8"));
39
+ }
40
+ catch {
41
+ return;
42
+ }
43
+ const mcpServers = (config.mcpServers ?? {});
44
+ if (mcpServers.rb2b) {
45
+ console.log("Claude Desktop: already registered.");
46
+ return;
47
+ }
48
+ mcpServers.rb2b = { command: "npx", args: ["-y", "@rb2b/rb2b-apis-mcp"] };
49
+ config.mcpServers = mcpServers;
50
+ try {
51
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
52
+ console.log("Claude Desktop: registered successfully. Restart Claude Desktop to apply.");
53
+ }
54
+ catch {
55
+ console.log("Claude Desktop: could not auto-register. Add manually to:", configPath);
56
+ }
57
+ }
8
58
  async function main() {
9
59
  const existing = loadConfig();
10
60
  if (existing) {
@@ -44,15 +94,9 @@ async function main() {
44
94
  console.log("Credits info:", JSON.stringify(data, null, 2));
45
95
  saveConfig({ apiKey });
46
96
  console.log("\nConfiguration saved to ~/.rb2b/config.json");
47
- console.log("\nYou can now add the MCP server to your Claude config:\n");
48
- console.log(JSON.stringify({
49
- mcpServers: {
50
- rb2b: {
51
- command: "npx",
52
- args: ["@rb2b/rb2b-apis-mcp"],
53
- },
54
- },
55
- }, null, 2));
97
+ console.log("\nRegistering with MCP clients...");
98
+ registerClaudeCode();
99
+ registerClaudeDesktop();
56
100
  }
57
101
  catch (err) {
58
102
  const message = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rb2b/rb2b-apis-mcp",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "MCP server exposing RB2B API tools for identity resolution and enrichment",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",