consulti-mcp 2.4.1 → 2.5.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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  MCP server for the Consulti lead intelligence API — **10 stable tools** to search 500M+ B2B leads, search Instagram profiles, verify emails (including catch-all mailbox resolution), enrich leads by email or LinkedIn URL, manage saved lists, and check credit balance.
7
7
 
8
- > **Stable surface only.** Beta endpoints (name-domain lookup, local-business search, creator search) are intentionally NOT exposed via MCP — their schemas may change. To use them, call the REST API directly: https://www.consulti.ai/api-docs
8
+ > **Stable surface only.** Beta endpoints (name-domain lookup, local-business search, creator search) are intentionally NOT exposed via MCP — their schemas may change. The REST local-business search accepts US states, DC, and Canadian provinces/territories by full name or two-letter code. To use beta endpoints, call the REST API directly: https://www.consulti.ai/api-docs
9
9
 
10
10
  ## Installation
11
11
 
@@ -100,7 +100,7 @@ Resolve whether a specific mailbox on a catch-all domain actually exists — the
100
100
 
101
101
  ### enrich_lead
102
102
 
103
- Enrich a lead's full profile using their email address.
103
+ Enrich a lead's full profile using their email address. The response includes a `company` object (funding stage, total funding, monthly web visits, operating status, HQ, LinkedIn followers, specialties) when the lead is linked to a company; `company` is null when unlinked.
104
104
 
105
105
  **Cost:** 1 lead credit — only deducted on a successful match; 404 responses are free.
106
106
 
@@ -130,24 +130,27 @@ Enrich a person by their LinkedIn profile URL → a verified work email plus the
130
130
 
131
131
  ### search_b2b_leads
132
132
 
133
- Search a database of 500M+ B2B leads with filters like job title, industry, location, and company size. All inputs are optional. Results are always restricted to leads carrying our verified email label — there is no option to include unverified leads.
133
+ Search a database of 500M+ B2B leads with filters like job title, industry, location, and company size. All inputs are optional. Country and state/region alias-group members are equivalent, so names and codes return identical populations. Results are always restricted to leads carrying our verified email label — there is no option to include unverified leads.
134
134
 
135
135
  **Cost:** 1 lead credit per result returned. Credits are reserved up to `size` then refunded down to the actual row count; 0 results = 0 credits. Call `get_credits` first before using large `size` values.
136
136
 
137
137
  | Input | Type | Description |
138
138
  | ---------------- | -------- | ------------------------------------------------------------------ |
139
- | `q` | string | Free text search across name, title, company, and industry |
139
+ | `q` | string | Free text search across job title, company, and industry |
140
140
  | `titles` | string[] | Job titles to filter by (e.g. ["CEO", "VP Marketing"]) |
141
141
  | `industries` | string[] | Industries to filter by (e.g. ["Technology", "Finance"]) |
142
142
  | `technologies` | string[] | Website tech, exact Wappalyzer-style names (e.g. ["Shopify"]); OR-matched. Canonical list: `GET /api/v1/meta/technologies` |
143
143
  | `excludeTechnologies` | string[] | Website tech to EXCLUDE (same names). A lead is dropped if its company uses ANY listed tech; leads with no technology data are kept |
144
- | `countries` | string[] | Countries to filter by (e.g. ["United States"]) |
145
- | `states` | string[] | States/regions to filter by (e.g. ["California"]) |
144
+ | `countries` | string[] | Equivalent aliases match the same population (e.g. ["United States"] or ["US"]) |
145
+ | `states` | string[] | Equivalent aliases match the same population (e.g. ["Ontario"] or ["ON"]) |
146
146
  | `cities` | string[] | Cities to filter by (e.g. ["San Francisco"]) |
147
147
  | `company` | string | Company name to search for |
148
148
  | `empMin` | number | Minimum employee count |
149
149
  | `empMax` | number | Maximum employee count |
150
- | `excludeListId` | string | UUID of a saved list owned by the API key holder — leads in this list will be excluded from results. Canonical singular field name; `exclude_list_id` and other variants return HTTP 400. |
150
+ | `revenueMin` | number | Minimum annual revenue in USD, whole dollars. |
151
+ | `revenueMax` | number | Maximum annual revenue in USD, whole dollars. |
152
+ | `excludeTitles` | string[] | Job titles to exclude. Leads matching any of these are removed. |
153
+ | `excludeListId` | string | UUID of a **lead-kind** saved list owned by the API key holder — leads in this list are excluded from results before billing. Business, podcast, YouTube and Instagram lists return HTTP 400. Canonical singular field name; `exclude_list_id` and other variants also return HTTP 400. |
151
154
  | `page` | number | Page number (default: 1) |
152
155
  | `size` | number | Results per page (default: 25, max: 100) |
153
156
 
@@ -168,9 +171,25 @@ Search a database of 500M+ B2B leads with filters like job title, industry, loca
168
171
  }
169
172
  ```
170
173
 
174
+ ### List kinds
175
+
176
+ A saved list holds exactly one entity kind, recorded as `kind` on the list.
177
+ `kind` decides which identifier the list stores and which one every reader looks
178
+ for, so it must match what you add:
179
+
180
+ | `kind` | What you add to it | Where the members come from |
181
+ | ---------- | ------------------ | ------------------------------ |
182
+ | `lead` | `emails` | `search_b2b_leads` |
183
+ | `business` | `businessIds` | local business search (REST) |
184
+
185
+ Create the list with the kind you need. `kind` cannot be changed afterwards, and
186
+ adding `businessIds` to a `lead` list produces a list that cannot be opened or
187
+ exported.
188
+
171
189
  ### get_lists
172
190
 
173
- Get all saved lead lists for the authenticated user, with member counts. No inputs required.
191
+ Get all saved lists for the authenticated user, with member counts and each
192
+ list's kind. No inputs required.
174
193
 
175
194
  **Example:**
176
195
  ```json
@@ -179,27 +198,37 @@ Get all saved lead lists for the authenticated user, with member counts. No inpu
179
198
 
180
199
  ### create_list
181
200
 
182
- Create a new saved lead list.
201
+ Create a new saved list.
183
202
 
184
- | Input | Type | Description |
185
- | ------------- | ------ | ---------------------------------- |
186
- | `name` | string | **Required.** Name of the list |
187
- | `description` | string | Optional description of the list |
203
+ | Input | Type | Description |
204
+ | ------------- | ------ | --------------------------------------------------------------- |
205
+ | `name` | string | **Required.** Name of the list |
206
+ | `description` | string | Optional description of the list |
207
+ | `kind` | string | `lead` (default) or `business`. Podcast, YouTube and Instagram lists are created in the dashboard, because this package cannot add members to them. |
188
208
 
189
209
  **Example:**
190
210
  ```json
191
211
  { "name": "Tech CEOs", "description": "CEOs at tech companies with 50-500 employees" }
192
212
  ```
193
213
 
214
+ **Example, for local businesses:**
215
+ ```json
216
+ { "name": "TX roofers", "kind": "business" }
217
+ ```
218
+
194
219
  ### add_leads_to_list
195
220
 
196
- Add leads to a saved list by email addresses (B2B leads) or business IDs (local leads).
221
+ Add members to a saved list. Send `emails` to a `lead` list, or `businessIds` to
222
+ a `business` list. Send only one of the two per call.
223
+
224
+ | Input | Type | Description |
225
+ | ------------- | -------- | -------------------------------------------------------- |
226
+ | `listId` | string | **Required.** UUID of the target list |
227
+ | `emails` | string[] | Email addresses of B2B leads. Needs `kind: "lead"` |
228
+ | `businessIds` | number[] | Business IDs from local search. Needs `kind: "business"` |
197
229
 
198
- | Input | Type | Description |
199
- | ------------- | -------- | -------------------------------------- |
200
- | `listId` | string | **Required.** UUID of the target list |
201
- | `emails` | string[] | Email addresses of B2B leads to add |
202
- | `businessIds` | number[] | Business IDs of local leads to add |
230
+ A payload that does not match the list's kind produces a list that cannot be
231
+ opened or exported. Match the kind.
203
232
 
204
233
  **Example:**
205
234
  ```json
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { z } from "zod";
5
- const VERSION = "2.4.1";
3
+ import { VERSION, createConsultiMcpServer } from "./server.js";
6
4
  if (process.argv.includes("--version") || process.argv.includes("-v")) {
7
5
  console.log(VERSION);
8
6
  process.exit(0);
@@ -32,7 +30,10 @@ async function apiPost(path, body) {
32
30
  const data = await response.json();
33
31
  if (!response.ok) {
34
32
  const message = data?.error || data?.message || `API returned ${response.status}`;
35
- return JSON.stringify({ error: message }, null, 2);
33
+ // Preserve the machine-readable code when the API sends one. An agent
34
+ // can only branch on a code that survives this wrapper, and collapsing
35
+ // every failure to prose forces it to pattern-match on wording.
36
+ return JSON.stringify(data?.code ? { error: message, code: data.code } : { error: message }, null, 2);
36
37
  }
37
38
  return JSON.stringify(data, null, 2);
38
39
  }
@@ -62,7 +63,10 @@ async function apiGet(path) {
62
63
  const data = await response.json();
63
64
  if (!response.ok) {
64
65
  const message = data?.error || data?.message || `API returned ${response.status}`;
65
- return JSON.stringify({ error: message }, null, 2);
66
+ // Preserve the machine-readable code when the API sends one. An agent
67
+ // can only branch on a code that survives this wrapper, and collapsing
68
+ // every failure to prose forces it to pattern-match on wording.
69
+ return JSON.stringify(data?.code ? { error: message, code: data.code } : { error: message }, null, 2);
66
70
  }
67
71
  return JSON.stringify(data, null, 2);
68
72
  }
@@ -77,175 +81,7 @@ async function apiGet(path) {
77
81
  clearTimeout(timer);
78
82
  }
79
83
  }
80
- const server = new McpServer({
81
- name: "consulti-mcp",
82
- version: VERSION,
83
- });
84
- server.tool("verify_email", "Verify if an email address is valid and deliverable. Cost: 1 verification credit per call.", { email: z.string().describe("The email address to verify") }, async ({ email }) => ({
85
- content: [{ type: "text", text: await apiPost("/verify", { email }) }],
86
- }));
87
- server.tool("verify_catchall", "Resolve whether a specific mailbox on a catch-all domain actually exists — the ESP-engine probe that plain SMTP (verify_email) cannot do. Use it on addresses verify_email returns with is_catch_all=true. Cost: 5 verification credits per call; requires a plan with catch-all verification enabled (Pro or higher).", { email: z.string().describe("The email address on a catch-all domain to resolve") }, async ({ email }) => ({
88
- content: [{ type: "text", text: await apiPost("/verify/catchall", { email }) }],
89
- }));
90
- server.tool("enrich_lead", "Enrich a lead's full profile using their email address. Cost: 1 lead credit — only deducted on a successful match; 404 responses are free.", { email: z.string().describe("The email address of the lead to enrich") }, async ({ email }) => ({
91
- content: [{ type: "text", text: await apiPost("/leads/enrich", { email }) }],
92
- }));
93
- server.tool("enrich_linkedin", "Enrich a person by their LinkedIn profile URL → a verified work email plus their US mobile phone (free add-on). Cache-first: served instantly when we already hold a verified email for that profile, otherwise enriched live and cached. Cost: 1 lead credit — charged ONLY when an email is returned; phone-only or no-match responses are free.", { linkedin_url: z.string().describe("The LinkedIn profile URL, e.g. https://linkedin.com/in/johndoe") }, async ({ linkedin_url }) => ({
94
- content: [{ type: "text", text: await apiPost("/enrich/linkedin", { linkedin_url }) }],
95
- }));
96
- server.tool("search_b2b_leads", "Search a database of 500M+ B2B leads with filters like job title, industry, location, and company size. Results are always restricted to leads carrying our verified email label (there is no option to include unverified leads). Cost: 1 lead credit per result returned — reserved up to `size` then refunded down to the actual row count; 0 results = 0 credits. Call get_credits first before large `size` values.", {
97
- q: z.string().optional().describe("Free text search across name, title, company, and industry"),
98
- titles: z.array(z.string()).optional().describe("Job titles to filter by (e.g. [\"CEO\", \"VP Marketing\"])"),
99
- industries: z.array(z.string()).optional().describe("Industries to filter by (case-sensitive exact match). Get the canonical list: GET https://www.consulti.ai/api/v1/meta/industries"),
100
- technologies: z.array(z.string()).optional().describe("Technologies the company's website uses, exact Wappalyzer-style names (e.g. [\"Shopify\", \"HubSpot\", \"WordPress\"]). OR-matched: a lead matches if it uses ANY listed technology. Canonical list: GET https://www.consulti.ai/api/v1/meta/technologies"),
101
- excludeTechnologies: z.array(z.string()).optional().describe("Technologies to EXCLUDE, same Wappalyzer-style names. A lead is dropped if its company uses ANY listed technology; leads with no technology data are kept."),
102
- countries: z.array(z.string()).optional().describe("Countries to filter by (exact match). Canonical list: GET https://www.consulti.ai/api/v1/meta/countries"),
103
- states: z.array(z.string()).optional().describe("States/regions to filter by (exact match). Canonical list: GET https://www.consulti.ai/api/v1/meta/states"),
104
- cities: z.array(z.string()).optional().describe("Cities to filter by (e.g. [\"San Francisco\", \"London\"])"),
105
- company: z.string().optional().describe("Company name to search for"),
106
- empMin: z.number().optional().describe("Minimum employee count"),
107
- empMax: z.number().optional().describe("Maximum employee count"),
108
- excludeListId: z.string().optional().describe("UUID of a saved list owned by the API key holder — leads in this list will be excluded from results. Response includes both `total` (pre-exclusion) and `total_after_exclusion` (post) so the caller can verify exclusion fired."),
109
- page: z.number().optional().describe("Page number (default: 1)"),
110
- size: z.number().optional().describe("Results per page (default: 25, max: 100)"),
111
- }, async (params) => {
112
- const body = {};
113
- if (params.q)
114
- body.q = params.q;
115
- if (params.titles)
116
- body.titles = params.titles;
117
- if (params.industries)
118
- body.industries = params.industries;
119
- if (params.technologies)
120
- body.technologies = params.technologies;
121
- if (params.excludeTechnologies)
122
- body.excludeTechnologies = params.excludeTechnologies;
123
- if (params.countries)
124
- body.countries = params.countries;
125
- if (params.states)
126
- body.states = params.states;
127
- if (params.cities)
128
- body.cities = params.cities;
129
- if (params.company)
130
- body.company = params.company;
131
- if (params.empMin !== undefined)
132
- body.empMin = params.empMin;
133
- if (params.empMax !== undefined)
134
- body.empMax = params.empMax;
135
- if (params.excludeListId)
136
- body.excludeListId = params.excludeListId;
137
- if (params.page !== undefined)
138
- body.page = params.page;
139
- if (params.size !== undefined)
140
- body.size = params.size;
141
- return {
142
- content: [{ type: "text", text: await apiPost("/leads/search", body) }],
143
- };
144
- });
145
- server.tool("search_instagram_profiles", "Search a database of Instagram profiles with filters like follower count, category, location, and data quality. Cost: 1 lead credit per result returned — reserved up to `size` then refunded down to the actual row count; 0 results = 0 credits. Call get_credits first before large operations.", {
146
- q: z.string().optional().describe("Free text search across username and bio"),
147
- bioKeywords: z.array(z.string()).optional().describe("Keywords to search for in profile bios"),
148
- excludeKeywords: z.array(z.string()).optional().describe("Exclude profiles whose bio matches any of these keywords"),
149
- excludeAdultContent: z.boolean().optional().describe("Exclude profiles with adult/sexual content terms in their bio"),
150
- followerMin: z.number().optional().describe("Minimum follower count"),
151
- followerMax: z.number().optional().describe("Maximum follower count"),
152
- followingMin: z.number().optional().describe("Minimum following count"),
153
- followingMax: z.number().optional().describe("Maximum following count"),
154
- postsMin: z.number().optional().describe("Minimum post count"),
155
- postsMax: z.number().optional().describe("Maximum post count"),
156
- categories: z.array(z.string()).optional().describe("Categories to filter by (e.g. [\"Digital creator\", \"Photographer\"]). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-categories"),
157
- accountTypes: z.array(z.string()).optional().describe("Account types to filter by (e.g. [\"business\", \"personal\"]). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-account-types"),
158
- emailStatus: z.array(z.string()).optional().describe("Email verification status to filter by (e.g. [\"good\", \"risky\", \"bad\", \"catch_all\"]). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-email-statuses"),
159
- verified: z.boolean().optional().describe("Filter to only verified accounts"),
160
- hasEmail: z.boolean().optional().describe("Filter to only accounts with an email on file"),
161
- hasPhone: z.boolean().optional().describe("Filter to only accounts with phone number"),
162
- hasWebsite: z.boolean().optional().describe("Filter to only accounts with website"),
163
- countries: z.array(z.string()).optional().describe("Countries to filter by (exact match). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-countries"),
164
- sortBy: z.string().optional().describe("Field to sort by (followers, posts, engagement, username)"),
165
- sortOrder: z.string().optional().describe("Sort order (asc or desc)"),
166
- page: z.number().optional().describe("Page number (default: 1)"),
167
- size: z.number().optional().describe("Results per page (default: 25, max: 100)"),
168
- }, async (params) => {
169
- const body = {};
170
- if (params.q)
171
- body.q = params.q;
172
- if (params.bioKeywords)
173
- body.bioKeywords = params.bioKeywords;
174
- if (params.excludeKeywords)
175
- body.excludeKeywords = params.excludeKeywords;
176
- if (params.excludeAdultContent !== undefined)
177
- body.excludeAdultContent = params.excludeAdultContent;
178
- if (params.followerMin !== undefined)
179
- body.followerMin = params.followerMin;
180
- if (params.followerMax !== undefined)
181
- body.followerMax = params.followerMax;
182
- if (params.followingMin !== undefined)
183
- body.followingMin = params.followingMin;
184
- if (params.followingMax !== undefined)
185
- body.followingMax = params.followingMax;
186
- if (params.postsMin !== undefined)
187
- body.postsMin = params.postsMin;
188
- if (params.postsMax !== undefined)
189
- body.postsMax = params.postsMax;
190
- if (params.categories)
191
- body.categories = params.categories;
192
- if (params.accountTypes)
193
- body.accountTypes = params.accountTypes;
194
- if (params.emailStatus)
195
- body.emailStatus = params.emailStatus;
196
- if (params.verified !== undefined)
197
- body.verified = params.verified;
198
- if (params.hasEmail !== undefined)
199
- body.hasEmail = params.hasEmail;
200
- if (params.hasPhone !== undefined)
201
- body.hasPhone = params.hasPhone;
202
- if (params.hasWebsite !== undefined)
203
- body.hasWebsite = params.hasWebsite;
204
- if (params.countries)
205
- body.countries = params.countries;
206
- if (params.sortBy)
207
- body.sortBy = params.sortBy;
208
- if (params.sortOrder)
209
- body.sortOrder = params.sortOrder;
210
- if (params.page !== undefined)
211
- body.page = params.page;
212
- if (params.size !== undefined)
213
- body.size = params.size;
214
- return {
215
- content: [{ type: "text", text: await apiPost("/instagram/search", body) }],
216
- };
217
- });
218
- server.tool("get_lists", "Get all saved lead lists for the authenticated user, with member counts", {}, async () => ({
219
- content: [{ type: "text", text: await apiGet("/lists") }],
220
- }));
221
- server.tool("create_list", "Create a new saved lead list", {
222
- name: z.string().describe("Name of the list"),
223
- description: z.string().optional().describe("Optional description of the list"),
224
- }, async ({ name, description }) => {
225
- const body = { name };
226
- if (description)
227
- body.description = description;
228
- return {
229
- content: [{ type: "text", text: await apiPost("/lists", body) }],
230
- };
231
- });
232
- server.tool("add_leads_to_list", "Add leads to a saved list by email addresses (B2B leads) or business IDs (local leads)", {
233
- listId: z.string().describe("UUID of the target list"),
234
- emails: z.array(z.string()).optional().describe("Email addresses of B2B leads to add"),
235
- businessIds: z.array(z.number()).optional().describe("Business IDs of local leads to add"),
236
- }, async ({ listId, emails, businessIds }) => {
237
- const body = {};
238
- if (emails)
239
- body.emails = emails;
240
- if (businessIds)
241
- body.businessIds = businessIds;
242
- return {
243
- content: [{ type: "text", text: await apiPost(`/lists/${listId}/add-leads`, body) }],
244
- };
245
- });
246
- server.tool("get_credits", "Check the authenticated user's current lead and verification credit balance. Free — no credits deducted. Use before bulk operations to avoid running out mid-task.", {}, async () => ({
247
- content: [{ type: "text", text: await apiGet("/credits") }],
248
- }));
84
+ const server = createConsultiMcpServer({ apiPost, apiGet });
249
85
  async function main() {
250
86
  const transport = new StdioServerTransport();
251
87
  await server.connect(transport);
@@ -0,0 +1,194 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Field validators for `search_b2b_leads`.
4
+ *
5
+ * `@modelcontextprotocol/sdk@1.30.0` `server.tool(name, desc, shape, cb)` only
6
+ * accepts a raw shape and wraps it with non-strict `z.object()`, which STRIPS
7
+ * unknown keys before the handler runs. A misspelled `excludeTitles` then
8
+ * becomes a billable unfiltered search. `server.tool()` also throws if given a
9
+ * real ZodObject. Registration therefore uses `server.registerTool` with
10
+ * `searchB2bLeadsInputObjectSchema` (a `.strict()` ZodObject).
11
+ *
12
+ * Do not register the refined schema: `.refine()` is a ZodEffects with no
13
+ * `.shape`, and ListTools would emit `{ type: "object", properties: {} }`.
14
+ * Reversed revenue bounds are still enforced in `handleSearchB2bLeads`.
15
+ */
16
+ export declare const searchB2bLeadsInputShape: {
17
+ q: z.ZodOptional<z.ZodString>;
18
+ titles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
+ industries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
+ technologies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
+ excludeTechnologies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
+ countries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
23
+ states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
24
+ cities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
+ company: z.ZodOptional<z.ZodString>;
26
+ empMin: z.ZodOptional<z.ZodNumber>;
27
+ empMax: z.ZodOptional<z.ZodNumber>;
28
+ revenueMin: z.ZodOptional<z.ZodNumber>;
29
+ revenueMax: z.ZodOptional<z.ZodNumber>;
30
+ excludeTitles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
+ excludeListId: z.ZodOptional<z.ZodString>;
32
+ page: z.ZodOptional<z.ZodNumber>;
33
+ size: z.ZodOptional<z.ZodNumber>;
34
+ };
35
+ export declare const searchB2bLeadsInputObjectSchema: z.ZodObject<{
36
+ q: z.ZodOptional<z.ZodString>;
37
+ titles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
+ industries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
39
+ technologies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
40
+ excludeTechnologies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
41
+ countries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
+ cities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
44
+ company: z.ZodOptional<z.ZodString>;
45
+ empMin: z.ZodOptional<z.ZodNumber>;
46
+ empMax: z.ZodOptional<z.ZodNumber>;
47
+ revenueMin: z.ZodOptional<z.ZodNumber>;
48
+ revenueMax: z.ZodOptional<z.ZodNumber>;
49
+ excludeTitles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
50
+ excludeListId: z.ZodOptional<z.ZodString>;
51
+ page: z.ZodOptional<z.ZodNumber>;
52
+ size: z.ZodOptional<z.ZodNumber>;
53
+ }, "strict", z.ZodTypeAny, {
54
+ q?: string | undefined;
55
+ titles?: string[] | undefined;
56
+ industries?: string[] | undefined;
57
+ technologies?: string[] | undefined;
58
+ excludeTechnologies?: string[] | undefined;
59
+ countries?: string[] | undefined;
60
+ states?: string[] | undefined;
61
+ cities?: string[] | undefined;
62
+ company?: string | undefined;
63
+ empMin?: number | undefined;
64
+ empMax?: number | undefined;
65
+ revenueMin?: number | undefined;
66
+ revenueMax?: number | undefined;
67
+ excludeTitles?: string[] | undefined;
68
+ excludeListId?: string | undefined;
69
+ page?: number | undefined;
70
+ size?: number | undefined;
71
+ }, {
72
+ q?: string | undefined;
73
+ titles?: string[] | undefined;
74
+ industries?: string[] | undefined;
75
+ technologies?: string[] | undefined;
76
+ excludeTechnologies?: string[] | undefined;
77
+ countries?: string[] | undefined;
78
+ states?: string[] | undefined;
79
+ cities?: string[] | undefined;
80
+ company?: string | undefined;
81
+ empMin?: number | undefined;
82
+ empMax?: number | undefined;
83
+ revenueMin?: number | undefined;
84
+ revenueMax?: number | undefined;
85
+ excludeTitles?: string[] | undefined;
86
+ excludeListId?: string | undefined;
87
+ page?: number | undefined;
88
+ size?: number | undefined;
89
+ }>;
90
+ export declare const searchB2bLeadsInputSchema: z.ZodEffects<z.ZodObject<{
91
+ q: z.ZodOptional<z.ZodString>;
92
+ titles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
93
+ industries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
94
+ technologies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
95
+ excludeTechnologies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
96
+ countries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
97
+ states: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
98
+ cities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
99
+ company: z.ZodOptional<z.ZodString>;
100
+ empMin: z.ZodOptional<z.ZodNumber>;
101
+ empMax: z.ZodOptional<z.ZodNumber>;
102
+ revenueMin: z.ZodOptional<z.ZodNumber>;
103
+ revenueMax: z.ZodOptional<z.ZodNumber>;
104
+ excludeTitles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
105
+ excludeListId: z.ZodOptional<z.ZodString>;
106
+ page: z.ZodOptional<z.ZodNumber>;
107
+ size: z.ZodOptional<z.ZodNumber>;
108
+ }, "strict", z.ZodTypeAny, {
109
+ q?: string | undefined;
110
+ titles?: string[] | undefined;
111
+ industries?: string[] | undefined;
112
+ technologies?: string[] | undefined;
113
+ excludeTechnologies?: string[] | undefined;
114
+ countries?: string[] | undefined;
115
+ states?: string[] | undefined;
116
+ cities?: string[] | undefined;
117
+ company?: string | undefined;
118
+ empMin?: number | undefined;
119
+ empMax?: number | undefined;
120
+ revenueMin?: number | undefined;
121
+ revenueMax?: number | undefined;
122
+ excludeTitles?: string[] | undefined;
123
+ excludeListId?: string | undefined;
124
+ page?: number | undefined;
125
+ size?: number | undefined;
126
+ }, {
127
+ q?: string | undefined;
128
+ titles?: string[] | undefined;
129
+ industries?: string[] | undefined;
130
+ technologies?: string[] | undefined;
131
+ excludeTechnologies?: string[] | undefined;
132
+ countries?: string[] | undefined;
133
+ states?: string[] | undefined;
134
+ cities?: string[] | undefined;
135
+ company?: string | undefined;
136
+ empMin?: number | undefined;
137
+ empMax?: number | undefined;
138
+ revenueMin?: number | undefined;
139
+ revenueMax?: number | undefined;
140
+ excludeTitles?: string[] | undefined;
141
+ excludeListId?: string | undefined;
142
+ page?: number | undefined;
143
+ size?: number | undefined;
144
+ }>, {
145
+ q?: string | undefined;
146
+ titles?: string[] | undefined;
147
+ industries?: string[] | undefined;
148
+ technologies?: string[] | undefined;
149
+ excludeTechnologies?: string[] | undefined;
150
+ countries?: string[] | undefined;
151
+ states?: string[] | undefined;
152
+ cities?: string[] | undefined;
153
+ company?: string | undefined;
154
+ empMin?: number | undefined;
155
+ empMax?: number | undefined;
156
+ revenueMin?: number | undefined;
157
+ revenueMax?: number | undefined;
158
+ excludeTitles?: string[] | undefined;
159
+ excludeListId?: string | undefined;
160
+ page?: number | undefined;
161
+ size?: number | undefined;
162
+ }, {
163
+ q?: string | undefined;
164
+ titles?: string[] | undefined;
165
+ industries?: string[] | undefined;
166
+ technologies?: string[] | undefined;
167
+ excludeTechnologies?: string[] | undefined;
168
+ countries?: string[] | undefined;
169
+ states?: string[] | undefined;
170
+ cities?: string[] | undefined;
171
+ company?: string | undefined;
172
+ empMin?: number | undefined;
173
+ empMax?: number | undefined;
174
+ revenueMin?: number | undefined;
175
+ revenueMax?: number | undefined;
176
+ excludeTitles?: string[] | undefined;
177
+ excludeListId?: string | undefined;
178
+ page?: number | undefined;
179
+ size?: number | undefined;
180
+ }>;
181
+ export type SearchB2bLeadsInput = z.infer<typeof searchB2bLeadsInputSchema>;
182
+ export type LeadsSearchApiPost = (path: string, body: Record<string, unknown>) => Promise<string>;
183
+ export declare function buildSearchB2bLeadsBody(params: SearchB2bLeadsInput): Record<string, unknown>;
184
+ /**
185
+ * Registered `search_b2b_leads` callback. Parses the full object schema
186
+ * (including the revenueMin <= revenueMax refine) before building the
187
+ * request body or dispatching HTTP.
188
+ */
189
+ export declare function handleSearchB2bLeads(params: unknown, apiPost: LeadsSearchApiPost): Promise<{
190
+ content: Array<{
191
+ type: "text";
192
+ text: string;
193
+ }>;
194
+ }>;
@@ -0,0 +1,97 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Field validators for `search_b2b_leads`.
4
+ *
5
+ * `@modelcontextprotocol/sdk@1.30.0` `server.tool(name, desc, shape, cb)` only
6
+ * accepts a raw shape and wraps it with non-strict `z.object()`, which STRIPS
7
+ * unknown keys before the handler runs. A misspelled `excludeTitles` then
8
+ * becomes a billable unfiltered search. `server.tool()` also throws if given a
9
+ * real ZodObject. Registration therefore uses `server.registerTool` with
10
+ * `searchB2bLeadsInputObjectSchema` (a `.strict()` ZodObject).
11
+ *
12
+ * Do not register the refined schema: `.refine()` is a ZodEffects with no
13
+ * `.shape`, and ListTools would emit `{ type: "object", properties: {} }`.
14
+ * Reversed revenue bounds are still enforced in `handleSearchB2bLeads`.
15
+ */
16
+ export const searchB2bLeadsInputShape = {
17
+ q: z.string().optional().describe("Free text search across job title, company, and industry"),
18
+ titles: z.array(z.string()).optional().describe("Job titles to filter by (e.g. [\"CEO\", \"VP Marketing\"])"),
19
+ industries: z.array(z.string()).optional().describe("Industries to filter by (case-sensitive exact match). Get the canonical list: GET https://www.consulti.ai/api/v1/meta/industries"),
20
+ technologies: z.array(z.string()).optional().describe("Technologies the company's website uses, exact Wappalyzer-style names (e.g. [\"Shopify\", \"HubSpot\", \"WordPress\"]). OR-matched: a lead matches if it uses ANY listed technology. Canonical list: GET https://www.consulti.ai/api/v1/meta/technologies"),
21
+ excludeTechnologies: z.array(z.string()).optional().describe("Technologies to EXCLUDE, same Wappalyzer-style names. A lead is dropped if its company uses ANY listed technology; leads with no technology data are kept."),
22
+ countries: z.array(z.string()).optional().describe("Countries to filter by. Alias-group members are equivalent (e.g. \"United States\" and \"US\"). Accepted values: GET https://www.consulti.ai/api/v1/meta/countries"),
23
+ states: z.array(z.string()).optional().describe("States/regions to filter by. Alias-group members are equivalent (e.g. \"Ontario\" and \"ON\"). Accepted values: GET https://www.consulti.ai/api/v1/meta/states"),
24
+ cities: z.array(z.string()).optional().describe("Cities to filter by (e.g. [\"San Francisco\", \"London\"])"),
25
+ company: z.string().optional().describe("Company name to search for"),
26
+ empMin: z.number().optional().describe("Minimum employee count"),
27
+ empMax: z.number().optional().describe("Maximum employee count"),
28
+ revenueMin: z.number().int().nonnegative().optional().describe("Minimum annual revenue in USD, whole dollars."),
29
+ revenueMax: z.number().int().nonnegative().optional().describe("Maximum annual revenue in USD, whole dollars."),
30
+ excludeTitles: z
31
+ .array(z.string().trim().min(1))
32
+ .max(25)
33
+ .optional()
34
+ .describe("Job titles to exclude. Leads matching any of these are removed."),
35
+ excludeListId: z.string().optional().describe("UUID of a LEAD-kind saved list owned by the API key holder — leads in this list are excluded from results before billing. Must be a list created with kind \"lead\"; business, podcast, YouTube and Instagram lists hold no lead emails and return HTTP 400. Response includes both `total` (pre-exclusion) and `total_after_exclusion` (post); a LOWER total_after_exclusion proves rows were excluded, while equal values are inconclusive (no overlap with this search, or both counts at the 10001 cap)."),
36
+ page: z.number().optional().describe("Page number (default: 1)"),
37
+ size: z.number().optional().describe("Results per page (default: 25, max: 100)"),
38
+ };
39
+ export const searchB2bLeadsInputObjectSchema = z
40
+ .object(searchB2bLeadsInputShape)
41
+ .strict();
42
+ export const searchB2bLeadsInputSchema = searchB2bLeadsInputObjectSchema.refine((data) => data.revenueMin === undefined ||
43
+ data.revenueMax === undefined ||
44
+ data.revenueMin <= data.revenueMax, {
45
+ message: "revenueMin must be less than or equal to revenueMax",
46
+ path: ["revenueMin"],
47
+ });
48
+ export function buildSearchB2bLeadsBody(params) {
49
+ const body = {};
50
+ if (params.q)
51
+ body.q = params.q;
52
+ if (params.titles)
53
+ body.titles = params.titles;
54
+ if (params.industries)
55
+ body.industries = params.industries;
56
+ if (params.technologies)
57
+ body.technologies = params.technologies;
58
+ if (params.excludeTechnologies)
59
+ body.excludeTechnologies = params.excludeTechnologies;
60
+ if (params.countries)
61
+ body.countries = params.countries;
62
+ if (params.states)
63
+ body.states = params.states;
64
+ if (params.cities)
65
+ body.cities = params.cities;
66
+ if (params.company)
67
+ body.company = params.company;
68
+ if (params.empMin !== undefined)
69
+ body.empMin = params.empMin;
70
+ if (params.empMax !== undefined)
71
+ body.empMax = params.empMax;
72
+ if (params.revenueMin !== undefined)
73
+ body.revenueMin = params.revenueMin;
74
+ if (params.revenueMax !== undefined)
75
+ body.revenueMax = params.revenueMax;
76
+ if (params.excludeTitles)
77
+ body.excludeTitles = params.excludeTitles;
78
+ if (params.excludeListId)
79
+ body.excludeListId = params.excludeListId;
80
+ if (params.page !== undefined)
81
+ body.page = params.page;
82
+ if (params.size !== undefined)
83
+ body.size = params.size;
84
+ return body;
85
+ }
86
+ /**
87
+ * Registered `search_b2b_leads` callback. Parses the full object schema
88
+ * (including the revenueMin <= revenueMax refine) before building the
89
+ * request body or dispatching HTTP.
90
+ */
91
+ export async function handleSearchB2bLeads(params, apiPost) {
92
+ const parsed = searchB2bLeadsInputSchema.parse(params);
93
+ const body = buildSearchB2bLeadsBody(parsed);
94
+ return {
95
+ content: [{ type: "text", text: await apiPost("/leads/search", body) }],
96
+ };
97
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Names of tools the real Consulti MCP server registers, from a ListTools
3
+ * round-trip over InMemoryTransport. Import-safe: no stdio, no env reads.
4
+ */
5
+ export declare function listConsultiMcpToolNames(): Promise<string[]>;
@@ -0,0 +1,26 @@
1
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
3
+ import { createConsultiMcpServer } from "./server.js";
4
+ /**
5
+ * Names of tools the real Consulti MCP server registers, from a ListTools
6
+ * round-trip over InMemoryTransport. Import-safe: no stdio, no env reads.
7
+ */
8
+ export async function listConsultiMcpToolNames() {
9
+ const server = createConsultiMcpServer({
10
+ apiPost: async () => "{}",
11
+ apiGet: async () => "{}",
12
+ });
13
+ const client = new Client({ name: "consulti-mcp-list-tools", version: "0.0.0" });
14
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
15
+ await Promise.all([
16
+ client.connect(clientTransport),
17
+ server.connect(serverTransport),
18
+ ]);
19
+ try {
20
+ const listed = await client.listTools();
21
+ return listed.tools.map((tool) => tool.name);
22
+ }
23
+ finally {
24
+ await Promise.all([client.close(), server.close()]);
25
+ }
26
+ }
@@ -0,0 +1,12 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare const VERSION = "2.5.0";
3
+ export type ConsultiMcpApiPost = (path: string, body: Record<string, unknown>) => Promise<string>;
4
+ export type ConsultiMcpApiGet = (path: string) => Promise<string>;
5
+ /**
6
+ * Build the Consulti MCP server with every stable tool registered.
7
+ * Import-safe: does not connect a transport, read env, or start stdio.
8
+ */
9
+ export declare function createConsultiMcpServer(options: {
10
+ apiPost: ConsultiMcpApiPost;
11
+ apiGet: ConsultiMcpApiGet;
12
+ }): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,152 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { z } from "zod";
3
+ import { handleSearchB2bLeads, searchB2bLeadsInputObjectSchema } from "./leads-search.js";
4
+ export const VERSION = "2.5.0";
5
+ /**
6
+ * Build the Consulti MCP server with every stable tool registered.
7
+ * Import-safe: does not connect a transport, read env, or start stdio.
8
+ */
9
+ export function createConsultiMcpServer(options) {
10
+ const { apiPost, apiGet } = options;
11
+ const server = new McpServer({
12
+ name: "consulti-mcp",
13
+ version: VERSION,
14
+ });
15
+ server.tool("verify_email", "Verify if an email address is valid and deliverable. Cost: 1 verification credit per call.", { email: z.string().describe("The email address to verify") }, async ({ email }) => ({
16
+ content: [{ type: "text", text: await apiPost("/verify", { email }) }],
17
+ }));
18
+ server.tool("verify_catchall", "Resolve whether a specific mailbox on a catch-all domain actually exists — the ESP-engine probe that plain SMTP (verify_email) cannot do. Use it on addresses verify_email returns with is_catch_all=true. Cost: 5 verification credits per call; requires a plan with catch-all verification enabled (Pro or higher).", { email: z.string().describe("The email address on a catch-all domain to resolve") }, async ({ email }) => ({
19
+ content: [{ type: "text", text: await apiPost("/verify/catchall", { email }) }],
20
+ }));
21
+ server.tool("enrich_lead", "Enrich a lead's full profile using their email address, including company-level funding, traffic, HQ, followers, and specialties when the lead is linked to a company. Cost: 1 lead credit — only deducted on a successful match; 404 responses are free.", { email: z.string().describe("The email address of the lead to enrich") }, async ({ email }) => ({
22
+ content: [{ type: "text", text: await apiPost("/leads/enrich", { email }) }],
23
+ }));
24
+ server.tool("enrich_linkedin", "Enrich a person by their LinkedIn profile URL → a verified work email plus their US mobile phone (free add-on). Cache-first: served instantly when we already hold a verified email for that profile, otherwise enriched live and cached. Cost: 1 lead credit — charged ONLY when an email is returned; phone-only or no-match responses are free.", { linkedin_url: z.string().describe("The LinkedIn profile URL, e.g. https://linkedin.com/in/johndoe") }, async ({ linkedin_url }) => ({
25
+ content: [{ type: "text", text: await apiPost("/enrich/linkedin", { linkedin_url }) }],
26
+ }));
27
+ server.registerTool("search_b2b_leads", {
28
+ description: "Search a database of 500M+ B2B leads with filters like job title, industry, location, and company size. Country and state/region alias-group members are equivalent, so names and codes return identical populations. Results are always restricted to leads carrying our verified email label (there is no option to include unverified leads). Cost: 1 lead credit per result returned — reserved up to `size` then refunded down to the actual row count; 0 results = 0 credits. Call get_credits first before large `size` values.",
29
+ inputSchema: searchB2bLeadsInputObjectSchema,
30
+ }, async (params) => handleSearchB2bLeads(params, apiPost));
31
+ server.tool("search_instagram_profiles", "Search a database of Instagram profiles with filters like follower count, category, location, and data quality. Cost: 1 lead credit per result returned — reserved up to `size` then refunded down to the actual row count; 0 results = 0 credits. Call get_credits first before large operations.", {
32
+ q: z.string().optional().describe("Free text search across username and bio"),
33
+ bioKeywords: z.array(z.string()).optional().describe("Keywords to search for in profile bios"),
34
+ excludeKeywords: z.array(z.string()).optional().describe("Exclude profiles whose bio matches any of these keywords"),
35
+ excludeAdultContent: z.boolean().optional().describe("Exclude profiles with adult/sexual content terms in their bio"),
36
+ followerMin: z.number().optional().describe("Minimum follower count"),
37
+ followerMax: z.number().optional().describe("Maximum follower count"),
38
+ followingMin: z.number().optional().describe("Minimum following count"),
39
+ followingMax: z.number().optional().describe("Maximum following count"),
40
+ postsMin: z.number().optional().describe("Minimum post count"),
41
+ postsMax: z.number().optional().describe("Maximum post count"),
42
+ categories: z.array(z.string()).optional().describe("Categories to filter by (e.g. [\"Digital creator\", \"Photographer\"]). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-categories"),
43
+ accountTypes: z.array(z.string()).optional().describe("Account types to filter by (e.g. [\"business\", \"personal\"]). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-account-types"),
44
+ emailStatus: z.array(z.string()).optional().describe("Email verification status to filter by (e.g. [\"good\", \"risky\", \"bad\", \"catch_all\"]). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-email-statuses"),
45
+ verified: z.boolean().optional().describe("Filter to only verified accounts"),
46
+ hasEmail: z.boolean().optional().describe("Filter to only accounts with an email on file"),
47
+ hasPhone: z.boolean().optional().describe("Filter to only accounts with phone number"),
48
+ hasWebsite: z.boolean().optional().describe("Filter to only accounts with website"),
49
+ countries: z.array(z.string()).optional().describe("Countries to filter by (exact match). Canonical list: GET https://www.consulti.ai/api/v1/meta/instagram-countries"),
50
+ sortBy: z.string().optional().describe("Field to sort by (followers, posts, engagement, username)"),
51
+ sortOrder: z.string().optional().describe("Sort order (asc or desc)"),
52
+ page: z.number().optional().describe("Page number (default: 1)"),
53
+ size: z.number().optional().describe("Results per page (default: 25, max: 100)"),
54
+ }, async (params) => {
55
+ const body = {};
56
+ if (params.q)
57
+ body.q = params.q;
58
+ if (params.bioKeywords)
59
+ body.bioKeywords = params.bioKeywords;
60
+ if (params.excludeKeywords)
61
+ body.excludeKeywords = params.excludeKeywords;
62
+ if (params.excludeAdultContent !== undefined)
63
+ body.excludeAdultContent = params.excludeAdultContent;
64
+ if (params.followerMin !== undefined)
65
+ body.followerMin = params.followerMin;
66
+ if (params.followerMax !== undefined)
67
+ body.followerMax = params.followerMax;
68
+ if (params.followingMin !== undefined)
69
+ body.followingMin = params.followingMin;
70
+ if (params.followingMax !== undefined)
71
+ body.followingMax = params.followingMax;
72
+ if (params.postsMin !== undefined)
73
+ body.postsMin = params.postsMin;
74
+ if (params.postsMax !== undefined)
75
+ body.postsMax = params.postsMax;
76
+ if (params.categories)
77
+ body.categories = params.categories;
78
+ if (params.accountTypes)
79
+ body.accountTypes = params.accountTypes;
80
+ if (params.emailStatus)
81
+ body.emailStatus = params.emailStatus;
82
+ if (params.verified !== undefined)
83
+ body.verified = params.verified;
84
+ if (params.hasEmail !== undefined)
85
+ body.hasEmail = params.hasEmail;
86
+ if (params.hasPhone !== undefined)
87
+ body.hasPhone = params.hasPhone;
88
+ if (params.hasWebsite !== undefined)
89
+ body.hasWebsite = params.hasWebsite;
90
+ if (params.countries)
91
+ body.countries = params.countries;
92
+ if (params.sortBy)
93
+ body.sortBy = params.sortBy;
94
+ if (params.sortOrder)
95
+ body.sortOrder = params.sortOrder;
96
+ if (params.page !== undefined)
97
+ body.page = params.page;
98
+ if (params.size !== undefined)
99
+ body.size = params.size;
100
+ return {
101
+ content: [{ type: "text", text: await apiPost("/instagram/search", body) }],
102
+ };
103
+ });
104
+ server.tool("get_lists", "Get all saved lists for the authenticated user, with member counts and each list's kind", {}, async () => ({
105
+ content: [{ type: "text", text: await apiGet("/lists") }],
106
+ }));
107
+ server.tool("create_list", "Create a new saved list. A list holds exactly one entity kind. Use kind='lead' to store B2B lead emails and kind='business' to store local business IDs. Choose the kind that matches what you plan to add, because members cannot be added to a list of a different kind.", {
108
+ name: z.string().describe("Name of the list"),
109
+ description: z.string().optional().describe("Optional description of the list"),
110
+ // Only the two kinds add_leads_to_list can actually populate. Offering
111
+ // podcast, youtube, or instagram here would let an agent create a list it
112
+ // can never add a member to, because this package sends only emails or
113
+ // businessIds. Those kinds are created in the dashboard.
114
+ kind: z
115
+ .enum(["lead", "business"])
116
+ .optional()
117
+ .describe("Entity kind this list holds. Defaults to 'lead' for B2B emails. Use 'business' before adding businessIds from local business search."),
118
+ }, async ({ name, description, kind }) => {
119
+ const body = { name };
120
+ if (description)
121
+ body.description = description;
122
+ if (kind)
123
+ body.kind = kind;
124
+ return {
125
+ content: [{ type: "text", text: await apiPost("/lists", body) }],
126
+ };
127
+ });
128
+ server.tool("add_leads_to_list", "Add members to a saved list. Send 'emails' to a list with kind='lead', or 'businessIds' to a list with kind='business'. Send only one of the two per call. Adding members whose type does not match the list's kind produces a list that cannot be opened or exported, so create the list with the matching kind first.", {
129
+ listId: z.string().describe("UUID of the target list"),
130
+ emails: z
131
+ .array(z.string())
132
+ .optional()
133
+ .describe("Email addresses of B2B leads to add. Requires a list with kind='lead'."),
134
+ businessIds: z
135
+ .array(z.number())
136
+ .optional()
137
+ .describe("Business IDs from local business search. Requires a list with kind='business'."),
138
+ }, async ({ listId, emails, businessIds }) => {
139
+ const body = {};
140
+ if (emails)
141
+ body.emails = emails;
142
+ if (businessIds)
143
+ body.businessIds = businessIds;
144
+ return {
145
+ content: [{ type: "text", text: await apiPost(`/lists/${listId}/add-leads`, body) }],
146
+ };
147
+ });
148
+ server.tool("get_credits", "Check the authenticated user's current lead and verification credit balance. Free — no credits deducted. Use before bulk operations to avoid running out mid-task.", {}, async () => ({
149
+ content: [{ type: "text", text: await apiGet("/credits") }],
150
+ }));
151
+ return server;
152
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "consulti-mcp",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "Consulti.ai MCP server — 10 stable tools for email verification (incl. catch-all mailbox resolution), B2B lead search/enrichment, LinkedIn-URL enrichment, Instagram profile search, list management, and credit-balance checks. Stable surface only; beta endpoints are not exposed via MCP. Compatible with Claude Desktop, Cursor, and any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,7 +14,8 @@
14
14
  "scripts": {
15
15
  "build": "tsc",
16
16
  "dev": "tsx src/index.ts",
17
- "prepublishOnly": "npm run build"
17
+ "prepublishOnly": "npm run build",
18
+ "test": "vitest run"
18
19
  },
19
20
  "keywords": [
20
21
  "mcp",
@@ -27,20 +28,21 @@
27
28
  "homepage": "https://www.consulti.ai/api-docs",
28
29
  "repository": {
29
30
  "type": "git",
30
- "url": "git+https://github.com/leadgenjay/consulti.git",
31
+ "url": "git+https://github.com/Lead-Gen-Jay/consulti.git",
31
32
  "directory": "mcp"
32
33
  },
33
34
  "bugs": {
34
- "url": "https://github.com/leadgenjay/consulti/issues"
35
+ "url": "https://github.com/Lead-Gen-Jay/consulti/issues"
35
36
  },
36
37
  "license": "MIT",
37
38
  "dependencies": {
38
- "@modelcontextprotocol/sdk": "^1.12.1",
39
+ "@modelcontextprotocol/sdk": "^1.30.0",
39
40
  "zod": "^3.24.1"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@types/node": "^22.15.2",
43
- "tsx": "^4.19.4",
44
- "typescript": "^5.8.3"
44
+ "tsx": "^4.23.4",
45
+ "typescript": "^5.8.3",
46
+ "vitest": "^4.1.11"
45
47
  }
46
48
  }