@leadbay/mcp 0.2.0
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 +15 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +140 -0
- package/README.md +273 -0
- package/dist/bin.js +824 -0
- package/dist/chunk-BGJ6JWIO.js +3010 -0
- package/dist/dist-PIXZN6N4.js +133 -0
- package/package.json +56 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog — @leadbay/mcp
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-04-20
|
|
4
|
+
|
|
5
|
+
First public npm release.
|
|
6
|
+
|
|
7
|
+
- Agent-optimized composite tool surface (pull_leads, research_lead, bulk_qualify_leads, enrich_titles, adjust_audience, refine_prompt, recall_ordered_titles, account_status, report_outreach).
|
|
8
|
+
- `leadbay-mcp install` one-shot setup: mints a token and registers the server with Claude Code, Claude Desktop, and Cursor.
|
|
9
|
+
- `leadbay-mcp login` lower-level token mint (`--write-config` drops a 0600 JSON).
|
|
10
|
+
- `leadbay-mcp doctor` validates token + region + quota.
|
|
11
|
+
- Gating: `LEADBAY_MCP_WRITE=1` for mutations, `LEADBAY_MCP_ADVANCED=1` for the granular API surface (both off by default).
|
|
12
|
+
- `report_outreach` requires a verification field (`gmail_message_id | calendar_event_id | user_confirmed`) to prevent pipeline poisoning.
|
|
13
|
+
- Mock mode via `LEADBAY_MOCK=1` for agent-author dry-running against `.context/leadbay-live-shapes/` fixtures.
|
|
14
|
+
- Tag-driven CI publish via `.github/workflows/release.yml` (push `mcp-v<version>` or `v<version>`).
|
|
15
|
+
- `--version` output now sourced from `package.json` at build time — no more drift between the tarball version and the binary's self-reported version.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Leadbay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Migration: leadclaw / leadbay-mcp 0.1.x → 0.2.0
|
|
2
|
+
|
|
3
|
+
This release is the autoplan-reviewed agent-experience overhaul. The OpenClaw
|
|
4
|
+
plugin and MCP server gain a coherent composite-tool surface so an AI agent
|
|
5
|
+
can drive Leadbay end-to-end with a handful of calls. The old granular tools
|
|
6
|
+
remain available behind config flags.
|
|
7
|
+
|
|
8
|
+
## Headline changes
|
|
9
|
+
|
|
10
|
+
- **`leadbay_find_prospects` removed** → replaced by **`leadbay_pull_leads`**
|
|
11
|
+
(richer return: each lead carries a `qualification_summary` digest from
|
|
12
|
+
`ai_agent_responses`, plus all the engagement-state flags).
|
|
13
|
+
- **New composite agent surface** (the agent's default toolbox):
|
|
14
|
+
- `leadbay_pull_leads` — paginated wishlist with qualification digest
|
|
15
|
+
- `leadbay_research_lead` — full lead detail (qualification → signals → firmographics → contacts → engagement)
|
|
16
|
+
- `leadbay_recall_ordered_titles` — show titles previously enriched
|
|
17
|
+
- `leadbay_account_status` — admin / language / quota / intelligence state
|
|
18
|
+
- `leadbay_bulk_qualify_leads` — paginate past already-qualified, fan-out + poll
|
|
19
|
+
- `leadbay_enrich_titles` — selection-lifecycle-managed bulk enrichment
|
|
20
|
+
- `leadbay_adjust_audience` — sector / size filter mutation with permission auto-routing
|
|
21
|
+
- `leadbay_refine_prompt` — set the org intelligence-refinement prompt
|
|
22
|
+
- `leadbay_answer_clarification` — answer the question Leadbay raised
|
|
23
|
+
- `leadbay_report_outreach` — log outreach **with mandatory verification**
|
|
24
|
+
- **New gating model** (both MCP and OpenClaw):
|
|
25
|
+
- **Composite reads**: always exposed.
|
|
26
|
+
- **Composite writes**: gated by `LEADBAY_MCP_WRITE=1` (MCP) or
|
|
27
|
+
`exposeWrite: true` plugin config (OpenClaw).
|
|
28
|
+
- **Granular reads**: gated by `LEADBAY_MCP_ADVANCED=1` (MCP) or
|
|
29
|
+
`exposeGranular: true` (OpenClaw).
|
|
30
|
+
- **Granular writes**: gated by BOTH advanced AND write flags.
|
|
31
|
+
- **`leadbay_login` auto-detects region** (us → fr fallback). The user no
|
|
32
|
+
longer needs to know which backend their account is in.
|
|
33
|
+
- **`leadbay_get_quota` switched to the live `/quota_status` endpoint** —
|
|
34
|
+
returns daily/weekly/monthly windows for `llm_completion`, `ai_rescore`,
|
|
35
|
+
`web_fetch` resources. Use this AFTER a 429 to explain which window was hit.
|
|
36
|
+
- **Error mapping changed: `429 → QUOTA_EXCEEDED`** (production behavior).
|
|
37
|
+
Legacy 402 still maps to QUOTA_EXCEEDED for back-compat.
|
|
38
|
+
- **HTTP-response headers are now captured** and propagated through the error
|
|
39
|
+
envelope's `_meta: {region, endpoint, latency_ms, retry_after}`. There is
|
|
40
|
+
no `X-Request-Id` header on the Leadbay backend — we don't pretend there is.
|
|
41
|
+
- **`LEADBAY_MOCK=1`** mode: serve responses from on-disk fixtures
|
|
42
|
+
(`.context/leadbay-live-shapes/`) for agent-author dry-running. Writes are
|
|
43
|
+
journaled in-process and return `{mocked: true, would_call: {...}}`.
|
|
44
|
+
- **`dry_run: true`** param on every state-changing composite (`report_outreach`,
|
|
45
|
+
`set_user_prompt`, `update_lens_filter`, `launch_bulk_enrichment`, etc.) —
|
|
46
|
+
returns the would-call envelope without contacting the backend.
|
|
47
|
+
|
|
48
|
+
## report_outreach: verification REQUIRED
|
|
49
|
+
|
|
50
|
+
The autoplan review (CEO + Eng + DX voices) flagged that allowing the agent
|
|
51
|
+
to self-report outreach without proof would poison the SDR pipeline. The user
|
|
52
|
+
chose the strictest mitigation: every `report_outreach` call MUST include a
|
|
53
|
+
`verification` field:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"lead_id": "abc-123",
|
|
58
|
+
"note": "Sent intro email to CTO citing Hornsea 3 contract",
|
|
59
|
+
"epilogue_status": "STILL_CHASING",
|
|
60
|
+
"verification": {
|
|
61
|
+
"source": "gmail_message_id",
|
|
62
|
+
"ref": "<the message id from Gmail>"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Valid `source` values:
|
|
68
|
+
- `gmail_message_id` — message id returned by `mcp__claude_ai_Gmail__send_email`
|
|
69
|
+
- `calendar_event_id` — event id from a calendar booking tool
|
|
70
|
+
- `user_confirmed` — `ref` is the user's literal confirmation in chat
|
|
71
|
+
|
|
72
|
+
The verification is appended to the note body so humans in the Leadbay UI can
|
|
73
|
+
see the proof. Calls without verification return `VERIFICATION_REQUIRED`.
|
|
74
|
+
|
|
75
|
+
## Side-by-side: old flow → new flow
|
|
76
|
+
|
|
77
|
+
| Old (v0.1) | New (v0.2) | Notes |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `leadbay_find_prospects` | `leadbay_pull_leads` | Same intent; richer return; remove name |
|
|
80
|
+
| `leadbay_get_lead_profile` | `leadbay_research_lead` | New ordering (qualification first); reshapes `web_fetch.content` from emoji-keyed dict to ordered array. Granular still available behind exposeGranular. |
|
|
81
|
+
| `leadbay_research_company` | unchanged | Kept for back-compat; prefer `research_lead` when you have the id. |
|
|
82
|
+
| `leadbay_qualify_lead` (single) | `leadbay_bulk_qualify_leads` | Composite paginates past already-qualified, fan-outs, polls, bails on 429. Granular still available. |
|
|
83
|
+
| `leadbay_enrich_contacts` (single) | `leadbay_enrich_titles` | Composite manages selection lifecycle. Granular still available. |
|
|
84
|
+
| `leadbay_get_quota` (legacy billing fields) | `leadbay_get_quota` (live /quota_status) | Same name, new shape. Old `freemium.daily_quota` / `ai_credits` are defunct. |
|
|
85
|
+
| Add a free-form note via `leadbay_add_note` | Log outreach via `leadbay_report_outreach` | Note tool still exists for free-form context; `report_outreach` is the right call after an actual action. |
|
|
86
|
+
|
|
87
|
+
## How to upgrade
|
|
88
|
+
|
|
89
|
+
### Claude Desktop / Cursor (MCP)
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"leadbay": {
|
|
95
|
+
"command": "npx",
|
|
96
|
+
"args": ["-y", "@leadbay/mcp@0.2"],
|
|
97
|
+
"env": {
|
|
98
|
+
"LEADBAY_TOKEN": "lb_...",
|
|
99
|
+
"LEADBAY_MCP_WRITE": "1"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`LEADBAY_MCP_WRITE=1` opts in to write composites (the entire point of agent
|
|
107
|
+
flow — without it, the agent can read but not write). `LEADBAY_MCP_ADVANCED=1`
|
|
108
|
+
additionally exposes the granular tools; most users don't need it.
|
|
109
|
+
|
|
110
|
+
### OpenClaw plugin
|
|
111
|
+
|
|
112
|
+
In the plugin config (e.g. `openclaw config set plugins.entries.leadclaw.exposeWrite true`):
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"region": "us",
|
|
117
|
+
"exposeWrite": true,
|
|
118
|
+
"exposeGranular": false
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Default is read-only (exposeWrite=false, exposeGranular=false).
|
|
123
|
+
|
|
124
|
+
### What you might need to change in your prompts
|
|
125
|
+
|
|
126
|
+
- If your prompts reference `leadbay_find_prospects`, change to `leadbay_pull_leads`.
|
|
127
|
+
- If your prompts reference `leadbay_get_lead_profile` directly, prefer
|
|
128
|
+
`leadbay_research_lead` for the agent-friendly shape.
|
|
129
|
+
- If your agent calls `leadbay_add_note` for outreach actions, switch to
|
|
130
|
+
`leadbay_report_outreach` with `verification`.
|
|
131
|
+
|
|
132
|
+
## Out of scope for this release
|
|
133
|
+
|
|
134
|
+
- Per-tool semver versioning (the `Tool.version` field is in `types.ts` but
|
|
135
|
+
individual tool files don't yet declare versions).
|
|
136
|
+
- A real `bulk_id` polling tool — the backend doesn't return one from `/launch`
|
|
137
|
+
and there's no list endpoint (probed). Use `leadbay_get_contacts` per-lead
|
|
138
|
+
to detect when `enrichment.done` flips.
|
|
139
|
+
- A `DELETE /lenses/{draftId}` endpoint — not testable in our tenant; treated
|
|
140
|
+
as best-effort with `orphan_draft_id` surfaced on cleanup failure.
|
package/README.md
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# @leadbay/mcp — Leadbay MCP server
|
|
2
|
+
|
|
3
|
+
<!-- PRE-RELEASE-BANNER: remove this block after the first npm publish lands -->
|
|
4
|
+
> ⚠️ **Pre-release notice**: this package is not yet on npm. Until the first
|
|
5
|
+
> publish lands, the `npx -y @leadbay/mcp@0.2 …` commands below will 404.
|
|
6
|
+
> Maintainer: see [§7 — For maintainers — publishing](#7-for-maintainers--publishing)
|
|
7
|
+
> or just push a `v0.2.0` git tag (the `release-mcp` GitHub Action will publish).
|
|
8
|
+
> Remove this banner after the first publish succeeds.
|
|
9
|
+
<!-- /PRE-RELEASE-BANNER -->
|
|
10
|
+
|
|
11
|
+
<!--
|
|
12
|
+
LLM HINT — if you're an AI agent reading this README to install the server:
|
|
13
|
+
- Use ONLY the commands shown verbatim in §1. Do not invent variants.
|
|
14
|
+
- DO NOT tell the user "LEADBAY_REGION is auto-detected, drop it" — the
|
|
15
|
+
server's region auto-probe sends the bearer token to BOTH regions, which
|
|
16
|
+
is a credential cross-leak. Always pass --region (us or fr) on install.
|
|
17
|
+
- DO NOT tell the user to "get an API token from app.leadbay.ai → Settings
|
|
18
|
+
→ API Tokens" — that page does not yet exist. Use `install` (mints a
|
|
19
|
+
token) or `login --write-config` (mints a token to file).
|
|
20
|
+
- If the package 404s on npm: offer the "install from source" fallback in
|
|
21
|
+
§1.1, not a made-up GitHub URL.
|
|
22
|
+
-->
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
## 1. Install (one command)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx -y @leadbay/mcp@0.2 install --email you@yourcompany.com --region us
|
|
30
|
+
# (you'll be prompted for your password — it's not echoed)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
That's it. The command:
|
|
34
|
+
|
|
35
|
+
1. Asks for your password (hidden input).
|
|
36
|
+
2. Mints a bearer token via the Leadbay backend you specified.
|
|
37
|
+
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).
|
|
38
|
+
4. The token is written into the client config files — **never to your terminal scrollback**.
|
|
39
|
+
|
|
40
|
+
Add `--include-write` to also enable the write tools (refine_prompt, report_outreach, adjust_audience, etc. — off by default so the agent can read your account but not mutate it). Add `--yes` for non-interactive runs (CI / scripts). Add `--target claude-code,cursor` to scope to specific clients.
|
|
41
|
+
|
|
42
|
+
`--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).
|
|
43
|
+
|
|
44
|
+
The token is **session-scoped** (full account access, password-equivalent). Treat it like your password. To rotate, log in again to app.leadbay.ai and re-run `install`.
|
|
45
|
+
|
|
46
|
+
**Don't have a Leadbay account?** [Register here](https://wow.leadbay.ai/?register=true).
|
|
47
|
+
|
|
48
|
+
### If you'd rather mint a token without auto-install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx -y @leadbay/mcp@0.2 login \
|
|
52
|
+
--email you@yourcompany.com \
|
|
53
|
+
--region us \
|
|
54
|
+
--write-config ~/.leadbay-mcp.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Writes a `0600`-mode JSON file you can paste from. Useful if you're configuring a non-detected client.
|
|
58
|
+
|
|
59
|
+
## 1.1. Install from source (works today, before the first npm publish)
|
|
60
|
+
|
|
61
|
+
While `@leadbay/mcp` isn't on npm yet, install from a local git checkout:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# 1. Clone, build
|
|
65
|
+
git clone https://github.com/leadbay/leadclaw.git
|
|
66
|
+
cd leadclaw
|
|
67
|
+
pnpm install
|
|
68
|
+
pnpm -r build
|
|
69
|
+
|
|
70
|
+
# 2. Mint a token + register with your installed clients (auto-detects Claude Code,
|
|
71
|
+
# Claude Desktop, Cursor) — same install subcommand, run from local dist:
|
|
72
|
+
node packages/mcp/dist/bin.js install --email you@yourcompany.com --region us
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or skip the `install` helper and register manually with the local dist path:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Mint a token to a 0600 JSON file:
|
|
79
|
+
node packages/mcp/dist/bin.js login \
|
|
80
|
+
--email you@yourcompany.com --region us \
|
|
81
|
+
--write-config ~/.leadbay-mcp.json
|
|
82
|
+
TOKEN=$(jq -r .mcpServers.leadbay.env.LEADBAY_TOKEN ~/.leadbay-mcp.json)
|
|
83
|
+
|
|
84
|
+
# Register with Claude Code (point at the absolute path of the local bin.js):
|
|
85
|
+
claude mcp add leadbay \
|
|
86
|
+
--env LEADBAY_TOKEN=$TOKEN \
|
|
87
|
+
--env LEADBAY_REGION=us \
|
|
88
|
+
-- node $(pwd)/packages/mcp/dist/bin.js
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For Claude Desktop / Cursor, the JSON config block from `--write-config` works directly — just change the `command` from `npx` to `node` and the `args` to `["/abs/path/to/leadclaw/packages/mcp/dist/bin.js"]`.
|
|
92
|
+
|
|
93
|
+
**B) From the web app (when available):** log in at [app.leadbay.ai](https://app.leadbay.ai), go to **Settings → API Tokens**, create a token, copy it.
|
|
94
|
+
|
|
95
|
+
Don't have a Leadbay account yet? [Register here](https://wow.leadbay.ai/?register=true).
|
|
96
|
+
|
|
97
|
+
## 2. Quickstart
|
|
98
|
+
|
|
99
|
+
### Claude Desktop
|
|
100
|
+
|
|
101
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcpServers": {
|
|
106
|
+
"leadbay": {
|
|
107
|
+
"command": "npx",
|
|
108
|
+
"args": ["-y", "@leadbay/mcp@0.2"],
|
|
109
|
+
"env": {
|
|
110
|
+
"LEADBAY_TOKEN": "<paste-token-from-step-1>",
|
|
111
|
+
"LEADBAY_REGION": "us"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Restart Claude Desktop.
|
|
119
|
+
|
|
120
|
+
### Cursor
|
|
121
|
+
|
|
122
|
+
In Cursor settings, add the MCP server:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"mcp.servers": {
|
|
127
|
+
"leadbay": {
|
|
128
|
+
"command": "npx",
|
|
129
|
+
"args": ["-y", "@leadbay/mcp@0.2"],
|
|
130
|
+
"env": { "LEADBAY_TOKEN": "<paste-token>", "LEADBAY_REGION": "us" }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Claude Code
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
claude mcp add leadbay \
|
|
140
|
+
--env LEADBAY_TOKEN=<paste-token> \
|
|
141
|
+
--env LEADBAY_REGION=us \
|
|
142
|
+
-- npx -y @leadbay/mcp@0.2
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
> Want write tools (refine prompt, log outreach, adjust audience, etc.)? Add `--env LEADBAY_MCP_WRITE=1`. They're hidden by default so an LLM can't mutate state without your explicit opt-in.
|
|
146
|
+
|
|
147
|
+
### Verify it works
|
|
148
|
+
|
|
149
|
+
Before starting Claude, run:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
LEADBAY_TOKEN=<paste-token> npx -y @leadbay/mcp@0.2 doctor
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Expected output:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
Leadbay connection OK.
|
|
159
|
+
Organization: Your Org
|
|
160
|
+
Billing: active
|
|
161
|
+
AI credits: 420 / 1000
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 3. Example prompts that work
|
|
165
|
+
|
|
166
|
+
> *Find me 20 SaaS companies in Berlin that match my Ideal Buyer Profile.*
|
|
167
|
+
|
|
168
|
+
> *Research the top prospect from that list — give me the AI summary, recent activity, and who I should reach out to.*
|
|
169
|
+
|
|
170
|
+
> *Prepare an outreach package for Acme Corp — include the recommended contact with enriched email if we have credits.*
|
|
171
|
+
|
|
172
|
+
## 4. Troubleshooting
|
|
173
|
+
|
|
174
|
+
| Problem | Cause | Fix |
|
|
175
|
+
|---------|-------|-----|
|
|
176
|
+
| `LEADBAY_TOKEN environment variable is required` | Token missing from config env | Add `LEADBAY_TOKEN` to the `env` block, restart client |
|
|
177
|
+
| `Authentication token expired or invalid` | Token revoked or wrong region | Re-generate token at [app.leadbay.ai/settings/api-tokens](https://app.leadbay.ai/settings/api-tokens); verify `LEADBAY_REGION` |
|
|
178
|
+
| `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. |
|
|
179
|
+
| `No enrichment credits remaining` | Out of quota | Buy credits at [app.leadbay.ai](https://app.leadbay.ai) |
|
|
180
|
+
| 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. |
|
|
181
|
+
| Claude Desktop doesn't show Leadbay tools | Server crashed at startup | Check `~/Library/Logs/Claude/mcp*.log` (macOS) or `%APPDATA%\Claude\logs\mcp*.log` (Windows). |
|
|
182
|
+
|
|
183
|
+
## 5. Upgrade & rotation
|
|
184
|
+
|
|
185
|
+
**Upgrade**: change the pinned minor in your config, e.g. `"@leadbay/mcp@0.1"` → `"@leadbay/mcp@0.2"`, then restart the client. See the [changelog](https://github.com/leadbay/leadclaw/releases) and [MIGRATION.md](./MIGRATION.md).
|
|
186
|
+
|
|
187
|
+
**Rotate token**: re-run `npx -y @leadbay/mcp@0.2 install --email you@yourcompany.com --region us` (or `login --write-config …`) — 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.
|
|
188
|
+
|
|
189
|
+
## 6. Advanced
|
|
190
|
+
|
|
191
|
+
### Exposing the granular tools and write tools
|
|
192
|
+
|
|
193
|
+
By default the server exposes the **composite workflow tools** (`leadbay_pull_leads`, `leadbay_research_lead`, `leadbay_account_status`, `leadbay_recall_ordered_titles`, plus existing `leadbay_research_company`, `leadbay_prepare_outreach`). These work well with most prompts.
|
|
194
|
+
|
|
195
|
+
To unlock the **granular API tools** (`leadbay_list_lenses`, `leadbay_discover_leads`, `leadbay_get_lead_profile`, `leadbay_get_contacts`, `leadbay_get_quota`, `leadbay_get_taste_profile`, `leadbay_get_lens_filter`, `leadbay_list_sectors`, …), set `LEADBAY_MCP_ADVANCED=1`.
|
|
196
|
+
|
|
197
|
+
To unlock the **write tools** (`leadbay_bulk_qualify_leads`, `leadbay_enrich_titles`, `leadbay_adjust_audience`, `leadbay_refine_prompt`, `leadbay_report_outreach`, etc.), set `LEADBAY_MCP_WRITE=1`. Both flags are independent; combine to expose everything.
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
"env": {
|
|
201
|
+
"LEADBAY_TOKEN": "<token>",
|
|
202
|
+
"LEADBAY_MCP_ADVANCED": "1",
|
|
203
|
+
"LEADBAY_MCP_WRITE": "1"
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`leadbay_report_outreach` requires a `verification` field on every call (Gmail message id, Calendar event id, or `user_confirmed` with the user's literal text) so the agent can't poison your SDR pipeline with hallucinated outreach.
|
|
208
|
+
|
|
209
|
+
**Note**: `leadbay_login` is intentionally not exposed over MCP — see [Security](#security) below.
|
|
210
|
+
|
|
211
|
+
### Environment variables
|
|
212
|
+
|
|
213
|
+
| Var | Required | Default | Purpose |
|
|
214
|
+
|-----|----------|---------|---------|
|
|
215
|
+
| `LEADBAY_TOKEN` | **yes** | — | Bearer token (mint via `install` or `login`, or set manually) |
|
|
216
|
+
| `LEADBAY_REGION` | **strongly recommended** | (auto-probe — see warning below) | `us` or `fr` |
|
|
217
|
+
| `LEADBAY_BASE_URL` | no | derived from region | Override for staging/dev |
|
|
218
|
+
| `LEADBAY_MCP_ADVANCED` | no | unset | `"1"` exposes the granular API tools |
|
|
219
|
+
| `LEADBAY_MCP_WRITE` | no | unset | `"1"` exposes write composite + granular tools |
|
|
220
|
+
| `LEADBAY_MOCK` | no | unset | `"1"` serves all reads from on-disk fixtures (dev only) |
|
|
221
|
+
| `LEADBAY_MOCK_DIR` | no | `./.context/leadbay-live-shapes/` | Fixture dir for mock mode |
|
|
222
|
+
| `LEADBAY_LOG_LEVEL` | no | `error` | `debug` \| `info` \| `error`, logs to stderr |
|
|
223
|
+
|
|
224
|
+
> ⚠️ **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.
|
|
225
|
+
| `LEADBAY_TIMEOUT_MS` | no | (client default) | Per-request timeout override |
|
|
226
|
+
|
|
227
|
+
### Security
|
|
228
|
+
|
|
229
|
+
- Tokens live only in your MCP client's config file — they never traverse the network except to `api-{region}.leadbay.app`.
|
|
230
|
+
- 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.
|
|
231
|
+
- 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.
|
|
232
|
+
|
|
233
|
+
### Privacy
|
|
234
|
+
|
|
235
|
+
Contact data fetched through this server stays local to your MCP client session. No analytics or telemetry is sent by `@leadbay/mcp`. Requests to Leadbay are subject to the [Leadbay privacy policy](https://leadbay.ai/privacy).
|
|
236
|
+
|
|
237
|
+
## 7. For maintainers — publishing
|
|
238
|
+
|
|
239
|
+
This package is published to npm under `@leadbay/mcp`. **Until the first publish lands, `npx -y @leadbay/mcp@0.2 install …` will fail with a 404 — the install instructions in §1 assume the package is on the registry.**
|
|
240
|
+
|
|
241
|
+
### Recommended: tag → CI auto-publish
|
|
242
|
+
|
|
243
|
+
The `release-mcp` GitHub Action (`.github/workflows/release.yml`) publishes to npm whenever a tag matching `v*.*.*` is pushed:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# (one-time) generate an npm Automation token at npmjs.com → tokens
|
|
247
|
+
# and add it as the GitHub Actions secret NPM_TOKEN.
|
|
248
|
+
|
|
249
|
+
# Each release:
|
|
250
|
+
git checkout main && git pull
|
|
251
|
+
# bump packages/mcp/package.json version, commit, push
|
|
252
|
+
git tag v0.2.0 && git push --tags
|
|
253
|
+
# CI runs build + tests + npm publish --access public --provenance
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
The workflow verifies that the tag matches `packages/mcp/package.json` `version`, so a stale tag won't ship the wrong build.
|
|
257
|
+
|
|
258
|
+
### Manual fallback
|
|
259
|
+
|
|
260
|
+
If you'd rather publish from your laptop:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
cd packages/mcp
|
|
264
|
+
pnpm install # ensure workspace deps are linked
|
|
265
|
+
pnpm build # tsup bundles @leadbay/core into dist/bin.js
|
|
266
|
+
npm publish --access public # @leadbay/* is a scoped package
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
`prepublishOnly` re-runs `tsup` automatically so the published tarball always matches `src/`. The first publish must use `--access public` (already pinned in `publishConfig`). Once the first publish succeeds, remove the pre-release banner at the top of this README.
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
MIT. See [LICENSE](./LICENSE).
|