findymail-mcp 0.1.0 → 0.1.2
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 +27 -3
- package/package.json +1 -1
- package/src/api.js +17 -4
- package/src/http.js +17 -0
- package/src/tools.js +27 -32
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ This MCP server exposes the following tools:
|
|
|
13
13
|
| `verify_email` | Verify if an email is deliverable |
|
|
14
14
|
| `enrich_company` | Get company data from domain, LinkedIn URL, or name |
|
|
15
15
|
| `reverse_email_lookup` | Find person info from an email |
|
|
16
|
-
| `
|
|
16
|
+
| `generate_lead_list` | AI-powered lead list generation with natural language |
|
|
17
17
|
|
|
18
18
|
## Prerequisites
|
|
19
19
|
|
|
@@ -34,7 +34,11 @@ npx findymail-mcp
|
|
|
34
34
|
|
|
35
35
|
## Configuration
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Stdio mode (local)
|
|
38
|
+
|
|
39
|
+
Each user provides their API key via environment variable.
|
|
40
|
+
|
|
41
|
+
#### Claude Code
|
|
38
42
|
|
|
39
43
|
```bash
|
|
40
44
|
claude mcp add findymail -e FINDYMAIL_API_KEY=your-api-key -- npx findymail-mcp
|
|
@@ -56,7 +60,7 @@ Or manually edit `~/.claude.json`:
|
|
|
56
60
|
}
|
|
57
61
|
```
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
#### Claude Desktop
|
|
60
64
|
|
|
61
65
|
Edit your Claude Desktop config file:
|
|
62
66
|
|
|
@@ -77,6 +81,26 @@ Edit your Claude Desktop config file:
|
|
|
77
81
|
}
|
|
78
82
|
```
|
|
79
83
|
|
|
84
|
+
### HTTP mode (remote server)
|
|
85
|
+
|
|
86
|
+
In HTTP mode, each client passes their Findymail API key via the `Authorization` header. No environment variable is needed on the server.
|
|
87
|
+
|
|
88
|
+
#### Claude Code
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
claude mcp add findymail https://your-server.com/mcp -t http -H "Authorization: Bearer your-api-key"
|
|
92
|
+
claude mcp add findymail https://mcp.findylabs.com/mcp -t http -H "Authorization: Bearer your-api-key"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Running the HTTP server
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm install express
|
|
99
|
+
PORT=3456 node src/http.js
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Requests to `/mcp` without a valid `Authorization: Bearer <token>` header will be rejected with a 401 error.
|
|
103
|
+
|
|
80
104
|
## Usage Examples
|
|
81
105
|
|
|
82
106
|
Once configured, you can ask your AI assistant:
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -18,11 +18,24 @@ export function getApiKey() {
|
|
|
18
18
|
return apiKey;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Resolve API key from MCP extra context (HTTP mode) or env var (stdio mode)
|
|
23
|
+
*/
|
|
24
|
+
export function resolveApiKey(extra) {
|
|
25
|
+
if (extra?.authInfo?.token) {
|
|
26
|
+
return extra.authInfo.token;
|
|
27
|
+
}
|
|
28
|
+
if (process.env.FINDYMAIL_API_KEY) {
|
|
29
|
+
return process.env.FINDYMAIL_API_KEY;
|
|
30
|
+
}
|
|
31
|
+
throw new Error("API key is required: set FINDYMAIL_API_KEY or pass Authorization header");
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
/**
|
|
22
35
|
* Make authenticated POST request to Findymail API
|
|
23
36
|
*/
|
|
24
|
-
export async function apiPost(endpoint, body = {}) {
|
|
25
|
-
|
|
37
|
+
export async function apiPost(endpoint, body = {}, apiKey) {
|
|
38
|
+
if (!apiKey) apiKey = getApiKey();
|
|
26
39
|
|
|
27
40
|
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
28
41
|
method: "POST",
|
|
@@ -45,8 +58,8 @@ export async function apiPost(endpoint, body = {}) {
|
|
|
45
58
|
/**
|
|
46
59
|
* Make authenticated GET request to Findymail API
|
|
47
60
|
*/
|
|
48
|
-
export async function apiGet(endpoint) {
|
|
49
|
-
|
|
61
|
+
export async function apiGet(endpoint, apiKey) {
|
|
62
|
+
if (!apiKey) apiKey = getApiKey();
|
|
50
63
|
|
|
51
64
|
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
|
52
65
|
method: "GET",
|
package/src/http.js
CHANGED
|
@@ -96,6 +96,23 @@ function createMcpServer() {
|
|
|
96
96
|
return server;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// =============================================================================
|
|
100
|
+
// Auth middleware for MCP endpoint
|
|
101
|
+
// =============================================================================
|
|
102
|
+
|
|
103
|
+
app.use("/mcp", (req, res, next) => {
|
|
104
|
+
const authHeader = req.headers.authorization;
|
|
105
|
+
if (!authHeader || !authHeader.startsWith("Bearer ")) {
|
|
106
|
+
return res.status(401).json({ error: "Authorization header with Bearer token is required" });
|
|
107
|
+
}
|
|
108
|
+
const token = authHeader.slice(7).trim();
|
|
109
|
+
if (!token) {
|
|
110
|
+
return res.status(401).json({ error: "Bearer token is empty" });
|
|
111
|
+
}
|
|
112
|
+
req.auth = { token, clientId: "", scopes: [] };
|
|
113
|
+
next();
|
|
114
|
+
});
|
|
115
|
+
|
|
99
116
|
// =============================================================================
|
|
100
117
|
// MCP endpoint (Streamable HTTP)
|
|
101
118
|
// =============================================================================
|
package/src/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { log, apiPost, apiGet, formatResponse, formatError } from "./api.js";
|
|
2
|
+
import { log, apiPost, apiGet, resolveApiKey, formatResponse, formatError } from "./api.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Register all Findymail tools on an MCP server
|
|
@@ -16,14 +16,16 @@ export function registerTools(server) {
|
|
|
16
16
|
domain: z.string().optional().describe("Company domain (required with name)"),
|
|
17
17
|
linkedin_url: z.string().optional().describe("LinkedIn profile URL (alternative to name+domain)"),
|
|
18
18
|
},
|
|
19
|
-
async (params) => {
|
|
19
|
+
async (params, extra) => {
|
|
20
20
|
log(`find_email: ${JSON.stringify(params)}`);
|
|
21
21
|
|
|
22
22
|
try {
|
|
23
|
+
const apiKey = resolveApiKey(extra);
|
|
24
|
+
|
|
23
25
|
if (params.linkedin_url) {
|
|
24
26
|
const data = await apiPost("/search/linkedin", {
|
|
25
27
|
linkedin_url: params.linkedin_url,
|
|
26
|
-
});
|
|
28
|
+
}, apiKey);
|
|
27
29
|
return formatResponse(data);
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -31,7 +33,7 @@ export function registerTools(server) {
|
|
|
31
33
|
const data = await apiPost("/search/name", {
|
|
32
34
|
name: params.name,
|
|
33
35
|
domain: params.domain,
|
|
34
|
-
});
|
|
36
|
+
}, apiKey);
|
|
35
37
|
return formatResponse(data);
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -51,11 +53,12 @@ export function registerTools(server) {
|
|
|
51
53
|
{
|
|
52
54
|
linkedin_url: z.string().describe("LinkedIn profile URL (required)"),
|
|
53
55
|
},
|
|
54
|
-
async ({ linkedin_url }) => {
|
|
56
|
+
async ({ linkedin_url }, extra) => {
|
|
55
57
|
log(`find_phone: ${linkedin_url}`);
|
|
56
58
|
|
|
57
59
|
try {
|
|
58
|
-
const
|
|
60
|
+
const apiKey = resolveApiKey(extra);
|
|
61
|
+
const data = await apiPost("/search/phone", { linkedin_url }, apiKey);
|
|
59
62
|
return formatResponse(data);
|
|
60
63
|
} catch (error) {
|
|
61
64
|
return formatError(error.message);
|
|
@@ -72,11 +75,12 @@ export function registerTools(server) {
|
|
|
72
75
|
{
|
|
73
76
|
email: z.string().describe("Email address to verify"),
|
|
74
77
|
},
|
|
75
|
-
async ({ email }) => {
|
|
78
|
+
async ({ email }, extra) => {
|
|
76
79
|
log(`verify_email: ${email}`);
|
|
77
80
|
|
|
78
81
|
try {
|
|
79
|
-
const
|
|
82
|
+
const apiKey = resolveApiKey(extra);
|
|
83
|
+
const data = await apiPost("/verify", { email }, apiKey);
|
|
80
84
|
return formatResponse(data);
|
|
81
85
|
} catch (error) {
|
|
82
86
|
return formatError(error.message);
|
|
@@ -95,10 +99,12 @@ export function registerTools(server) {
|
|
|
95
99
|
linkedin_url: z.string().optional().describe("LinkedIn company page URL"),
|
|
96
100
|
name: z.string().optional().describe("Company name"),
|
|
97
101
|
},
|
|
98
|
-
async (params) => {
|
|
102
|
+
async (params, extra) => {
|
|
99
103
|
log(`enrich_company: ${JSON.stringify(params)}`);
|
|
100
104
|
|
|
101
105
|
try {
|
|
106
|
+
const apiKey = resolveApiKey(extra);
|
|
107
|
+
|
|
102
108
|
if (!params.domain && !params.linkedin_url && !params.name) {
|
|
103
109
|
return formatError("At least one of domain, linkedin_url, or name is required");
|
|
104
110
|
}
|
|
@@ -108,7 +114,7 @@ export function registerTools(server) {
|
|
|
108
114
|
if (params.linkedin_url) body.linkedin_url = params.linkedin_url;
|
|
109
115
|
if (params.name) body.name = params.name;
|
|
110
116
|
|
|
111
|
-
const data = await apiPost("/search/company", body);
|
|
117
|
+
const data = await apiPost("/search/company", body, apiKey);
|
|
112
118
|
return formatResponse(data);
|
|
113
119
|
} catch (error) {
|
|
114
120
|
return formatError(error.message);
|
|
@@ -126,11 +132,12 @@ export function registerTools(server) {
|
|
|
126
132
|
email: z.string().describe("Email address to lookup"),
|
|
127
133
|
with_profile: z.boolean().optional().default(false).describe("Include full LinkedIn profile data"),
|
|
128
134
|
},
|
|
129
|
-
async ({ email, with_profile }) => {
|
|
135
|
+
async ({ email, with_profile }, extra) => {
|
|
130
136
|
log(`reverse_email_lookup: ${email}`);
|
|
131
137
|
|
|
132
138
|
try {
|
|
133
|
-
const
|
|
139
|
+
const apiKey = resolveApiKey(extra);
|
|
140
|
+
const data = await apiPost("/search/reverse-email", { email, with_profile }, apiKey);
|
|
134
141
|
return formatResponse(data);
|
|
135
142
|
} catch (error) {
|
|
136
143
|
return formatError(error.message);
|
|
@@ -142,8 +149,8 @@ export function registerTools(server) {
|
|
|
142
149
|
// Tool: intellimatch_search
|
|
143
150
|
// ===========================================================================
|
|
144
151
|
server.tool(
|
|
145
|
-
"
|
|
146
|
-
"
|
|
152
|
+
"generate_lead_list",
|
|
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'). This is an async operation that may take up to 2 minutes.",
|
|
147
154
|
{
|
|
148
155
|
query: z.string().describe("Natural language description of what you're looking for (max 1000 characters)"),
|
|
149
156
|
limit: z.number().optional().default(100).describe("Maximum number of results (default: 100, max: 500)"),
|
|
@@ -152,11 +159,8 @@ export function registerTools(server) {
|
|
|
152
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'])"),
|
|
153
160
|
find_email: z.boolean().optional().default(true).describe("Enrich contacts with email (+1 credit/email found). Requires find_contact: true"),
|
|
154
161
|
find_phone: z.boolean().optional().default(false).describe("Enrich contacts with phone (+10 credits/phone found). Requires find_contact: true"),
|
|
155
|
-
add_to_exclusion_list: z.boolean().optional().default(false).describe("Add exported domains to an exclusion list"),
|
|
156
|
-
exclusion_list_id: z.number().optional().describe("ID of exclusion list to add domains to (required if add_to_exclusion_list is true)"),
|
|
157
|
-
exclusion_filter_list_ids: z.array(z.number()).optional().describe("Exclusion list IDs to filter against. [0] = all excluded domains (default), [-1] = disable filtering"),
|
|
158
162
|
},
|
|
159
|
-
async (params) => {
|
|
163
|
+
async (params, extra) => {
|
|
160
164
|
const {
|
|
161
165
|
query,
|
|
162
166
|
limit = 100,
|
|
@@ -165,9 +169,6 @@ export function registerTools(server) {
|
|
|
165
169
|
target_job_titles = ["CEO"],
|
|
166
170
|
find_email = true,
|
|
167
171
|
find_phone = false,
|
|
168
|
-
add_to_exclusion_list = false,
|
|
169
|
-
exclusion_list_id,
|
|
170
|
-
exclusion_filter_list_ids,
|
|
171
172
|
} = params;
|
|
172
173
|
|
|
173
174
|
log(`intellimatch_search: "${query}" (limit: ${limit}, mode: ${mode})`);
|
|
@@ -176,6 +177,8 @@ export function registerTools(server) {
|
|
|
176
177
|
const validatedLimit = Math.min(Math.max(1, limit), 500);
|
|
177
178
|
|
|
178
179
|
try {
|
|
180
|
+
const apiKey = resolveApiKey(extra);
|
|
181
|
+
|
|
179
182
|
// Build config object
|
|
180
183
|
const config = {
|
|
181
184
|
mode,
|
|
@@ -183,22 +186,14 @@ export function registerTools(server) {
|
|
|
183
186
|
target_job_titles,
|
|
184
187
|
find_email,
|
|
185
188
|
find_phone,
|
|
186
|
-
add_to_exclusion_list,
|
|
187
189
|
};
|
|
188
190
|
|
|
189
|
-
if (exclusion_list_id !== undefined) {
|
|
190
|
-
config.exclusion_list_id = exclusion_list_id;
|
|
191
|
-
}
|
|
192
|
-
if (exclusion_filter_list_ids !== undefined) {
|
|
193
|
-
config.exclusion_filter_list_ids = exclusion_filter_list_ids;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
191
|
// 1. Start the search
|
|
197
192
|
const startResult = await apiPost("/intellimatch/search", {
|
|
198
193
|
query,
|
|
199
194
|
limit: validatedLimit,
|
|
200
195
|
config,
|
|
201
|
-
});
|
|
196
|
+
}, apiKey);
|
|
202
197
|
|
|
203
198
|
if (!startResult.hash) {
|
|
204
199
|
return formatError("Failed to start search");
|
|
@@ -214,7 +209,7 @@ export function registerTools(server) {
|
|
|
214
209
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
215
210
|
await new Promise(resolve => setTimeout(resolve, pollInterval));
|
|
216
211
|
|
|
217
|
-
const statusResult = await apiGet(`/intellimatch/status?hash=${hash}
|
|
212
|
+
const statusResult = await apiGet(`/intellimatch/status?hash=${hash}`, apiKey);
|
|
218
213
|
log(`intellimatch: status=${statusResult.status}, attempt ${attempt + 1}/${maxAttempts}`);
|
|
219
214
|
|
|
220
215
|
if (statusResult.status === "success") {
|
|
@@ -227,7 +222,7 @@ export function registerTools(server) {
|
|
|
227
222
|
const perPage = 100;
|
|
228
223
|
|
|
229
224
|
do {
|
|
230
|
-
const dataResult = await apiGet(`/intellimatch/data?hash=${hash}&page=${currentPage}&per_page=${perPage}
|
|
225
|
+
const dataResult = await apiGet(`/intellimatch/data?hash=${hash}&page=${currentPage}&per_page=${perPage}`, apiKey);
|
|
231
226
|
|
|
232
227
|
if (dataResult.data && Array.isArray(dataResult.data)) {
|
|
233
228
|
allData.push(...dataResult.data);
|