findymail-mcp 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "findymail-mcp",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "MCP server for Findymail - Find verified B2B emails, phone numbers, and company data",
5
5
  "type": "module",
6
6
  "main": "src/stdio.js",
package/src/http.js CHANGED
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { createRequire } from "node:module";
3
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
5
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
5
6
  import { log } from "./api.js";
6
7
  import { registerTools } from "./tools.js";
7
8
 
9
+ const require = createRequire(import.meta.url);
10
+ const { version } = require("../package.json");
11
+
8
12
  // Express is an optional dependency for HTTP mode
9
13
  let express;
10
14
  try {
@@ -88,7 +92,7 @@ app.post("/token", (req, res) => {
88
92
  function createMcpServer() {
89
93
  const server = new McpServer({
90
94
  name: "findymail-mcp",
91
- version: "0.1.0",
95
+ version,
92
96
  });
93
97
 
94
98
  registerTools(server);
package/src/stdio.js CHANGED
@@ -1,13 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { createRequire } from "node:module";
3
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
6
  import { log } from "./api.js";
6
7
  import { registerTools } from "./tools.js";
7
8
 
9
+ const require = createRequire(import.meta.url);
10
+ const { version } = require("../package.json");
11
+
8
12
  const server = new McpServer({
9
13
  name: "findymail-mcp",
10
- version: "0.1.0",
14
+ version,
11
15
  });
12
16
 
13
17
  registerTools(server);
package/src/tools.js CHANGED
@@ -153,7 +153,7 @@ export function registerTools(server) {
153
153
  "Lead list generation tool. Searches a B2B database of 100M+ companies and contacts to build targeted lead lists. Returns structured data including verified email addresses, phone numbers, company details, and LinkedIn profiles — data that web search cannot provide. This is the ONLY way to get verified contact emails and phone numbers. Use this for any request to find, search, list, or generate lists of companies, leads, contacts, or prospects. Accepts natural language queries (e.g., 'SaaS companies in the USA with 50+ employees', 'Marketing managers at tech startups in NYC'). Returns a hash — you MUST then call `get_lead_list_results` with that hash to retrieve results.",
154
154
  {
155
155
  query: z.string().describe("Natural language description of what you're looking for (max 1000 characters)"),
156
- limit: z.number().optional().default(100).describe("Maximum number of results (default: 100, max: 500)"),
156
+ limit: z.number().optional().default(100).describe("Maximum number of results (default: 100, max: 5000)"),
157
157
  mode: z.enum(["broad", "targeted"]).optional().default("broad").describe("'broad' = fast export (1 credit/10 companies), 'targeted' = AI-qualified results (1 credit/company)"),
158
158
  find_contact: z.boolean().optional().default(true).describe("Search for contacts at each company (+1 credit/contact found)"),
159
159
  target_job_titles: z.array(z.string()).optional().default(["CEO"]).describe("Job titles to target when find_contact is true (e.g., ['CEO', 'CTO', 'VP Sales'])"),
@@ -173,7 +173,7 @@ export function registerTools(server) {
173
173
 
174
174
  log(`generate_lead_list: "${query}" (limit: ${limit}, mode: ${mode})`);
175
175
 
176
- const validatedLimit = Math.min(Math.max(1, limit), 500);
176
+ const validatedLimit = Math.min(Math.max(1, limit), 5000);
177
177
 
178
178
  try {
179
179
  const apiKey = resolveApiKey(extra);
@@ -214,17 +214,19 @@ export function registerTools(server) {
214
214
  // ===========================================================================
215
215
  server.tool(
216
216
  "get_lead_list_results",
217
- "Retrieve results from a lead list search started with `generate_lead_list`. Takes the hash returned by `generate_lead_list`. Polls the search status for up to 90 seconds. If the search completes within that time, returns the full data. If still processing after 90s, returns the current progress — call again to continue waiting.",
217
+ "Retrieve results from a lead list search started with `generate_lead_list`. Takes the hash returned by `generate_lead_list`. Polls the search status for up to 60 seconds. If the search completes within that time, returns the full data. If still processing after 60s, returns the current progress — call again to continue waiting.",
218
218
  {
219
219
  hash: z.string().describe("The hash returned by generate_lead_list"),
220
220
  },
221
221
  async ({ hash }, extra) => {
222
222
  log(`get_lead_list_results: hash=${hash}`);
223
223
 
224
+ const progressToken = extra._meta?.progressToken;
225
+
224
226
  try {
225
227
  const apiKey = resolveApiKey(extra);
226
228
 
227
- const maxAttempts = 30; // 30 × 3s = 90s max
229
+ const maxAttempts = 20; // 20 × 3s = 60s max (under MCP client timeout)
228
230
  const pollInterval = 3000; // 3 seconds
229
231
 
230
232
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
@@ -232,6 +234,14 @@ export function registerTools(server) {
232
234
  log(`get_lead_list_results: status=${statusResult.status}, attempt ${attempt + 1}/${maxAttempts}`);
233
235
 
234
236
  if (statusResult.status === "success") {
237
+ // Send 100% progress before fetching data
238
+ if (progressToken !== undefined) {
239
+ await extra.sendNotification({
240
+ method: "notifications/progress",
241
+ params: { progressToken, progress: 100, total: 100, message: "Search complete, fetching results..." },
242
+ });
243
+ }
244
+
235
245
  log(`get_lead_list_results: completed, fetching data...`);
236
246
 
237
247
  const allData = [];
@@ -265,9 +275,21 @@ export function registerTools(server) {
265
275
  return formatError("Search was cancelled");
266
276
  }
267
277
 
268
- if (statusResult.progress !== undefined) {
269
- log(`get_lead_list_results: progress ${statusResult.progress}%`);
278
+ // Send progress notification if the client requested it
279
+ if (progressToken !== undefined) {
280
+ if (statusResult.progress !== undefined) {
281
+ await extra.sendNotification({
282
+ method: "notifications/progress",
283
+ params: { progressToken, progress: statusResult.progress, total: 100, message: `Search in progress (${statusResult.progress}%)` },
284
+ });
285
+ } else {
286
+ await extra.sendNotification({
287
+ method: "notifications/progress",
288
+ params: { progressToken, progress: 0, total: 100, message: "In preparation — Search starting..." },
289
+ });
290
+ }
270
291
  }
292
+ log(`get_lead_list_results: progress ${statusResult.progress ?? "in preparation"}`);
271
293
 
272
294
  // Don't sleep after the last attempt
273
295
  if (attempt < maxAttempts - 1) {
@@ -275,11 +297,11 @@ export function registerTools(server) {
275
297
  }
276
298
  }
277
299
 
278
- // Still processing after 90s — return progress so the model can call again
300
+ // Still processing after 60s — return progress so the model can call again
279
301
  return formatResponse({
280
302
  status: "processing",
281
303
  hash,
282
- message: "Search is still processing after 90 seconds. Call get_lead_list_results again to continue waiting.",
304
+ message: "Search is still processing after 60 seconds. Call get_lead_list_results again to continue waiting.",
283
305
  });
284
306
  } catch (error) {
285
307
  return formatError(error.message);