@leadbay/mcp 0.16.2 → 0.17.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog — @leadbay/mcp
2
2
 
3
+ ## 0.17.1 — 2026-06-01
4
+
5
+ - **Publish fix**: the `installer` npm bin (`npx -y -p @leadbay/mcp@latest installer`) was missing from the 0.17.0 tarball because the package was published before the installer wizard merged. This patch re-publishes with the correct bin entries.
6
+
7
+ ## 0.17.0 — 2026-05-29
8
+
9
+ - **Lens extension** (product#3654): two new composites that expose the
10
+ backend's agent-driven on-demand lens fill (backend#1844 / api-specs#205).
11
+ - `leadbay_extend_lens` (write, gated by `LEADBAY_MCP_WRITE=1`) —
12
+ `POST /lenses/{id}/extra_refill`. Translates the backend's 429
13
+ `quota_exceeded` / 409 `refresh_in_progress` / 400 `no_valid_seeds`
14
+ errors into routable `status` envelopes. On 429 the response carries
15
+ `quota.used_today` + `quota.resets_at` and a message instructing the
16
+ agent to surface three options to the user (smaller `extra_count` /
17
+ wait for reset / upgrade plan).
18
+ - `leadbay_seed_candidates` (read) — internal scaffolding for the
19
+ extend flow. Returns ranked candidate leads with rich signal
20
+ (description, sector, tags, qq_answers, engagement). The agent picks
21
+ 3–5 seeds silently and chains to `extend_lens`; the user never
22
+ reviews the seed list.
23
+ - New prompt `leadbay_extend_my_lens` orchestrates the four-phase flow:
24
+ quota pre-check → silent seed pick → fire extend → react to status.
25
+ - `leadbay_account_status` description now mentions the per-org daily
26
+ `LENS_EXTRA_REFILL` quota — pre-check it before calling
27
+ `leadbay_extend_lens`.
28
+
3
29
  ## 0.16.2 — 2026-05-29
4
30
 
5
31
  - **Tighter `_triggered_by` description on composite tools.** Live test of
@@ -27,8 +53,16 @@
27
53
  the 60-70% null rate the optional-everywhere `triggered_by` field
28
54
  carries on `mcp tool called`.
29
55
 
30
- ## 0.16.0 — 2026-05-28
56
+ ## 0.16.0 — 2026-05-29
31
57
 
58
+ - **Guided installer wizard**: Electron GUI (browser fallback) for install and uninstall. Detects Claude Code, Claude Desktop, Cursor, Codex, and ChatGPT Desktop automatically. OAuth sign-in built in — no token copy-paste.
59
+ - **Hosted MCP server**: Hono HTTP server at `https://leadbay-mcp-prod.fly.dev/mcp` for ChatGPT Desktop and other remote-MCP clients. Supports Streamable HTTP (`POST /mcp`) and legacy SSE (`GET /sse`, `POST /messages`).
60
+ - **Installer logic reorganised**: all install/uninstall logic moved from `src/bin.ts` into dedicated files under `installer/` (`install-claude-code.ts`, `install-json-config.ts`, `install-codex.ts`, `install-dxt.ts`, `install-wizard.ts`). `bin.ts` is now a thin MCP server entrypoint.
61
+ - **DXT extension removal**: when Claude Desktop 2026 DXT markers are detected, the installer removes the Leadbay DXT bundle (`Claude Extensions/local.dxt.leadbay.leadbay/` + registry entry) and writes `claude_desktop_config.json` as the authoritative config source.
62
+ - **macOS path fix**: `DetectedClient` now carries a `configPath` field; dropped the `detail.split(" ")[0]` pattern that truncated paths containing spaces (e.g. `~/Library/Application Support/Claude/...`).
63
+ - **SSE double-write fix**: `/sse` and `/messages` now return the `x-hono-already-sent` sentinel so Hono's Node adapter does not attempt a second header write after `SSEServerTransport` has already written headers.
64
+ - **Browser fallback uninstall fix**: `runBrowserFallback()` now opens the uninstaller GUI when `--uninstall` is passed, matching the Electron main process.
65
+ - **`@latest` pin**: all generated client configs now use `npx -y @leadbay/mcp@latest` instead of a hardcoded minor version.
32
66
  - **OAuth login** (`leadbay-mcp login --oauth`): browser-based Authorization
33
67
  Code + PKCE flow with Dynamic Client Registration (RFC 7591). No password
34
68
  ever touches the CLI. The resulting `o.<token>` is interchangeable with the
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <!--
6
6
  LLM HINT — if you're an AI agent reading this README to install the server:
7
7
  - Use ONLY the commands shown verbatim in §1. Do not invent variants.
8
- - For the legacy email/password install, DO NOT tell the user
8
+ - Prefer OAuth install paths. For the legacy email/password install, DO NOT tell the user
9
9
  "LEADBAY_REGION is auto-detected, drop it" — the
10
10
  server's region auto-probe sends the bearer token to BOTH regions, which
11
11
  is a credential cross-leak. Always pass --region (us or fr) on that path.
@@ -20,9 +20,7 @@ LLM HINT — if you're an AI agent reading this README to install the server:
20
20
 
21
21
  A Model Context Protocol server that lets Claude Desktop, Cursor, Claude Code, and any other MCP-compatible agent find, research, and prepare outreach on B2B prospects using your Leadbay account.
22
22
 
23
- > **0.6.x what's new**: a comprehensive MCP-spec coverage upgrade. Every tool now declares **annotations** (`readOnlyHint`/`destructiveHint`/`idempotentHint`/`openWorldHint`) so capable clients pick the right confirmation UX. The 5 highest-traffic composites ship **`outputSchema` + `structuredContent`** for typed agent consumption. New surfaces: **`prompts/*`** (5 canned slash-commands), **`resources/*`** (`lead://`, `lens://`, `org://taste-profile`), **`notifications/progress`** (per-lead streaming during `bulk_qualify_leads`), **`notifications/cancelled` → `ToolContext.signal`** (client cancels actually stop polling), **`elicitation/create`** (server can ask the user directly). Schema strictness: every `inputSchema` now declares `additionalProperties: false`. `research_lead.qualification[]` ships `boost_score` (canonical) + `score_scale: "-10|0|10|20"` + a deprecated `score_0_to_10` alias. Pagination payloads include `has_more` + `next_page`. `research_lead` includes a `truncated` + `truncation_hint` budget guard. **Behavior callout**: extra unknown fields in tool inputs are now rejected. See [MIGRATION.md](./MIGRATION.md).
24
-
25
- > **0.3.0 behavior change** — composite write tools (`refine_prompt`, `report_outreach`, `adjust_audience`, `bulk_qualify_leads`, `enrich_titles`, `answer_clarification`, `import_leads`) are **ON by default**. Set `LEADBAY_MCP_WRITE=0` (or `--no-write` on `install`) to restore the previous read-only behavior. `leadbay-mcp install` now also registers Claude Code at `--scope user` so Leadbay is visible from any project. See [MIGRATION.md](./MIGRATION.md).
23
+ > **Upgrading?** See [CHANGELOG](../../CHANGELOG.md) and [MIGRATION.md](./MIGRATION.md) for version-specific behavior changes. Key callout: composite write tools are **ON by default** since 0.3.0 set `LEADBAY_MCP_WRITE=0` to restore read-only behavior.
26
24
 
27
25
  ## Agent memory
28
26
 
@@ -45,25 +43,78 @@ The main leads-touching tools (`leadbay_account_status`,
45
43
  `_meta.agent_memory.summary` automatically. Set `LEADBAY_AGENT_MEMORY=off`
46
44
  to suppress this ambient metadata.
47
45
 
48
- ## 1. Install (one command)
46
+ ## 1. Install
47
+
48
+ On macOS and Windows, launch the guided Electron installer from the npm package:
49
+
50
+ ```bash
51
+ npx -y -p @leadbay/mcp@latest installer
52
+ ```
53
+
54
+ It downloads the npm package, opens the installer app, signs in with Leadbay OAuth in your browser, detects installed MCP clients, then installs the selected ones.
55
+
56
+ On Linux, use the terminal-only path instead (no desktop installer window):
57
+
58
+ ```bash
59
+ npx -y @leadbay/mcp@latest install --oauth
60
+ ```
61
+
62
+ From a repo checkout, run the same native installer with:
63
+
64
+ ```bash
65
+ pnpm --filter @leadbay/mcp installer
66
+ ```
67
+
68
+ ```bash
69
+ pnpm --filter @leadbay/mcp installer -- --uninstall
70
+ ```
71
+
72
+ ### Testing a local build
73
+
74
+ Add `--local` to install your current checkout instead of pulling from npm. Useful when developing the MCP and wanting to test changes in Claude Desktop or Claude Code without publishing.
75
+
76
+ ```bash
77
+ # 1. Build
78
+ pnpm --filter @leadbay/mcp build
79
+
80
+ # 2a. GUI wizard — same OAuth flow, writes node dist/bin.js into client configs
81
+ pnpm --filter @leadbay/mcp installer -- --local
82
+
83
+ # 2b. Terminal-only
84
+ node packages/mcp/dist/bin.js install --oauth --local
85
+
86
+ # 2c. Explicit path (if running from a different directory)
87
+ node packages/mcp/dist/bin.js install --oauth --local=/abs/path/to/packages/mcp/dist/bin.js
88
+ ```
89
+
90
+ Instead of `npx -y @leadbay/mcp@latest`, each client config gets `node /absolute/path/to/dist/bin.js`. After each rebuild the next MCP session picks up your changes automatically — no reinstall needed.
91
+
92
+ For terminal-only installs (works on macOS, Windows, and Linux):
49
93
 
50
94
  ```bash
51
- npx -y @leadbay/mcp@0.16 install --email you@yourcompany.com --region us
52
- # (you'll be prompted for your password — it's not echoed)
95
+ npx -y @leadbay/mcp@latest install --oauth
53
96
  ```
54
97
 
55
- That's it. The command:
98
+ To uninstall with the same guided app:
56
99
 
57
- 1. Asks for your password (hidden input).
58
- 2. Mints a bearer token via the Leadbay backend you specified.
59
- 3. Auto-detects which MCP clients you have installed (Claude Code, Claude Desktop, Cursor) and registers the server in each (after asking you per-target). Claude Code is registered with `--scope user` so the server appears in any project, not just where you ran the command.
60
- 4. The token is written into the client config files — **never to your terminal scrollback**.
100
+ ```bash
101
+ npx -y -p @leadbay/mcp@latest installer --uninstall
102
+ ```
103
+
104
+ Only shows clients that already have Leadbay MCP configured.
105
+
106
+ These commands:
107
+
108
+ 1. Open Leadbay OAuth in your browser.
109
+ 2. Exchange the browser approval for a local MCP credential.
110
+ 3. Auto-detect which MCP clients you have installed (Claude Code, Claude Desktop, Cursor, Codex) and register the server in each (after asking you per-target). Claude Code is registered with `--scope user` so the server appears in any project, not just where you ran the command.
111
+ 4. Write the credential into the client config files — **never to your terminal scrollback**.
61
112
 
62
113
  Add `--no-write` to disable the composite write tools (`refine_prompt`, `report_outreach`, `adjust_audience`, etc. — ON by default since 0.3.0; pass `--no-write` for a read-only agent). Add `--yes` for non-interactive runs (CI / scripts). Add `--target claude-code,cursor` to scope to specific clients. The legacy `--include-write` flag is accepted but is now a no-op.
63
114
 
64
- `--region us|fr` is required by default — it pins which Leadbay backend gets your password and avoids a silent cross-region credential leak. If you really don't know your region, opt in with `--allow-region-fallback` (your password will hit BOTH backends if the first 401s).
115
+ OAuth auto-detects your region through stargate. Pass `--region us|fr` only if you need to override it.
65
116
 
66
- The token is **session-scoped** (full account access, password-equivalent). Treat it like your password. To rotate, re-run `npx -y @leadbay/mcp install` — minting a fresh token invalidates the prior session.
117
+ To rotate the local MCP credential, re-run `npx -y @leadbay/mcp install --oauth`.
67
118
 
68
119
  **Don't have a Leadbay account?** [Register here](https://wow.leadbay.ai/?register=true).
69
120
 
@@ -71,10 +122,13 @@ The token is **session-scoped** (full account access, password-equivalent). Trea
71
122
 
72
123
  ```text
73
124
  /plugin marketplace add leadbay/leadclaw
125
+ ```
126
+
127
+ ```text
74
128
  /plugin install leadbay@leadbay-leadclaw
75
129
  ```
76
130
 
77
- Claude Code prompts for your token and region through the plugin's `userConfig`. This is equivalent to the npm/CLI install above; users who already ran `leadbay-mcp login` can reuse that token.
131
+ Claude Code prompts for Leadbay auth/config through the plugin's `userConfig`. This is equivalent to the npm/CLI install above.
78
132
 
79
133
  The plugin install gives you **two surfaces in one shot**:
80
134
 
@@ -83,11 +137,11 @@ The plugin install gives you **two surfaces in one shot**:
83
137
 
84
138
  You can verify the skills installed by running `/skill list` after install. To uninstall everything, `/plugin uninstall leadbay@leadbay-leadclaw` removes the MCP server registration **and** the skills together.
85
139
 
86
- ### Claude Desktop 2026 (DXT)
140
+ ### Claude Desktop
87
141
 
88
- Claude Desktop 2026 ships the DXT (Desktop Extension) system — the legacy `claude_desktop_config.json` is UI-prefs-only there and gets overwritten by the app. If you're on 2026, **install the `.dxt` / `.mcpb` bundle** from [Releases](https://github.com/leadbay/leadclaw/releases/latest) (drag-drop into Settings → Extensions). On first launch, the extension opens Leadbay in your browser for OAuth consent, auto-detects your region through stargate, then persists the resulting token locally. The extension settings only ask whether write tools should be enabled.
142
+ The guided installer writes the local `mcpServers.leadbay` entry in `claude_desktop_config.json` with `npx -y @leadbay/mcp@0.16`, like the Linux flow. Restart Claude Desktop after install.
89
143
 
90
- `leadbay-mcp install` detects Claude Desktop 2026 and skips the legacy config write automatically.
144
+ The `.dxt` / `.mcpb` bundle from [Releases](https://github.com/leadbay/leadclaw/releases/latest) remains available as an alternative install path.
91
145
 
92
146
  ### `npm install -g` says "EACCES" / "permission denied"
93
147
 
@@ -97,17 +151,77 @@ If you installed Node from the official [nodejs.org](https://nodejs.org) `.pkg`,
97
151
  - **`sudo npm install -g @leadbay/mcp`** (enter your macOS password).
98
152
  - **Use a Node version manager** — [nvm](https://github.com/nvm-sh/nvm), [volta](https://volta.sh), [fnm](https://github.com/Schniz/fnm). They install Node under your home directory, so `npm install -g` works without sudo.
99
153
 
100
- ### If you'd rather mint a token without auto-install
154
+ ### If you'd rather authenticate without auto-install
155
+
156
+ ```bash
157
+ npx -y @leadbay/mcp@0.16 login --oauth
158
+ ```
159
+
160
+ Default writes a `0600`-mode JSON file at the platform-correct credentials path (`$XDG_CONFIG_HOME/leadbay/credentials.json` on Linux, `~/Library/Application Support/leadbay/credentials.json` on macOS, `%APPDATA%\leadbay\credentials.json` on Windows). Pass `--write-config /some/path.json` to override the path. Pass `--force` to overwrite an existing file from a different account. The legacy email/password path still exists for scripts that cannot use a browser.
161
+
162
+ ## 2. Updating the hosted MCP
163
+
164
+ The hosted MCP at `https://leadbay-mcp-prod.fly.dev/mcp` can be updated in two ways.
165
+
166
+ ### Deploy from this repo
167
+
168
+ Use this when you want Fly to run the exact code in the current checkout or after merging to `main`:
101
169
 
102
170
  ```bash
103
- npx -y @leadbay/mcp@0.16 login \
104
- --email you@yourcompany.com \
105
- --region us
171
+ fly deploy --app leadbay-mcp-prod
106
172
  ```
107
173
 
108
- Default writes a `0600`-mode JSON file at the platform-correct credentials path (`$XDG_CONFIG_HOME/leadbay/credentials.json` on Linux, `~/Library/Application Support/leadbay/credentials.json` on macOS, `%APPDATA%\leadbay\credentials.json` on Windows). Pass `--write-config /some/path.json` to override the path. Pass `--unsafe-print-token` for legacy CI flows that scrape stdout (the token will end up in scrollback / logs — only use this if you have to). Pass `--force` to overwrite an existing file from a different account.
174
+ ```bash
175
+ curl https://leadbay-mcp-prod.fly.dev/healthz
176
+ ```
177
+
178
+ This is the current production path. Fly builds the repo `Dockerfile`, bundles `packages/mcp`, and starts `node dist/http-server.js`.
179
+
180
+ ### Deploy from a published npm package
181
+
182
+ Use this when you want the remote MCP to run a package that has already been published to npm. Prefer pinning an exact version so production deploys are reproducible:
183
+
184
+ ```dockerfile
185
+ FROM node:22-slim
186
+
187
+ WORKDIR /app
188
+ RUN npm install -g @leadbay/mcp@0.15.0
189
+
190
+ ENV NODE_ENV=production
191
+ ENV PORT=8080
192
+ EXPOSE 8080
193
+
194
+ CMD ["leadbay-mcp-http"]
195
+ ```
196
+
197
+ Then point Fly at that Dockerfile and deploy:
198
+
199
+ ```toml
200
+ [build]
201
+ dockerfile = 'Dockerfile.npm'
202
+ ```
203
+
204
+ ```bash
205
+ fly deploy --app leadbay-mcp-prod
206
+ ```
207
+
208
+ ```bash
209
+ curl https://leadbay-mcp-prod.fly.dev/healthz
210
+ ```
211
+
212
+ Avoid `@latest` for production unless you intentionally want Fly deploys to pick up whatever version npm currently marks as latest:
213
+
214
+ ```dockerfile
215
+ RUN npm install -g @leadbay/mcp@latest
216
+ ```
109
217
 
110
- ## 2. Quickstart
218
+ That is convenient for quick tests, but less safe for production because the deployed version is no longer visible from a repo diff.
219
+
220
+ ## 3. Quickstart
221
+
222
+ Prefer the installer in [§1](#1-install). If you need to hand-write config,
223
+ first authenticate with `npx -y @leadbay/mcp@0.16 login --oauth`, then copy the
224
+ `LEADBAY_TOKEN` and `LEADBAY_REGION` values from the credentials file it writes.
111
225
 
112
226
  ### Claude Desktop
113
227
 
@@ -120,7 +234,7 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) o
120
234
  "command": "npx",
121
235
  "args": ["-y", "@leadbay/mcp@0.16"],
122
236
  "env": {
123
- "LEADBAY_TOKEN": "<paste-token-from-step-1>",
237
+ "LEADBAY_TOKEN": "<paste-oauth-token>",
124
238
  "LEADBAY_REGION": "us"
125
239
  }
126
240
  }
@@ -140,7 +254,7 @@ In Cursor settings, add the MCP server:
140
254
  "leadbay": {
141
255
  "command": "npx",
142
256
  "args": ["-y", "@leadbay/mcp@0.16"],
143
- "env": { "LEADBAY_TOKEN": "<paste-token>", "LEADBAY_REGION": "us" }
257
+ "env": { "LEADBAY_TOKEN": "<paste-oauth-token>", "LEADBAY_REGION": "us" }
144
258
  }
145
259
  }
146
260
  }
@@ -150,7 +264,7 @@ In Cursor settings, add the MCP server:
150
264
 
151
265
  ```bash
152
266
  claude mcp add leadbay --scope user \
153
- --env LEADBAY_TOKEN=<paste-token> \
267
+ --env LEADBAY_TOKEN=<paste-oauth-token> \
154
268
  --env LEADBAY_REGION=us \
155
269
  -- npx -y @leadbay/mcp@0.16
156
270
  ```
@@ -164,7 +278,7 @@ claude mcp add leadbay --scope user \
164
278
  Before starting Claude, run:
165
279
 
166
280
  ```bash
167
- LEADBAY_TOKEN=<paste-token> npx -y @leadbay/mcp@0.16 doctor
281
+ LEADBAY_TOKEN=<paste-oauth-token> npx -y @leadbay/mcp@0.16 doctor
168
282
  ```
169
283
 
170
284
  Expected output:
@@ -176,7 +290,23 @@ Leadbay connection OK.
176
290
  AI credits: 420 / 1000
177
291
  ```
178
292
 
179
- ## 3. Example prompts that work
293
+ ### ChatGPT Desktop / remote-MCP clients
294
+
295
+ Leadbay runs a hosted MCP server that any remote-MCP client can connect to without a local install:
296
+
297
+ ```
298
+ https://leadbay-mcp-prod.fly.dev/mcp
299
+ ```
300
+
301
+ **ChatGPT Desktop**: open Settings → Apps → Add app → paste the URL above.
302
+
303
+ The server authenticates each request from the `Authorization: Bearer <token>` header your client sends automatically once you sign in via ChatGPT's OAuth prompt. No token to copy-paste, no local Node install needed.
304
+
305
+ **Updates are automatic** — the hosted server is always running the latest published release. You never need to update a config file or restart anything on your side.
306
+
307
+ If your client requires a region header, add `X-Leadbay-Region: us` or `X-Leadbay-Region: fr` to match your Leadbay account's region.
308
+
309
+ ## 4. Example prompts that work
180
310
 
181
311
  > *Find me 20 SaaS companies in Berlin that match my Ideal Buyer Profile.*
182
312
 
@@ -184,7 +314,7 @@ Leadbay connection OK.
184
314
 
185
315
  > *Prepare an outreach package for Acme Corp — include the recommended contact with enriched email if we have credits.*
186
316
 
187
- ## 3a. Spec primitives in action
317
+ ## 5. Spec primitives in action
188
318
 
189
319
  > If you're building or auditing an MCP integration, this section shows what each spec primitive looks like on the wire when calling `@leadbay/mcp`. Every example is the actual JSON-RPC frame your client sends or receives — copy verbatim into a debugger.
190
320
 
@@ -382,12 +512,12 @@ Client returns:
382
512
 
383
513
  The user's literal text replaces `verification.ref` in the outreach record, and the response carries `confirmed_via: "elicit"` for the SDR audit trail.
384
514
 
385
- ## 4. Troubleshooting
515
+ ## 6. Troubleshooting
386
516
 
387
517
  | Problem | Cause | Fix |
388
518
  |---------|-------|-----|
389
- | `LEADBAY_TOKEN environment variable is required` | Token missing from config env | Add `LEADBAY_TOKEN` to the `env` block, restart client |
390
- | `Authentication token expired or invalid` | Token revoked or wrong region | Re-mint a token: `npx -y @leadbay/mcp install --email <you> --region <us\|fr>`; verify `LEADBAY_REGION` |
519
+ | `LEADBAY_TOKEN environment variable is required` | Local MCP credential missing from config env | Re-run `npx -y @leadbay/mcp install --oauth`, restart client |
520
+ | `Authentication token expired or invalid` | Credential revoked or wrong region | Re-authenticate: `npx -y @leadbay/mcp install --oauth`; verify `LEADBAY_REGION` |
391
521
  | `Leadbay doctor: could not reach any Leadbay region` | Wrong region OR network blocked | Run `doctor` with `LEADBAY_REGION=fr` to auto-probe. Check `https://api-us.leadbay.app` reachable. |
392
522
  | `No enrichment credits remaining` | Out of quota | Contact Leadbay support to extend quota |
393
523
  | Claude Desktop "loading forever" on first use | `npx` cold-start fetching the package | First run takes ~10s. Prefer `npm install -g @leadbay/mcp` for faster startup. |
@@ -395,17 +525,17 @@ The user's literal text replaces `verification.ref` in the outreach record, and
395
525
  | Claude Code can't find Leadbay in a new conversation | MCP server installed at project scope (default before 0.3.0) | Re-run with `--scope user`: `claude mcp remove leadbay && claude mcp add leadbay --scope user --env LEADBAY_TOKEN=… --env LEADBAY_REGION=us -- npx -y @leadbay/mcp@0.16` |
396
526
  | Agent reports "tool not found" for `refine_prompt` / `adjust_audience` etc. | Pre-0.3.0 install with `LEADBAY_MCP_WRITE` unset (writes were off) | Either re-run `npx @leadbay/mcp install` or remove `LEADBAY_MCP_WRITE=0` from your client config (writes are on by default in 0.3.0+) |
397
527
 
398
- ## 5. Upgrade & rotation
528
+ ## 7. Upgrade & rotation
399
529
 
400
530
  **Upgrade**: change the pinned minor in your config, e.g. `"@leadbay/mcp@0.2"` → `"@leadbay/mcp@0.16"`, then restart the client. **0.3.0 enables composite write tools by default** — see [MIGRATION.md](./MIGRATION.md). See also the [changelog](https://github.com/leadbay/leadclaw/releases).
401
531
 
402
- **Rotate token**: re-run `npx -y @leadbay/mcp@0.16 install --email you@yourcompany.com --region us` (or `login`) — the new session token replaces the old one in your MCP client config, and logging in again invalidates the prior session on most session backends.
532
+ **Rotate local credential**: re-run `npx -y @leadbay/mcp@0.16 install --oauth` (or `login --oauth`) — the new credential replaces the old one in your MCP client config.
403
533
 
404
- ## 6. Advanced
534
+ ## 8. Advanced
405
535
 
406
- ### OAuth login (preview)
536
+ ### OAuth login
407
537
 
408
- Browser-based login is available as an alternative to email/password:
538
+ Browser-based login is the recommended auth path:
409
539
 
410
540
  ```bash
411
541
  npx -y @leadbay/mcp login --oauth
@@ -464,21 +594,24 @@ To unlock the **granular API tools** (`leadbay_list_lenses`, `leadbay_discover_l
464
594
 
465
595
  `leadbay_import_leads` is a **write tool** (exposed by default since 0.3.0; set `LEADBAY_MCP_WRITE=0` to hide it) for the case where you have a list of company domains from another system (CRM, analytics, email correspondents, etc.) and want stable Leadbay `leadId`s to chain into qualification:
466
596
 
597
+ Set up your environment:
598
+
467
599
  ```bash
468
- # 1. Set up
469
600
  export LEADBAY_TOKEN="<your-token>"
470
- export LEADBAY_REGION="us"
471
- # LEADBAY_MCP_WRITE defaults to "1" (ON) since 0.3.0 — no need to set it.
601
+ ```
472
602
 
473
- # 2. Wire in your MCP client per §2 above. Then ask the agent:
474
- # "Import these domains: apple.com, microsoft.com, salesforce.com.
475
- # Then qualify the matched leads."
476
- #
477
- # The agent calls leadbay_import_leads({ domains: [...] }), gets back
478
- # { leads: [{domain, leadId, name}], not_imported: [{domain, reason}], importIds, _meta },
479
- # then chains leads.map(l => l.leadId) into leadbay_bulk_qualify_leads.
603
+ ```bash
604
+ export LEADBAY_REGION="us"
480
605
  ```
481
606
 
607
+ (`LEADBAY_MCP_WRITE` defaults to `"1"` (ON) since 0.3.0 — no need to set it.)
608
+
609
+ Then wire in your MCP client per [§2](#2-updating-the-hosted-mcp) and ask the agent:
610
+
611
+ > "Import these domains: apple.com, microsoft.com, salesforce.com. Then qualify the matched leads."
612
+
613
+ The agent calls `leadbay_import_leads({ domains: [...] })`, gets back `{ leads: [{domain, leadId, name}], not_imported: [{domain, reason}], importIds, _meta }`, then chains `leads.map(l => l.leadId)` into `leadbay_bulk_qualify_leads`.
614
+
482
615
  **⚠️ Writes user state.** Internally wraps Leadbay's CRM-import wizard (the only domain-import primitive the backend ships today). Each call:
483
616
 
484
617
  - creates a row in your CRM-imports list (visible in the web UI)
@@ -512,15 +645,15 @@ Use `dry_run: true` to validate domain formatting and wizard reachability withou
512
645
  | `LEADBAY_MOCK` | no | unset | `"1"` serves all reads from on-disk fixtures (dev only) |
513
646
  | `LEADBAY_MOCK_DIR` | no | `./.context/leadbay-live-shapes/` | Fixture dir for mock mode |
514
647
  | `LEADBAY_LOG_LEVEL` | no | `error` | `debug` \| `info` \| `error`, logs to stderr |
648
+ | `LEADBAY_TIMEOUT_MS` | no | (client default) | Per-request timeout override |
515
649
 
516
650
  > ⚠️ **Set `LEADBAY_REGION` explicitly.** If you don't, the server probes BOTH `api-us.leadbay.app` and `api-fr.leadbay.app` in parallel with your bearer token attached, sending the token to a backend that doesn't own your account. The `install` and `login` subcommands enforce `--region` for exactly this reason; the runtime auto-probe is a backwards-compat fallback, not a recommended setting.
517
- | `LEADBAY_TIMEOUT_MS` | no | (client default) | Per-request timeout override |
518
651
 
519
652
  ### Security
520
653
 
521
654
  - Tokens live only in your MCP client's config file — they never traverse the network except to `api-{region}.leadbay.app`.
522
655
  - The `leadbay_login` tool from the OpenClaw adapter is **not** registered on MCP: exposing a credential-taking tool to an LLM is a prompt-injection risk. Use the token path above.
523
- - The `leadbay_add_note` and `leadbay_enrich_contacts` tools are write actions flagged `optional: true`. If your client supports per-tool opt-in, leave them disabled until you need them.
656
+ - The `leadbay_add_note` tool is a write action flagged `optional: true`. If your client supports per-tool opt-in, leave it disabled until you need it. `leadbay_enrich_contacts` is a granular tool exposed only when `LEADBAY_MCP_ADVANCED=1`.
524
657
 
525
658
  ### Privacy & telemetry
526
659
 
@@ -566,7 +699,7 @@ Accepted values: `"true"|"1"|"yes"|"on"` enable; `"false"|"0"|"no"|"off"` disabl
566
699
 
567
700
  Contact data fetched through this server stays local to your MCP client session — telemetry never carries it. Requests to Leadbay are subject to the [Leadbay privacy policy](https://leadbay.ai/privacy).
568
701
 
569
- ## 7. For maintainers — publishing
702
+ ## 9. For maintainers — publishing
570
703
 
571
704
  Releases are tag-driven via `.github/workflows/release.yml`. Bump `packages/mcp/package.json#version`, update `packages/mcp/CHANGELOG.md`, land on `main`, then:
572
705