consulti-mcp 2.4.2 → 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 +6 -3
- package/dist/index.js +2 -188
- package/dist/leads-search.d.ts +194 -0
- package/dist/leads-search.js +97 -0
- package/dist/list-registered-tools.d.ts +5 -0
- package/dist/list-registered-tools.js +26 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.js +152 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -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
|
|
|
@@ -136,7 +136,7 @@ Search a database of 500M+ B2B leads with filters like job title, industry, loca
|
|
|
136
136
|
|
|
137
137
|
| Input | Type | Description |
|
|
138
138
|
| ---------------- | -------- | ------------------------------------------------------------------ |
|
|
139
|
-
| `q` | string | Free text search across
|
|
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` |
|
|
@@ -147,7 +147,10 @@ Search a database of 500M+ B2B leads with filters like job title, industry, loca
|
|
|
147
147
|
| `company` | string | Company name to search for |
|
|
148
148
|
| `empMin` | number | Minimum employee count |
|
|
149
149
|
| `empMax` | number | Maximum employee count |
|
|
150
|
-
| `
|
|
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
|
|
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 {
|
|
5
|
-
const VERSION = "2.4.2";
|
|
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);
|
|
@@ -83,191 +81,7 @@ async function apiGet(path) {
|
|
|
83
81
|
clearTimeout(timer);
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
|
-
const server =
|
|
87
|
-
name: "consulti-mcp",
|
|
88
|
-
version: VERSION,
|
|
89
|
-
});
|
|
90
|
-
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 }) => ({
|
|
91
|
-
content: [{ type: "text", text: await apiPost("/verify", { email }) }],
|
|
92
|
-
}));
|
|
93
|
-
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 }) => ({
|
|
94
|
-
content: [{ type: "text", text: await apiPost("/verify/catchall", { email }) }],
|
|
95
|
-
}));
|
|
96
|
-
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 }) => ({
|
|
97
|
-
content: [{ type: "text", text: await apiPost("/leads/enrich", { email }) }],
|
|
98
|
-
}));
|
|
99
|
-
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 }) => ({
|
|
100
|
-
content: [{ type: "text", text: await apiPost("/enrich/linkedin", { linkedin_url }) }],
|
|
101
|
-
}));
|
|
102
|
-
server.tool("search_b2b_leads", "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.", {
|
|
103
|
-
q: z.string().optional().describe("Free text search across name, title, company, and industry"),
|
|
104
|
-
titles: z.array(z.string()).optional().describe("Job titles to filter by (e.g. [\"CEO\", \"VP Marketing\"])"),
|
|
105
|
-
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"),
|
|
106
|
-
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"),
|
|
107
|
-
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."),
|
|
108
|
-
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"),
|
|
109
|
-
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"),
|
|
110
|
-
cities: z.array(z.string()).optional().describe("Cities to filter by (e.g. [\"San Francisco\", \"London\"])"),
|
|
111
|
-
company: z.string().optional().describe("Company name to search for"),
|
|
112
|
-
empMin: z.number().optional().describe("Minimum employee count"),
|
|
113
|
-
empMax: z.number().optional().describe("Maximum employee count"),
|
|
114
|
-
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."),
|
|
115
|
-
page: z.number().optional().describe("Page number (default: 1)"),
|
|
116
|
-
size: z.number().optional().describe("Results per page (default: 25, max: 100)"),
|
|
117
|
-
}, async (params) => {
|
|
118
|
-
const body = {};
|
|
119
|
-
if (params.q)
|
|
120
|
-
body.q = params.q;
|
|
121
|
-
if (params.titles)
|
|
122
|
-
body.titles = params.titles;
|
|
123
|
-
if (params.industries)
|
|
124
|
-
body.industries = params.industries;
|
|
125
|
-
if (params.technologies)
|
|
126
|
-
body.technologies = params.technologies;
|
|
127
|
-
if (params.excludeTechnologies)
|
|
128
|
-
body.excludeTechnologies = params.excludeTechnologies;
|
|
129
|
-
if (params.countries)
|
|
130
|
-
body.countries = params.countries;
|
|
131
|
-
if (params.states)
|
|
132
|
-
body.states = params.states;
|
|
133
|
-
if (params.cities)
|
|
134
|
-
body.cities = params.cities;
|
|
135
|
-
if (params.company)
|
|
136
|
-
body.company = params.company;
|
|
137
|
-
if (params.empMin !== undefined)
|
|
138
|
-
body.empMin = params.empMin;
|
|
139
|
-
if (params.empMax !== undefined)
|
|
140
|
-
body.empMax = params.empMax;
|
|
141
|
-
if (params.excludeListId)
|
|
142
|
-
body.excludeListId = params.excludeListId;
|
|
143
|
-
if (params.page !== undefined)
|
|
144
|
-
body.page = params.page;
|
|
145
|
-
if (params.size !== undefined)
|
|
146
|
-
body.size = params.size;
|
|
147
|
-
return {
|
|
148
|
-
content: [{ type: "text", text: await apiPost("/leads/search", body) }],
|
|
149
|
-
};
|
|
150
|
-
});
|
|
151
|
-
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.", {
|
|
152
|
-
q: z.string().optional().describe("Free text search across username and bio"),
|
|
153
|
-
bioKeywords: z.array(z.string()).optional().describe("Keywords to search for in profile bios"),
|
|
154
|
-
excludeKeywords: z.array(z.string()).optional().describe("Exclude profiles whose bio matches any of these keywords"),
|
|
155
|
-
excludeAdultContent: z.boolean().optional().describe("Exclude profiles with adult/sexual content terms in their bio"),
|
|
156
|
-
followerMin: z.number().optional().describe("Minimum follower count"),
|
|
157
|
-
followerMax: z.number().optional().describe("Maximum follower count"),
|
|
158
|
-
followingMin: z.number().optional().describe("Minimum following count"),
|
|
159
|
-
followingMax: z.number().optional().describe("Maximum following count"),
|
|
160
|
-
postsMin: z.number().optional().describe("Minimum post count"),
|
|
161
|
-
postsMax: z.number().optional().describe("Maximum post count"),
|
|
162
|
-
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"),
|
|
163
|
-
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"),
|
|
164
|
-
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"),
|
|
165
|
-
verified: z.boolean().optional().describe("Filter to only verified accounts"),
|
|
166
|
-
hasEmail: z.boolean().optional().describe("Filter to only accounts with an email on file"),
|
|
167
|
-
hasPhone: z.boolean().optional().describe("Filter to only accounts with phone number"),
|
|
168
|
-
hasWebsite: z.boolean().optional().describe("Filter to only accounts with website"),
|
|
169
|
-
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"),
|
|
170
|
-
sortBy: z.string().optional().describe("Field to sort by (followers, posts, engagement, username)"),
|
|
171
|
-
sortOrder: z.string().optional().describe("Sort order (asc or desc)"),
|
|
172
|
-
page: z.number().optional().describe("Page number (default: 1)"),
|
|
173
|
-
size: z.number().optional().describe("Results per page (default: 25, max: 100)"),
|
|
174
|
-
}, async (params) => {
|
|
175
|
-
const body = {};
|
|
176
|
-
if (params.q)
|
|
177
|
-
body.q = params.q;
|
|
178
|
-
if (params.bioKeywords)
|
|
179
|
-
body.bioKeywords = params.bioKeywords;
|
|
180
|
-
if (params.excludeKeywords)
|
|
181
|
-
body.excludeKeywords = params.excludeKeywords;
|
|
182
|
-
if (params.excludeAdultContent !== undefined)
|
|
183
|
-
body.excludeAdultContent = params.excludeAdultContent;
|
|
184
|
-
if (params.followerMin !== undefined)
|
|
185
|
-
body.followerMin = params.followerMin;
|
|
186
|
-
if (params.followerMax !== undefined)
|
|
187
|
-
body.followerMax = params.followerMax;
|
|
188
|
-
if (params.followingMin !== undefined)
|
|
189
|
-
body.followingMin = params.followingMin;
|
|
190
|
-
if (params.followingMax !== undefined)
|
|
191
|
-
body.followingMax = params.followingMax;
|
|
192
|
-
if (params.postsMin !== undefined)
|
|
193
|
-
body.postsMin = params.postsMin;
|
|
194
|
-
if (params.postsMax !== undefined)
|
|
195
|
-
body.postsMax = params.postsMax;
|
|
196
|
-
if (params.categories)
|
|
197
|
-
body.categories = params.categories;
|
|
198
|
-
if (params.accountTypes)
|
|
199
|
-
body.accountTypes = params.accountTypes;
|
|
200
|
-
if (params.emailStatus)
|
|
201
|
-
body.emailStatus = params.emailStatus;
|
|
202
|
-
if (params.verified !== undefined)
|
|
203
|
-
body.verified = params.verified;
|
|
204
|
-
if (params.hasEmail !== undefined)
|
|
205
|
-
body.hasEmail = params.hasEmail;
|
|
206
|
-
if (params.hasPhone !== undefined)
|
|
207
|
-
body.hasPhone = params.hasPhone;
|
|
208
|
-
if (params.hasWebsite !== undefined)
|
|
209
|
-
body.hasWebsite = params.hasWebsite;
|
|
210
|
-
if (params.countries)
|
|
211
|
-
body.countries = params.countries;
|
|
212
|
-
if (params.sortBy)
|
|
213
|
-
body.sortBy = params.sortBy;
|
|
214
|
-
if (params.sortOrder)
|
|
215
|
-
body.sortOrder = params.sortOrder;
|
|
216
|
-
if (params.page !== undefined)
|
|
217
|
-
body.page = params.page;
|
|
218
|
-
if (params.size !== undefined)
|
|
219
|
-
body.size = params.size;
|
|
220
|
-
return {
|
|
221
|
-
content: [{ type: "text", text: await apiPost("/instagram/search", body) }],
|
|
222
|
-
};
|
|
223
|
-
});
|
|
224
|
-
server.tool("get_lists", "Get all saved lists for the authenticated user, with member counts and each list's kind", {}, async () => ({
|
|
225
|
-
content: [{ type: "text", text: await apiGet("/lists") }],
|
|
226
|
-
}));
|
|
227
|
-
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.", {
|
|
228
|
-
name: z.string().describe("Name of the list"),
|
|
229
|
-
description: z.string().optional().describe("Optional description of the list"),
|
|
230
|
-
// Only the two kinds add_leads_to_list can actually populate. Offering
|
|
231
|
-
// podcast, youtube, or instagram here would let an agent create a list it
|
|
232
|
-
// can never add a member to, because this package sends only emails or
|
|
233
|
-
// businessIds. Those kinds are created in the dashboard.
|
|
234
|
-
kind: z
|
|
235
|
-
.enum(["lead", "business"])
|
|
236
|
-
.optional()
|
|
237
|
-
.describe("Entity kind this list holds. Defaults to 'lead' for B2B emails. Use 'business' before adding businessIds from local business search."),
|
|
238
|
-
}, async ({ name, description, kind }) => {
|
|
239
|
-
const body = { name };
|
|
240
|
-
if (description)
|
|
241
|
-
body.description = description;
|
|
242
|
-
if (kind)
|
|
243
|
-
body.kind = kind;
|
|
244
|
-
return {
|
|
245
|
-
content: [{ type: "text", text: await apiPost("/lists", body) }],
|
|
246
|
-
};
|
|
247
|
-
});
|
|
248
|
-
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.", {
|
|
249
|
-
listId: z.string().describe("UUID of the target list"),
|
|
250
|
-
emails: z
|
|
251
|
-
.array(z.string())
|
|
252
|
-
.optional()
|
|
253
|
-
.describe("Email addresses of B2B leads to add. Requires a list with kind='lead'."),
|
|
254
|
-
businessIds: z
|
|
255
|
-
.array(z.number())
|
|
256
|
-
.optional()
|
|
257
|
-
.describe("Business IDs from local business search. Requires a list with kind='business'."),
|
|
258
|
-
}, async ({ listId, emails, businessIds }) => {
|
|
259
|
-
const body = {};
|
|
260
|
-
if (emails)
|
|
261
|
-
body.emails = emails;
|
|
262
|
-
if (businessIds)
|
|
263
|
-
body.businessIds = businessIds;
|
|
264
|
-
return {
|
|
265
|
-
content: [{ type: "text", text: await apiPost(`/lists/${listId}/add-leads`, body) }],
|
|
266
|
-
};
|
|
267
|
-
});
|
|
268
|
-
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 () => ({
|
|
269
|
-
content: [{ type: "text", text: await apiGet("/credits") }],
|
|
270
|
-
}));
|
|
84
|
+
const server = createConsultiMcpServer({ apiPost, apiGet });
|
|
271
85
|
async function main() {
|
|
272
86
|
const transport = new StdioServerTransport();
|
|
273
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,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
|
+
}
|
package/dist/server.d.ts
ADDED
|
@@ -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.
|
|
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",
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@types/node": "^22.15.2",
|
|
43
44
|
"tsx": "^4.23.4",
|
|
44
|
-
"typescript": "^5.8.3"
|
|
45
|
+
"typescript": "^5.8.3",
|
|
46
|
+
"vitest": "^4.1.11"
|
|
45
47
|
}
|
|
46
48
|
}
|