@companyenrich/mcp 0.0.0-stage → 2.0.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/LICENSE +21 -0
- package/README.md +464 -2
- package/dist/stdio.js +1136 -0
- package/package.json +54 -4
package/dist/stdio.js
ADDED
|
@@ -0,0 +1,1136 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/stdio.ts
|
|
4
|
+
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
5
|
+
|
|
6
|
+
// src/mcp.ts
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
8
|
+
import { z as z2 } from "zod";
|
|
9
|
+
|
|
10
|
+
// package.json
|
|
11
|
+
var version = "2.0.0";
|
|
12
|
+
|
|
13
|
+
// src/schema.ts
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
var CompanyCategoryEnum = z.enum([
|
|
16
|
+
"b2b",
|
|
17
|
+
"b2c",
|
|
18
|
+
"b2g",
|
|
19
|
+
"e-commerce",
|
|
20
|
+
"media",
|
|
21
|
+
"service-provider",
|
|
22
|
+
"mobile",
|
|
23
|
+
"saas"
|
|
24
|
+
]);
|
|
25
|
+
var CompanyEmployeesEnum = z.enum([
|
|
26
|
+
"1-10",
|
|
27
|
+
"11-50",
|
|
28
|
+
"51-200",
|
|
29
|
+
"201-500",
|
|
30
|
+
"501-1K",
|
|
31
|
+
"1K-5K",
|
|
32
|
+
"5K-10K",
|
|
33
|
+
"over-10K"
|
|
34
|
+
]);
|
|
35
|
+
var CompanyRevenueEnum = z.enum([
|
|
36
|
+
"under-1m",
|
|
37
|
+
"1m-10m",
|
|
38
|
+
"10m-50m",
|
|
39
|
+
"50m-100m",
|
|
40
|
+
"100m-200m",
|
|
41
|
+
"200m-1b",
|
|
42
|
+
"over-1b"
|
|
43
|
+
]);
|
|
44
|
+
var CompanyTypeEnum = z.enum([
|
|
45
|
+
"private",
|
|
46
|
+
"public",
|
|
47
|
+
"self-employed",
|
|
48
|
+
"self-owned",
|
|
49
|
+
"partnership",
|
|
50
|
+
"nonprofit",
|
|
51
|
+
"educational",
|
|
52
|
+
"government"
|
|
53
|
+
]);
|
|
54
|
+
var CompanyFundingRoundEnum = z.enum([
|
|
55
|
+
"seed",
|
|
56
|
+
"debt_financing",
|
|
57
|
+
"angel",
|
|
58
|
+
"venture",
|
|
59
|
+
"series_a",
|
|
60
|
+
"series_b",
|
|
61
|
+
"series_c",
|
|
62
|
+
"series_d",
|
|
63
|
+
"series_e",
|
|
64
|
+
"series_f",
|
|
65
|
+
"series_g",
|
|
66
|
+
"series_h",
|
|
67
|
+
"other"
|
|
68
|
+
]);
|
|
69
|
+
var FilterOperatorEnum = z.enum(["And", "Or"]);
|
|
70
|
+
var FeatureRequirementEnum = z.enum([
|
|
71
|
+
"linkedin",
|
|
72
|
+
"twitter",
|
|
73
|
+
"facebook",
|
|
74
|
+
"instagram",
|
|
75
|
+
"angellist",
|
|
76
|
+
"crunchbase",
|
|
77
|
+
"youtube",
|
|
78
|
+
"country",
|
|
79
|
+
"city",
|
|
80
|
+
"state",
|
|
81
|
+
"revenue",
|
|
82
|
+
"foundedYear",
|
|
83
|
+
"anyFunding"
|
|
84
|
+
]);
|
|
85
|
+
var WorkforceDepartmentEnum = z.enum([
|
|
86
|
+
"overall",
|
|
87
|
+
"c_suite",
|
|
88
|
+
"product_management",
|
|
89
|
+
"engineering_technical",
|
|
90
|
+
"design",
|
|
91
|
+
"education",
|
|
92
|
+
"finance",
|
|
93
|
+
"human_resources",
|
|
94
|
+
"information_technology",
|
|
95
|
+
"legal",
|
|
96
|
+
"marketing",
|
|
97
|
+
"medical_health",
|
|
98
|
+
"operations",
|
|
99
|
+
"sales",
|
|
100
|
+
"consulting"
|
|
101
|
+
]);
|
|
102
|
+
var WorkforceGrowthPeriodEnum = z.enum(["m6", "y1", "y2"]);
|
|
103
|
+
var YearRangeSchema = z.object({
|
|
104
|
+
min: z.number().int().optional().describe("Minimum year, inclusive."),
|
|
105
|
+
max: z.number().int().optional().describe("Maximum year, inclusive.")
|
|
106
|
+
}).strict();
|
|
107
|
+
var CompanyFundingAmountRangeSchema = z.object({
|
|
108
|
+
min: z.number().optional().describe("Minimum funding amount, inclusive."),
|
|
109
|
+
max: z.number().optional().describe("Maximum funding amount, inclusive.")
|
|
110
|
+
}).strict();
|
|
111
|
+
var WorkforceGrowthInputSchema = z.object({
|
|
112
|
+
period: WorkforceGrowthPeriodEnum.optional().describe(
|
|
113
|
+
"Period to measure workforce growth over."
|
|
114
|
+
),
|
|
115
|
+
department: WorkforceDepartmentEnum.optional().describe(
|
|
116
|
+
"Department to measure workforce growth for. Use overall for total workforce."
|
|
117
|
+
),
|
|
118
|
+
minPercent: z.number().optional().describe(
|
|
119
|
+
"Minimum workforce growth percentage, inclusive. Use negative values for declines."
|
|
120
|
+
),
|
|
121
|
+
maxPercent: z.number().optional().describe(
|
|
122
|
+
"Maximum workforce growth percentage, inclusive. Use negative values for declines."
|
|
123
|
+
)
|
|
124
|
+
}).strict();
|
|
125
|
+
var WorkforceSizeInputSchema = z.object({
|
|
126
|
+
department: WorkforceDepartmentEnum.optional().describe(
|
|
127
|
+
"Department to filter by. Use overall for total workforce."
|
|
128
|
+
),
|
|
129
|
+
min: z.number().int().min(0).optional().describe("Minimum headcount, inclusive."),
|
|
130
|
+
max: z.number().int().min(0).optional().describe("Maximum headcount, inclusive.")
|
|
131
|
+
}).strict();
|
|
132
|
+
var CompanyExcludeFiltersSchema = z.object({
|
|
133
|
+
domains: z.array(z.string()).optional().describe("Company domains to exclude."),
|
|
134
|
+
regions: z.array(z.string()).optional().describe("Region IDs to exclude."),
|
|
135
|
+
countries: z.array(z.string()).optional().describe("2-letter country codes to exclude."),
|
|
136
|
+
states: z.array(z.number().int()).optional().describe("State IDs to exclude."),
|
|
137
|
+
cities: z.array(z.number().int()).optional().describe("City IDs to exclude."),
|
|
138
|
+
type: z.array(CompanyTypeEnum).optional().describe("Company types to exclude."),
|
|
139
|
+
categories: z.array(CompanyCategoryEnum).optional().describe("Company categories to exclude."),
|
|
140
|
+
employees: z.array(CompanyEmployeesEnum).optional().describe("Employee ranges to exclude."),
|
|
141
|
+
revenue: z.array(CompanyRevenueEnum).optional().describe("Revenue ranges to exclude."),
|
|
142
|
+
naicsCode: z.array(z.number().int()).optional().describe("NAICS codes to exclude."),
|
|
143
|
+
keywords: z.array(z.string()).optional().describe("Keywords to exclude."),
|
|
144
|
+
technologies: z.array(z.string()).optional().describe("Technologies to exclude."),
|
|
145
|
+
fundingRounds: z.array(CompanyFundingRoundEnum).optional().describe("Funding rounds to exclude.")
|
|
146
|
+
}).strict();
|
|
147
|
+
var CompanyCommonFilterShape = {
|
|
148
|
+
exclude: CompanyExcludeFiltersSchema.optional().describe(
|
|
149
|
+
"Exclude companies matching any of these filters."
|
|
150
|
+
),
|
|
151
|
+
foundedYear: YearRangeSchema.optional().describe("Founded year range."),
|
|
152
|
+
fundingAmount: CompanyFundingAmountRangeSchema.optional().describe(
|
|
153
|
+
"Funding amount range."
|
|
154
|
+
),
|
|
155
|
+
fundingYear: YearRangeSchema.optional().describe("Funding year range."),
|
|
156
|
+
categoryOperator: FilterOperatorEnum.optional().describe(
|
|
157
|
+
"Operator for category filters. Defaults to And in the API."
|
|
158
|
+
),
|
|
159
|
+
keywordsOperator: FilterOperatorEnum.optional().describe(
|
|
160
|
+
"Operator for keyword filters. Defaults to And in the API."
|
|
161
|
+
),
|
|
162
|
+
technologiesOperator: FilterOperatorEnum.optional().describe(
|
|
163
|
+
"Operator for technology filters. Defaults to And in the API."
|
|
164
|
+
),
|
|
165
|
+
workforceGrowth: WorkforceGrowthInputSchema.optional().describe(
|
|
166
|
+
"Filter by workforce growth percentage."
|
|
167
|
+
),
|
|
168
|
+
workforceSize: z.array(WorkforceSizeInputSchema).optional().describe("Filter by absolute workforce headcount."),
|
|
169
|
+
require: z.array(FeatureRequirementEnum).optional().describe("Company features that must exist."),
|
|
170
|
+
regions: z.array(z.string()).optional().describe("Region IDs to filter by."),
|
|
171
|
+
country: z.string().optional().describe("Deprecated single-country alias. Prefer countries."),
|
|
172
|
+
countries: z.array(z.string()).optional().describe("2-letter country codes to filter by."),
|
|
173
|
+
states: z.array(z.number().int()).optional().describe("State IDs to filter by."),
|
|
174
|
+
cities: z.array(z.number().int()).optional().describe("City IDs to filter by."),
|
|
175
|
+
type: z.array(CompanyTypeEnum).optional().describe("Company types to filter by."),
|
|
176
|
+
categories: z.array(CompanyCategoryEnum).optional().describe("Company categories to filter by."),
|
|
177
|
+
employees: z.array(CompanyEmployeesEnum).optional().describe("Employee count ranges."),
|
|
178
|
+
revenue: z.array(CompanyRevenueEnum).optional().describe("Revenue ranges in USD."),
|
|
179
|
+
naicsCode: z.array(z.number().int()).optional().describe("NAICS codes to filter by."),
|
|
180
|
+
keywords: z.array(z.string()).optional().describe("Keywords to filter by."),
|
|
181
|
+
technologies: z.array(z.string()).optional().describe("Technologies to filter by."),
|
|
182
|
+
fundingRounds: z.array(CompanyFundingRoundEnum).optional().describe("Funding rounds to filter by.")
|
|
183
|
+
};
|
|
184
|
+
var CompanySearchFilterShape = {
|
|
185
|
+
semanticQuery: z.string().min(1).max(500).optional().describe(
|
|
186
|
+
"Natural-language query describing the kinds of companies to find."
|
|
187
|
+
),
|
|
188
|
+
semanticWeight: z.number().min(0).max(1).optional().describe("Semantic weight from 0 to 1. Defaults to 0.7 in the API."),
|
|
189
|
+
query: z.string().max(250).optional().describe("Search query applied to company name and domain."),
|
|
190
|
+
...CompanyCommonFilterShape
|
|
191
|
+
};
|
|
192
|
+
var CompanySimilarFilterShape = {
|
|
193
|
+
domains: z.array(z.string()).min(1).max(10).describe(
|
|
194
|
+
"Company domain names to find similar companies for. Up to 10 domains."
|
|
195
|
+
),
|
|
196
|
+
similarityWeight: z.number().min(-1).max(1).optional().describe(
|
|
197
|
+
"Similarity weight from -1 to 1. Higher favors similarity, lower favors established companies."
|
|
198
|
+
),
|
|
199
|
+
minScore: z.number().min(0).max(1).optional().describe("Minimum similarity score required for returned companies."),
|
|
200
|
+
query: z.string().max(250).optional().describe("Search query applied to company name and domain."),
|
|
201
|
+
...CompanyCommonFilterShape
|
|
202
|
+
};
|
|
203
|
+
var CompanySearchFilterSchema = z.object(CompanySearchFilterShape).strict();
|
|
204
|
+
var CompanySimilarFilterSchema = z.object(CompanySimilarFilterShape).strict();
|
|
205
|
+
var CompanyLookupInputSchema = z.object({
|
|
206
|
+
search: CompanySearchFilterSchema.optional().describe(
|
|
207
|
+
"Company search filter."
|
|
208
|
+
),
|
|
209
|
+
similar: CompanySimilarFilterSchema.optional().describe(
|
|
210
|
+
"Similar-company filter."
|
|
211
|
+
)
|
|
212
|
+
}).strict();
|
|
213
|
+
var EnrichCompanyByPropertiesShape = {
|
|
214
|
+
name: z.string().optional().describe("Company name to enrich."),
|
|
215
|
+
linkedinUrl: z.string().url().optional().describe("Company LinkedIn URL."),
|
|
216
|
+
linkedinId: z.string().optional().describe("Company LinkedIn ID."),
|
|
217
|
+
twitterUrl: z.string().url().optional().describe("Company Twitter/X URL."),
|
|
218
|
+
facebookUrl: z.string().url().optional().describe("Company Facebook URL."),
|
|
219
|
+
instagramUrl: z.string().url().optional().describe("Company Instagram URL."),
|
|
220
|
+
youtubeUrl: z.string().url().optional().describe("Company YouTube URL.")
|
|
221
|
+
};
|
|
222
|
+
var PersonSeniorityEnum = z.enum([
|
|
223
|
+
"owner",
|
|
224
|
+
"founder",
|
|
225
|
+
"c-suite",
|
|
226
|
+
"partner",
|
|
227
|
+
"vp",
|
|
228
|
+
"head",
|
|
229
|
+
"director",
|
|
230
|
+
"manager",
|
|
231
|
+
"senior",
|
|
232
|
+
"entry",
|
|
233
|
+
"intern"
|
|
234
|
+
]);
|
|
235
|
+
var PersonDepartmentEnum = z.enum([
|
|
236
|
+
"c-suite",
|
|
237
|
+
"c-suite/executive",
|
|
238
|
+
"c-suite/finance-executive",
|
|
239
|
+
"c-suite/founder",
|
|
240
|
+
"c-suite/human-resources-executive",
|
|
241
|
+
"c-suite/information-technology-executive",
|
|
242
|
+
"c-suite/legal-executive",
|
|
243
|
+
"c-suite/marketing-executive",
|
|
244
|
+
"c-suite/medical-health-executive",
|
|
245
|
+
"c-suite/operations-executive",
|
|
246
|
+
"c-suite/sales-executive",
|
|
247
|
+
"product-management",
|
|
248
|
+
"product-management/product-development",
|
|
249
|
+
"product-management/product-management",
|
|
250
|
+
"engineering-technical",
|
|
251
|
+
"engineering-technical/artificial-intelligence-machine-learning",
|
|
252
|
+
"engineering-technical/bioengineering",
|
|
253
|
+
"engineering-technical/biometrics",
|
|
254
|
+
"engineering-technical/business-intelligence",
|
|
255
|
+
"engineering-technical/chemical-engineering",
|
|
256
|
+
"engineering-technical/cloud-mobility",
|
|
257
|
+
"engineering-technical/data-science",
|
|
258
|
+
"engineering-technical/devops",
|
|
259
|
+
"engineering-technical/digital-transformation",
|
|
260
|
+
"engineering-technical/emerging-technology-innovation",
|
|
261
|
+
"engineering-technical/engineering-technical",
|
|
262
|
+
"engineering-technical/industrial-engineering",
|
|
263
|
+
"engineering-technical/mechanic",
|
|
264
|
+
"engineering-technical/mobile-development",
|
|
265
|
+
"engineering-technical/project-management",
|
|
266
|
+
"engineering-technical/research-development",
|
|
267
|
+
"engineering-technical/scrum-master-agile-coach",
|
|
268
|
+
"engineering-technical/software-development",
|
|
269
|
+
"engineering-technical/support-technical-services",
|
|
270
|
+
"engineering-technical/technician",
|
|
271
|
+
"engineering-technical/technology-operations",
|
|
272
|
+
"engineering-technical/test-quality-assurance",
|
|
273
|
+
"engineering-technical/ui-ux",
|
|
274
|
+
"engineering-technical/web-development",
|
|
275
|
+
"design",
|
|
276
|
+
"design/all-design",
|
|
277
|
+
"design/product-ui-ux-design",
|
|
278
|
+
"design/graphic-design",
|
|
279
|
+
"education",
|
|
280
|
+
"education/teacher",
|
|
281
|
+
"education/principal",
|
|
282
|
+
"education/superintendent",
|
|
283
|
+
"education/professor",
|
|
284
|
+
"finance",
|
|
285
|
+
"finance/accounting",
|
|
286
|
+
"finance/finance",
|
|
287
|
+
"finance/financial-planning-analysis",
|
|
288
|
+
"finance/financial-reporting",
|
|
289
|
+
"finance/financial-strategy",
|
|
290
|
+
"finance/financial-systems",
|
|
291
|
+
"finance/internal-audit-control",
|
|
292
|
+
"finance/investor-relations",
|
|
293
|
+
"finance/mergers-acquisitions",
|
|
294
|
+
"finance/real-estate-finance",
|
|
295
|
+
"finance/financial-risk",
|
|
296
|
+
"finance/shared-services",
|
|
297
|
+
"finance/sourcing-procurement",
|
|
298
|
+
"finance/tax",
|
|
299
|
+
"finance/treasury",
|
|
300
|
+
"human-resources",
|
|
301
|
+
"human-resources/compensation-benefits",
|
|
302
|
+
"human-resources/culture-diversity-inclusion",
|
|
303
|
+
"human-resources/employee-labor-relations",
|
|
304
|
+
"human-resources/health-safety",
|
|
305
|
+
"human-resources/human-resource-information-system",
|
|
306
|
+
"human-resources/human-resources",
|
|
307
|
+
"human-resources/hr-business-partner",
|
|
308
|
+
"human-resources/learning-development",
|
|
309
|
+
"human-resources/organizational-development",
|
|
310
|
+
"human-resources/recruiting-talent-acquisition",
|
|
311
|
+
"human-resources/talent-management",
|
|
312
|
+
"human-resources/workforce-management",
|
|
313
|
+
"human-resources/people-operations",
|
|
314
|
+
"information-technology",
|
|
315
|
+
"information-technology/application-development",
|
|
316
|
+
"information-technology/business-service-management-itsm",
|
|
317
|
+
"information-technology/collaboration-web-app",
|
|
318
|
+
"information-technology/data-center",
|
|
319
|
+
"information-technology/data-warehouse",
|
|
320
|
+
"information-technology/database-administration",
|
|
321
|
+
"information-technology/ecommerce-development",
|
|
322
|
+
"information-technology/enterprise-architecture",
|
|
323
|
+
"information-technology/help-desk-desktop-services",
|
|
324
|
+
"information-technology/hr-financial-erp-systems",
|
|
325
|
+
"information-technology/information-security",
|
|
326
|
+
"information-technology/information-technology",
|
|
327
|
+
"information-technology/infrastructure",
|
|
328
|
+
"information-technology/it-asset-management",
|
|
329
|
+
"information-technology/it-audit-it-compliance",
|
|
330
|
+
"information-technology/it-operations",
|
|
331
|
+
"information-technology/it-procurement",
|
|
332
|
+
"information-technology/it-strategy",
|
|
333
|
+
"information-technology/it-training",
|
|
334
|
+
"information-technology/networking",
|
|
335
|
+
"information-technology/project-program-management",
|
|
336
|
+
"information-technology/quality-assurance",
|
|
337
|
+
"information-technology/retail-store-systems",
|
|
338
|
+
"information-technology/servers",
|
|
339
|
+
"information-technology/storage-disaster-recovery",
|
|
340
|
+
"information-technology/telecommunications",
|
|
341
|
+
"information-technology/virtualization",
|
|
342
|
+
"legal",
|
|
343
|
+
"legal/acquisitions",
|
|
344
|
+
"legal/compliance",
|
|
345
|
+
"legal/contracts",
|
|
346
|
+
"legal/corporate-secretary",
|
|
347
|
+
"legal/ediscovery",
|
|
348
|
+
"legal/ethics",
|
|
349
|
+
"legal/governance",
|
|
350
|
+
"legal/governmental-affairs-regulatory-law",
|
|
351
|
+
"legal/intellectual-property-patent",
|
|
352
|
+
"legal/labor-employment",
|
|
353
|
+
"legal/lawyer-attorney",
|
|
354
|
+
"legal/legal",
|
|
355
|
+
"legal/legal-counsel",
|
|
356
|
+
"legal/legal-operations",
|
|
357
|
+
"legal/litigation",
|
|
358
|
+
"legal/privacy",
|
|
359
|
+
"marketing",
|
|
360
|
+
"marketing/advertising",
|
|
361
|
+
"marketing/brand-management",
|
|
362
|
+
"marketing/content-marketing",
|
|
363
|
+
"marketing/customer-experience",
|
|
364
|
+
"marketing/customer-marketing",
|
|
365
|
+
"marketing/demand-generation",
|
|
366
|
+
"marketing/digital-marketing",
|
|
367
|
+
"marketing/ecommerce-marketing",
|
|
368
|
+
"marketing/event-marketing",
|
|
369
|
+
"marketing/field-marketing",
|
|
370
|
+
"marketing/lead-generation",
|
|
371
|
+
"marketing/marketing",
|
|
372
|
+
"marketing/marketing-analytics-insights",
|
|
373
|
+
"marketing/marketing-communications",
|
|
374
|
+
"marketing/marketing-operations",
|
|
375
|
+
"marketing/product-marketing",
|
|
376
|
+
"marketing/public-relations",
|
|
377
|
+
"marketing/search-engine-optimization-pay-per-click",
|
|
378
|
+
"marketing/social-media-marketing",
|
|
379
|
+
"marketing/strategic-communications",
|
|
380
|
+
"marketing/technical-marketing",
|
|
381
|
+
"medical-health",
|
|
382
|
+
"medical-health/anesthesiology",
|
|
383
|
+
"medical-health/chiropractics",
|
|
384
|
+
"medical-health/clinical-systems",
|
|
385
|
+
"medical-health/dentistry",
|
|
386
|
+
"medical-health/dermatology",
|
|
387
|
+
"medical-health/doctors-physicians",
|
|
388
|
+
"medical-health/epidemiology",
|
|
389
|
+
"medical-health/first-responder",
|
|
390
|
+
"medical-health/infectious-disease",
|
|
391
|
+
"medical-health/medical-administration",
|
|
392
|
+
"medical-health/medical-education-training",
|
|
393
|
+
"medical-health/medical-research",
|
|
394
|
+
"medical-health/medicine",
|
|
395
|
+
"medical-health/neurology",
|
|
396
|
+
"medical-health/nursing",
|
|
397
|
+
"medical-health/nutrition-dietetics",
|
|
398
|
+
"medical-health/obstetrics-gynecology",
|
|
399
|
+
"medical-health/oncology",
|
|
400
|
+
"medical-health/opthalmology",
|
|
401
|
+
"medical-health/optometry",
|
|
402
|
+
"medical-health/orthopedics",
|
|
403
|
+
"medical-health/pathology",
|
|
404
|
+
"medical-health/pediatrics",
|
|
405
|
+
"medical-health/pharmacy",
|
|
406
|
+
"medical-health/physical-therapy",
|
|
407
|
+
"medical-health/psychiatry",
|
|
408
|
+
"medical-health/psychology",
|
|
409
|
+
"medical-health/public-health",
|
|
410
|
+
"medical-health/radiology",
|
|
411
|
+
"medical-health/social-work",
|
|
412
|
+
"operations",
|
|
413
|
+
"operations/call-center",
|
|
414
|
+
"operations/construction",
|
|
415
|
+
"operations/corporate-strategy",
|
|
416
|
+
"operations/customer-service-support",
|
|
417
|
+
"operations/enterprise-resource-planning",
|
|
418
|
+
"operations/facilities-management",
|
|
419
|
+
"operations/leasing",
|
|
420
|
+
"operations/logistics",
|
|
421
|
+
"operations/office-operations",
|
|
422
|
+
"operations/operations",
|
|
423
|
+
"operations/physical-security",
|
|
424
|
+
"operations/project-development",
|
|
425
|
+
"operations/quality-management",
|
|
426
|
+
"operations/real-estate",
|
|
427
|
+
"operations/safety",
|
|
428
|
+
"operations/store-operations",
|
|
429
|
+
"operations/supply-chain",
|
|
430
|
+
"sales",
|
|
431
|
+
"sales/account-management",
|
|
432
|
+
"sales/business-development",
|
|
433
|
+
"sales/channel-sales",
|
|
434
|
+
"sales/customer-retention-development",
|
|
435
|
+
"sales/customer-success",
|
|
436
|
+
"sales/field-outside-sales",
|
|
437
|
+
"sales/inside-sales",
|
|
438
|
+
"sales/partnerships",
|
|
439
|
+
"sales/revenue-operations",
|
|
440
|
+
"sales/sales",
|
|
441
|
+
"sales/sales-enablement",
|
|
442
|
+
"sales/sales-engineering",
|
|
443
|
+
"sales/sales-operations",
|
|
444
|
+
"sales/sales-training",
|
|
445
|
+
"consulting",
|
|
446
|
+
"consulting/consultant"
|
|
447
|
+
]);
|
|
448
|
+
var PositionQueryInputSchema = z.union([
|
|
449
|
+
z.string(),
|
|
450
|
+
z.array(z.string()).min(1)
|
|
451
|
+
]);
|
|
452
|
+
var PersonExcludeFiltersSchema = z.object({
|
|
453
|
+
positionQuery: z.array(z.string()).optional().describe("Current job title queries to exclude."),
|
|
454
|
+
countries: z.array(z.string()).optional().describe("2-letter country codes to exclude."),
|
|
455
|
+
domains: z.array(z.string()).optional().describe("Company domains to exclude."),
|
|
456
|
+
seniority: z.array(PersonSeniorityEnum).optional().describe("Seniority levels to exclude."),
|
|
457
|
+
department: z.array(PersonDepartmentEnum).optional().describe("Departments to exclude.")
|
|
458
|
+
}).strict();
|
|
459
|
+
var PersonSearchFilterShape = {
|
|
460
|
+
companyFilter: CompanyLookupInputSchema.optional().describe(
|
|
461
|
+
"Company filters to scope people results."
|
|
462
|
+
),
|
|
463
|
+
query: z.string().max(250).optional().describe("Name search query. This is not semantic search."),
|
|
464
|
+
positionQuery: PositionQueryInputSchema.optional().describe(
|
|
465
|
+
"Current job title query or queries. A string is accepted for backward compatibility."
|
|
466
|
+
),
|
|
467
|
+
atCurrentCompanyAfter: z.string().datetime().optional().describe(
|
|
468
|
+
"Only include people who joined their current company after this UTC datetime."
|
|
469
|
+
),
|
|
470
|
+
atCurrentCompanyBefore: z.string().datetime().optional().describe(
|
|
471
|
+
"Only include people who joined their current company before this UTC datetime."
|
|
472
|
+
),
|
|
473
|
+
atCurrentPositionAfter: z.string().datetime().optional().describe(
|
|
474
|
+
"Only include people who started their current position after this UTC datetime."
|
|
475
|
+
),
|
|
476
|
+
atCurrentPositionBefore: z.string().datetime().optional().describe(
|
|
477
|
+
"Only include people who started their current position before this UTC datetime."
|
|
478
|
+
),
|
|
479
|
+
exclude: PersonExcludeFiltersSchema.optional().describe(
|
|
480
|
+
"People exclusion filters."
|
|
481
|
+
),
|
|
482
|
+
countries: z.array(z.string()).optional().describe("2-letter country codes to filter by."),
|
|
483
|
+
domains: z.array(z.string()).max(100).optional().describe("Company domains to filter by."),
|
|
484
|
+
seniority: z.array(PersonSeniorityEnum).optional().describe("Seniority levels to filter by."),
|
|
485
|
+
department: z.array(PersonDepartmentEnum).optional().describe("Departments to filter by.")
|
|
486
|
+
};
|
|
487
|
+
var PersonIdSchema = z.union([
|
|
488
|
+
z.number().int().positive(),
|
|
489
|
+
z.string().regex(/^\d+$/, "Person ID must be a positive integer.")
|
|
490
|
+
]);
|
|
491
|
+
|
|
492
|
+
// src/utils.ts
|
|
493
|
+
async function apiRequest(baseUrl, accessToken, path, options = {}) {
|
|
494
|
+
try {
|
|
495
|
+
const response = await fetch(buildUrl(baseUrl, path, options.query), {
|
|
496
|
+
method: options.method ?? "GET",
|
|
497
|
+
headers: buildHeaders(accessToken, options.body !== void 0),
|
|
498
|
+
body: options.body === void 0 ? void 0 : JSON.stringify(options.body)
|
|
499
|
+
});
|
|
500
|
+
const errorResponse = await handleHttpError(
|
|
501
|
+
response,
|
|
502
|
+
options.notFoundMessage
|
|
503
|
+
);
|
|
504
|
+
if (errorResponse) {
|
|
505
|
+
return errorResponse;
|
|
506
|
+
}
|
|
507
|
+
const data = await readJson(response);
|
|
508
|
+
const result = attachCreditInfo(data, parseCreditHeaders(response.headers));
|
|
509
|
+
return jsonToolResult(result);
|
|
510
|
+
} catch (error) {
|
|
511
|
+
return toolError(
|
|
512
|
+
`Error calling CompanyEnrich API: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function toolError(message) {
|
|
517
|
+
return {
|
|
518
|
+
content: [
|
|
519
|
+
{
|
|
520
|
+
type: "text",
|
|
521
|
+
text: message
|
|
522
|
+
}
|
|
523
|
+
],
|
|
524
|
+
isError: true
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function buildUrl(baseUrl, path, query) {
|
|
528
|
+
const normalizedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
529
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
530
|
+
const url = new URL(`${normalizedBase}${normalizedPath}`);
|
|
531
|
+
for (const [key, value] of Object.entries(query ?? {})) {
|
|
532
|
+
appendQueryValue(url.searchParams, key, value);
|
|
533
|
+
}
|
|
534
|
+
return url.toString();
|
|
535
|
+
}
|
|
536
|
+
function appendQueryValue(searchParams, key, value) {
|
|
537
|
+
if (value === void 0 || value === null) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (Array.isArray(value)) {
|
|
541
|
+
for (const item of value) {
|
|
542
|
+
if (item !== void 0 && item !== null) {
|
|
543
|
+
searchParams.append(key, String(item));
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
searchParams.append(key, String(value));
|
|
549
|
+
}
|
|
550
|
+
function buildHeaders(accessToken, hasBody) {
|
|
551
|
+
const headers = {
|
|
552
|
+
Authorization: `Bearer ${accessToken ?? ""}`,
|
|
553
|
+
"x-companyenrich-app": "mcp"
|
|
554
|
+
};
|
|
555
|
+
if (hasBody) {
|
|
556
|
+
headers["Content-Type"] = "application/json";
|
|
557
|
+
}
|
|
558
|
+
return headers;
|
|
559
|
+
}
|
|
560
|
+
async function handleHttpError(response, notFoundMessage) {
|
|
561
|
+
if (response.ok) {
|
|
562
|
+
return null;
|
|
563
|
+
}
|
|
564
|
+
if (response.status === 404 && notFoundMessage) {
|
|
565
|
+
return toolError(notFoundMessage);
|
|
566
|
+
}
|
|
567
|
+
const bodyMessage = await readErrorMessage(response);
|
|
568
|
+
const statusMessage = getStatusMessage(response.status);
|
|
569
|
+
const message = bodyMessage ? `${statusMessage}: ${bodyMessage}` : statusMessage;
|
|
570
|
+
return toolError(message);
|
|
571
|
+
}
|
|
572
|
+
function getStatusMessage(status) {
|
|
573
|
+
if (status === 400) {
|
|
574
|
+
return "Invalid request";
|
|
575
|
+
}
|
|
576
|
+
if (status === 401) {
|
|
577
|
+
return "Authentication failed. Please check your API key.";
|
|
578
|
+
}
|
|
579
|
+
if (status === 402) {
|
|
580
|
+
return "Insufficient credits. Please check your account balance.";
|
|
581
|
+
}
|
|
582
|
+
if (status === 403) {
|
|
583
|
+
return "Forbidden. Your API key does not have access to this endpoint.";
|
|
584
|
+
}
|
|
585
|
+
if (status === 404) {
|
|
586
|
+
return "Resource not found in the database.";
|
|
587
|
+
}
|
|
588
|
+
if (status === 429) {
|
|
589
|
+
return "Rate limit exceeded. Please try again later.";
|
|
590
|
+
}
|
|
591
|
+
return `Error ${status}`;
|
|
592
|
+
}
|
|
593
|
+
async function readErrorMessage(response) {
|
|
594
|
+
const text = await response.text();
|
|
595
|
+
if (!text) {
|
|
596
|
+
return void 0;
|
|
597
|
+
}
|
|
598
|
+
try {
|
|
599
|
+
const parsed = JSON.parse(text);
|
|
600
|
+
return extractProblemMessage(parsed) ?? text;
|
|
601
|
+
} catch {
|
|
602
|
+
return text;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function extractProblemMessage(value) {
|
|
606
|
+
if (!isRecord(value)) {
|
|
607
|
+
return void 0;
|
|
608
|
+
}
|
|
609
|
+
const detail = readString(value.detail);
|
|
610
|
+
if (detail) {
|
|
611
|
+
return detail;
|
|
612
|
+
}
|
|
613
|
+
const title = readString(value.title);
|
|
614
|
+
if (title) {
|
|
615
|
+
return title;
|
|
616
|
+
}
|
|
617
|
+
const errors = value.errors;
|
|
618
|
+
if (isRecord(errors)) {
|
|
619
|
+
const messages = Object.entries(errors).flatMap(([field, fieldErrors]) => {
|
|
620
|
+
if (Array.isArray(fieldErrors)) {
|
|
621
|
+
return fieldErrors.map((error) => `${field}: ${String(error)}`);
|
|
622
|
+
}
|
|
623
|
+
return [`${field}: ${String(fieldErrors)}`];
|
|
624
|
+
});
|
|
625
|
+
if (messages.length > 0) {
|
|
626
|
+
return messages.join("; ");
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return void 0;
|
|
630
|
+
}
|
|
631
|
+
async function readJson(response) {
|
|
632
|
+
const text = await response.text();
|
|
633
|
+
if (!text) {
|
|
634
|
+
return {};
|
|
635
|
+
}
|
|
636
|
+
return JSON.parse(text);
|
|
637
|
+
}
|
|
638
|
+
function parseCreditHeaders(headers) {
|
|
639
|
+
const balance = readNumberHeader(headers, "x-credit-balance");
|
|
640
|
+
const cost = readNumberHeader(headers, "x-credit-cost");
|
|
641
|
+
const remaining = readNumberHeader(headers, "x-credit-remaining");
|
|
642
|
+
if (balance === void 0 && cost === void 0 && remaining === void 0) {
|
|
643
|
+
return void 0;
|
|
644
|
+
}
|
|
645
|
+
return { balance, cost, remaining };
|
|
646
|
+
}
|
|
647
|
+
function readNumberHeader(headers, name) {
|
|
648
|
+
const raw = headers.get(name);
|
|
649
|
+
if (raw === null) {
|
|
650
|
+
return void 0;
|
|
651
|
+
}
|
|
652
|
+
const num = Number(raw);
|
|
653
|
+
return Number.isFinite(num) ? num : void 0;
|
|
654
|
+
}
|
|
655
|
+
function attachCreditInfo(data, creditInfo) {
|
|
656
|
+
if (!creditInfo) {
|
|
657
|
+
return data;
|
|
658
|
+
}
|
|
659
|
+
if (isRecord(data)) {
|
|
660
|
+
return {
|
|
661
|
+
...data,
|
|
662
|
+
creditInfo
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
data,
|
|
667
|
+
creditInfo
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function jsonToolResult(data) {
|
|
671
|
+
const structuredContent = isRecord(data) ? data : { data };
|
|
672
|
+
return {
|
|
673
|
+
content: [
|
|
674
|
+
{
|
|
675
|
+
type: "text",
|
|
676
|
+
text: JSON.stringify(data)
|
|
677
|
+
}
|
|
678
|
+
],
|
|
679
|
+
structuredContent
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function readString(value) {
|
|
683
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
684
|
+
}
|
|
685
|
+
function isRecord(value) {
|
|
686
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// src/mcp.ts
|
|
690
|
+
var companyCommonFilterKeys = [
|
|
691
|
+
"foundedYear",
|
|
692
|
+
"fundingAmount",
|
|
693
|
+
"fundingYear",
|
|
694
|
+
"categoryOperator",
|
|
695
|
+
"keywordsOperator",
|
|
696
|
+
"technologiesOperator",
|
|
697
|
+
"workforceGrowth",
|
|
698
|
+
"workforceSize",
|
|
699
|
+
"require",
|
|
700
|
+
"regions",
|
|
701
|
+
"states",
|
|
702
|
+
"cities",
|
|
703
|
+
"type",
|
|
704
|
+
"employees",
|
|
705
|
+
"revenue",
|
|
706
|
+
"naicsCode",
|
|
707
|
+
"keywords",
|
|
708
|
+
"technologies",
|
|
709
|
+
"fundingRounds"
|
|
710
|
+
];
|
|
711
|
+
var personSearchFilterKeys = [
|
|
712
|
+
"query",
|
|
713
|
+
"atCurrentCompanyAfter",
|
|
714
|
+
"atCurrentCompanyBefore",
|
|
715
|
+
"atCurrentPositionAfter",
|
|
716
|
+
"atCurrentPositionBefore",
|
|
717
|
+
"countries",
|
|
718
|
+
"domains",
|
|
719
|
+
"seniority",
|
|
720
|
+
"department"
|
|
721
|
+
];
|
|
722
|
+
var pageInputShape = {
|
|
723
|
+
page: z2.number().int().min(1).optional().default(1).describe("Page number, 1-indexed."),
|
|
724
|
+
pageSize: z2.number().int().min(1).max(100).optional().default(20).describe("Number of results per page, from 1 to 100.")
|
|
725
|
+
};
|
|
726
|
+
var includeWorkforceShape = {
|
|
727
|
+
includeWorkforce: z2.boolean().optional().default(false).describe(
|
|
728
|
+
"When true, requests expanded workforce insights. Costs 5 additional credits per company."
|
|
729
|
+
)
|
|
730
|
+
};
|
|
731
|
+
var serverInfo = {
|
|
732
|
+
name: "CompanyEnrich MCP Server",
|
|
733
|
+
version
|
|
734
|
+
};
|
|
735
|
+
var toolsListCacheHint = {
|
|
736
|
+
ttlMs: 60 * 60 * 1e3,
|
|
737
|
+
cacheScope: "private"
|
|
738
|
+
};
|
|
739
|
+
function withToolAnnotations(config, annotations) {
|
|
740
|
+
return {
|
|
741
|
+
...config,
|
|
742
|
+
annotations: {
|
|
743
|
+
title: config.title,
|
|
744
|
+
...annotations
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function paidTool(config) {
|
|
749
|
+
return withToolAnnotations(config, {
|
|
750
|
+
readOnlyHint: false,
|
|
751
|
+
destructiveHint: false
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
function readOnlyTool(config) {
|
|
755
|
+
return withToolAnnotations(config, { readOnlyHint: true });
|
|
756
|
+
}
|
|
757
|
+
function createCompanyEnrichMcpServer({
|
|
758
|
+
apiEndpoint: apiEndpoint2,
|
|
759
|
+
getAccessToken
|
|
760
|
+
}) {
|
|
761
|
+
const server = new McpServer(serverInfo, {
|
|
762
|
+
cacheHints: { "tools/list": toolsListCacheHint }
|
|
763
|
+
});
|
|
764
|
+
const request = (path, options = {}) => apiRequest(apiEndpoint2, getAccessToken(), path, options);
|
|
765
|
+
server.registerTool(
|
|
766
|
+
"enrich_company",
|
|
767
|
+
paidTool({
|
|
768
|
+
title: "Enrich Company Information",
|
|
769
|
+
description: "Enriches a company by domain. Costs 1 credit per call, plus 5 additional credits when includeWorkforce is true.",
|
|
770
|
+
inputSchema: z2.object({
|
|
771
|
+
domain: z2.string().describe(
|
|
772
|
+
"The domain name of the company to enrich, for example example.com."
|
|
773
|
+
),
|
|
774
|
+
...includeWorkforceShape
|
|
775
|
+
})
|
|
776
|
+
}),
|
|
777
|
+
async ({ domain, includeWorkforce = false }) => request("/companies/enrich", {
|
|
778
|
+
query: {
|
|
779
|
+
domain,
|
|
780
|
+
...workforceQuery(includeWorkforce)
|
|
781
|
+
},
|
|
782
|
+
notFoundMessage: `Company with domain "${domain}" not found in the database.`
|
|
783
|
+
})
|
|
784
|
+
);
|
|
785
|
+
server.registerTool(
|
|
786
|
+
"get_company_by_id",
|
|
787
|
+
paidTool({
|
|
788
|
+
title: "Get Company By ID",
|
|
789
|
+
description: "Retrieves a company by CompanyEnrich company ID. Costs 1 credit per call, plus 5 additional credits when includeWorkforce is true.",
|
|
790
|
+
inputSchema: z2.object({
|
|
791
|
+
id: z2.string().uuid().describe("CompanyEnrich company ID."),
|
|
792
|
+
...includeWorkforceShape
|
|
793
|
+
})
|
|
794
|
+
}),
|
|
795
|
+
async ({ id, includeWorkforce = false }) => request("/companies", {
|
|
796
|
+
query: {
|
|
797
|
+
id,
|
|
798
|
+
...workforceQuery(includeWorkforce)
|
|
799
|
+
},
|
|
800
|
+
notFoundMessage: `Company with ID "${id}" not found in the database.`
|
|
801
|
+
})
|
|
802
|
+
);
|
|
803
|
+
server.registerTool(
|
|
804
|
+
"enrich_company_by_properties",
|
|
805
|
+
paidTool({
|
|
806
|
+
title: "Enrich Company By Properties",
|
|
807
|
+
description: "Enriches a company by known properties such as name or social profile URL. Costs 1 credit per call, plus 5 additional credits when includeWorkforce is true.",
|
|
808
|
+
inputSchema: z2.object({
|
|
809
|
+
...EnrichCompanyByPropertiesShape,
|
|
810
|
+
...includeWorkforceShape
|
|
811
|
+
})
|
|
812
|
+
}),
|
|
813
|
+
async ({ includeWorkforce = false, ...input }) => {
|
|
814
|
+
const body = buildEnrichCompanyBody(input);
|
|
815
|
+
if (Object.keys(body).length === 0) {
|
|
816
|
+
return toolError(
|
|
817
|
+
"Provide at least one company property: name, linkedinUrl, linkedinId, twitterUrl, facebookUrl, instagramUrl, or youtubeUrl."
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
return request("/companies/enrich", {
|
|
821
|
+
method: "POST",
|
|
822
|
+
query: workforceQuery(includeWorkforce),
|
|
823
|
+
body,
|
|
824
|
+
notFoundMessage: "Company matching the provided properties was not found in the database."
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
);
|
|
828
|
+
server.registerTool(
|
|
829
|
+
"get_company_workforce",
|
|
830
|
+
paidTool({
|
|
831
|
+
title: "Get Company Workforce Insights",
|
|
832
|
+
description: "Returns workforce insights for a single company by CompanyEnrich company ID or domain. Costs 5 credits per successful call.",
|
|
833
|
+
inputSchema: z2.object({
|
|
834
|
+
id: z2.string().uuid().optional().describe(
|
|
835
|
+
"CompanyEnrich company ID. Provide either id or domain."
|
|
836
|
+
),
|
|
837
|
+
domain: z2.string().optional().describe(
|
|
838
|
+
"Company domain. Provide either id or domain."
|
|
839
|
+
)
|
|
840
|
+
})
|
|
841
|
+
}),
|
|
842
|
+
async ({ id, domain }) => {
|
|
843
|
+
if (id && domain || !id && !domain) {
|
|
844
|
+
return toolError(
|
|
845
|
+
"Provide exactly one lookup parameter: id or domain."
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
return request("/companies/workforce", {
|
|
849
|
+
query: { id, domain },
|
|
850
|
+
notFoundMessage: `Workforce insights for "${id ?? domain}" were not found in the database.`
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
);
|
|
854
|
+
server.registerTool(
|
|
855
|
+
"search_companies",
|
|
856
|
+
paidTool({
|
|
857
|
+
title: "Search Companies",
|
|
858
|
+
description: "Searches companies with page-based pagination. semanticQuery is optional; use it for natural-language profile search, and use query for name/domain focused searches. Costs 1 credit per company returned, with a 1-credit minimum.",
|
|
859
|
+
inputSchema: z2.object({
|
|
860
|
+
...CompanySearchFilterShape,
|
|
861
|
+
...includeWorkforceShape,
|
|
862
|
+
...pageInputShape
|
|
863
|
+
})
|
|
864
|
+
}),
|
|
865
|
+
async (input) => {
|
|
866
|
+
const {
|
|
867
|
+
includeWorkforce = false,
|
|
868
|
+
page = 1,
|
|
869
|
+
pageSize = 20
|
|
870
|
+
} = input;
|
|
871
|
+
return request("/companies/search", {
|
|
872
|
+
method: "POST",
|
|
873
|
+
query: workforceQuery(includeWorkforce),
|
|
874
|
+
body: {
|
|
875
|
+
...buildCompanySearchBody(input),
|
|
876
|
+
page,
|
|
877
|
+
pageSize
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
server.registerTool(
|
|
883
|
+
"find_similar_companies",
|
|
884
|
+
paidTool({
|
|
885
|
+
title: "Find Similar Companies",
|
|
886
|
+
description: "Finds companies similar to one or more seed domains, with optional filters. Costs 5 credits per company returned, with a 5-credit minimum.",
|
|
887
|
+
inputSchema: z2.object({
|
|
888
|
+
...CompanySimilarFilterShape,
|
|
889
|
+
...includeWorkforceShape,
|
|
890
|
+
...pageInputShape
|
|
891
|
+
})
|
|
892
|
+
}),
|
|
893
|
+
async (input) => {
|
|
894
|
+
const {
|
|
895
|
+
includeWorkforce = false,
|
|
896
|
+
page = 1,
|
|
897
|
+
pageSize = 20
|
|
898
|
+
} = input;
|
|
899
|
+
return request("/companies/similar", {
|
|
900
|
+
method: "POST",
|
|
901
|
+
query: workforceQuery(includeWorkforce),
|
|
902
|
+
body: {
|
|
903
|
+
...buildCompanySimilarBody(input),
|
|
904
|
+
page,
|
|
905
|
+
pageSize
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
server.registerTool(
|
|
911
|
+
"get_person_by_id",
|
|
912
|
+
paidTool({
|
|
913
|
+
title: "Get Person By ID",
|
|
914
|
+
description: "Retrieves a person by CompanyEnrich person ID. Costs 2 credits per call.",
|
|
915
|
+
inputSchema: z2.object({
|
|
916
|
+
id: PersonIdSchema.describe("CompanyEnrich person ID.")
|
|
917
|
+
})
|
|
918
|
+
}),
|
|
919
|
+
async ({ id }) => request("/people", {
|
|
920
|
+
query: { id },
|
|
921
|
+
notFoundMessage: `Person with ID "${id}" not found in the database.`
|
|
922
|
+
})
|
|
923
|
+
);
|
|
924
|
+
server.registerTool(
|
|
925
|
+
"lookup_person_by_email",
|
|
926
|
+
paidTool({
|
|
927
|
+
title: "Lookup Person By Email",
|
|
928
|
+
description: "Looks up a person by email address. The API resolves the company from the email domain and matches the local part. Costs 5 credits per successful call.",
|
|
929
|
+
inputSchema: z2.object({
|
|
930
|
+
email: z2.string().email().describe(
|
|
931
|
+
"The email address of the person to look up."
|
|
932
|
+
)
|
|
933
|
+
})
|
|
934
|
+
}),
|
|
935
|
+
async ({ email }) => request("/people/lookup", {
|
|
936
|
+
method: "POST",
|
|
937
|
+
body: { email },
|
|
938
|
+
notFoundMessage: `Person with email "${email}" not found in the database.`
|
|
939
|
+
})
|
|
940
|
+
);
|
|
941
|
+
server.registerTool(
|
|
942
|
+
"enrich_person_email",
|
|
943
|
+
paidTool({
|
|
944
|
+
title: "Enrich Person Email",
|
|
945
|
+
description: "BETA: Resolves a work email address for a single person ID and optional company domain. Costs 10 credits per newly accessed found email.",
|
|
946
|
+
inputSchema: z2.object({
|
|
947
|
+
id: PersonIdSchema.describe("CompanyEnrich person ID."),
|
|
948
|
+
domain: z2.string().optional().describe(
|
|
949
|
+
"Optional company domain. If omitted, current experience domains are tried."
|
|
950
|
+
)
|
|
951
|
+
})
|
|
952
|
+
}),
|
|
953
|
+
async ({ id, domain }) => request("/people/email", {
|
|
954
|
+
query: { id, domain },
|
|
955
|
+
notFoundMessage: `Email enrichment target person "${id}" was not found in the database.`
|
|
956
|
+
})
|
|
957
|
+
);
|
|
958
|
+
server.registerTool(
|
|
959
|
+
"search_people",
|
|
960
|
+
paidTool({
|
|
961
|
+
title: "Search People",
|
|
962
|
+
description: "Searches people with page-based pagination. positionQuery accepts either one string or an array of strings. Costs 2 credits per person returned, with a 2-credit minimum.",
|
|
963
|
+
inputSchema: z2.object({
|
|
964
|
+
...PersonSearchFilterShape,
|
|
965
|
+
...pageInputShape
|
|
966
|
+
})
|
|
967
|
+
}),
|
|
968
|
+
async (input) => {
|
|
969
|
+
const { page = 1, pageSize = 20 } = input;
|
|
970
|
+
return request("/people/search", {
|
|
971
|
+
method: "POST",
|
|
972
|
+
body: {
|
|
973
|
+
...buildPersonSearchBody(input),
|
|
974
|
+
page,
|
|
975
|
+
pageSize
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
server.registerTool(
|
|
981
|
+
"get_current_user",
|
|
982
|
+
readOnlyTool({
|
|
983
|
+
title: "Get Current User",
|
|
984
|
+
description: "Returns authenticated user credit balance and account capabilities. Free; no credits deducted.",
|
|
985
|
+
inputSchema: z2.object({})
|
|
986
|
+
}),
|
|
987
|
+
async () => request("/me")
|
|
988
|
+
);
|
|
989
|
+
return server;
|
|
990
|
+
}
|
|
991
|
+
function workforceQuery(includeWorkforce) {
|
|
992
|
+
return includeWorkforce ? { expand: "workforce" } : void 0;
|
|
993
|
+
}
|
|
994
|
+
function buildEnrichCompanyBody(input) {
|
|
995
|
+
const body = {};
|
|
996
|
+
copyDefined(body, input, [
|
|
997
|
+
"name",
|
|
998
|
+
"linkedinUrl",
|
|
999
|
+
"linkedinId",
|
|
1000
|
+
"twitterUrl",
|
|
1001
|
+
"facebookUrl",
|
|
1002
|
+
"instagramUrl"
|
|
1003
|
+
]);
|
|
1004
|
+
if (input.youtubeUrl !== void 0) {
|
|
1005
|
+
body.youTubeUrl = input.youtubeUrl;
|
|
1006
|
+
}
|
|
1007
|
+
return body;
|
|
1008
|
+
}
|
|
1009
|
+
function buildCompanySearchBody(input) {
|
|
1010
|
+
const body = buildCompanyCommonFilterBody(input);
|
|
1011
|
+
copyDefined(body, input, ["semanticQuery", "semanticWeight", "query"]);
|
|
1012
|
+
return body;
|
|
1013
|
+
}
|
|
1014
|
+
function buildCompanySimilarBody(input) {
|
|
1015
|
+
const body = buildCompanyCommonFilterBody(input);
|
|
1016
|
+
copyDefined(body, input, [
|
|
1017
|
+
"domains",
|
|
1018
|
+
"similarityWeight",
|
|
1019
|
+
"minScore",
|
|
1020
|
+
"query"
|
|
1021
|
+
]);
|
|
1022
|
+
return body;
|
|
1023
|
+
}
|
|
1024
|
+
function buildCompanyCommonFilterBody(input) {
|
|
1025
|
+
const body = {};
|
|
1026
|
+
copyDefined(body, input, companyCommonFilterKeys);
|
|
1027
|
+
const countries = uniqueDefinedStrings([
|
|
1028
|
+
...Array.isArray(input.countries) ? input.countries : [],
|
|
1029
|
+
input.country
|
|
1030
|
+
]);
|
|
1031
|
+
if (countries.length > 0) {
|
|
1032
|
+
body.countries = countries;
|
|
1033
|
+
}
|
|
1034
|
+
if (input.categories !== void 0) {
|
|
1035
|
+
body.category = input.categories;
|
|
1036
|
+
}
|
|
1037
|
+
if (isRecord2(input.exclude)) {
|
|
1038
|
+
body.exclude = buildCompanyExcludeBody(input.exclude);
|
|
1039
|
+
}
|
|
1040
|
+
return body;
|
|
1041
|
+
}
|
|
1042
|
+
function buildCompanyExcludeBody(input) {
|
|
1043
|
+
const body = {};
|
|
1044
|
+
const excludeKeys = Object.keys(CompanyExcludeFiltersSchema.shape).filter(
|
|
1045
|
+
(key) => key !== "categories"
|
|
1046
|
+
);
|
|
1047
|
+
copyDefined(body, input, excludeKeys);
|
|
1048
|
+
if (input.categories !== void 0) {
|
|
1049
|
+
body.category = input.categories;
|
|
1050
|
+
}
|
|
1051
|
+
return body;
|
|
1052
|
+
}
|
|
1053
|
+
function buildPersonSearchBody(input) {
|
|
1054
|
+
const body = {};
|
|
1055
|
+
copyDefined(body, input, personSearchFilterKeys);
|
|
1056
|
+
if (input.positionQuery !== void 0) {
|
|
1057
|
+
body.positionQuery = normalizeStringArray(input.positionQuery);
|
|
1058
|
+
}
|
|
1059
|
+
if (isRecord2(input.exclude)) {
|
|
1060
|
+
body.exclude = buildPersonExcludeBody(input.exclude);
|
|
1061
|
+
}
|
|
1062
|
+
if (isRecord2(input.companyFilter)) {
|
|
1063
|
+
body.companyFilter = buildCompanyLookupBody(input.companyFilter);
|
|
1064
|
+
}
|
|
1065
|
+
return body;
|
|
1066
|
+
}
|
|
1067
|
+
function buildPersonExcludeBody(input) {
|
|
1068
|
+
const body = {};
|
|
1069
|
+
copyDefined(body, input, [
|
|
1070
|
+
"countries",
|
|
1071
|
+
"domains",
|
|
1072
|
+
"seniority",
|
|
1073
|
+
"department"
|
|
1074
|
+
]);
|
|
1075
|
+
if (input.positionQuery !== void 0) {
|
|
1076
|
+
body.positionQuery = normalizeStringArray(input.positionQuery);
|
|
1077
|
+
}
|
|
1078
|
+
return body;
|
|
1079
|
+
}
|
|
1080
|
+
function buildCompanyLookupBody(input) {
|
|
1081
|
+
const body = {};
|
|
1082
|
+
const parsed = CompanyLookupInputSchema.parse(input);
|
|
1083
|
+
if (parsed.search !== void 0) {
|
|
1084
|
+
body.search = buildCompanySearchBody(parsed.search);
|
|
1085
|
+
}
|
|
1086
|
+
if (parsed.similar !== void 0) {
|
|
1087
|
+
body.similar = buildCompanySimilarBody(parsed.similar);
|
|
1088
|
+
}
|
|
1089
|
+
return body;
|
|
1090
|
+
}
|
|
1091
|
+
function copyDefined(target, source, keys) {
|
|
1092
|
+
for (const key of keys) {
|
|
1093
|
+
if (source[key] !== void 0) {
|
|
1094
|
+
target[key] = source[key];
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
function normalizeStringArray(value) {
|
|
1099
|
+
if (Array.isArray(value)) {
|
|
1100
|
+
return value.filter((item) => typeof item === "string");
|
|
1101
|
+
}
|
|
1102
|
+
return typeof value === "string" ? [value] : [];
|
|
1103
|
+
}
|
|
1104
|
+
function uniqueDefinedStrings(values) {
|
|
1105
|
+
return [
|
|
1106
|
+
...new Set(
|
|
1107
|
+
values.filter(
|
|
1108
|
+
(value) => typeof value === "string"
|
|
1109
|
+
)
|
|
1110
|
+
)
|
|
1111
|
+
];
|
|
1112
|
+
}
|
|
1113
|
+
function isRecord2(value) {
|
|
1114
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// src/stdio.ts
|
|
1118
|
+
var DEFAULT_API_URL = "https://api.companyenrich.com";
|
|
1119
|
+
var apiKey = process.env.COMPANYENRICH_API_KEY?.trim();
|
|
1120
|
+
if (!apiKey) {
|
|
1121
|
+
console.error(
|
|
1122
|
+
"COMPANYENRICH_API_KEY is not set. Create an API key at https://app.companyenrich.com/access-keys and pass it in this server's environment."
|
|
1123
|
+
);
|
|
1124
|
+
process.exit(1);
|
|
1125
|
+
}
|
|
1126
|
+
var apiEndpoint = process.env.COMPANYENRICH_API_URL?.trim() || DEFAULT_API_URL;
|
|
1127
|
+
serveStdio(
|
|
1128
|
+
() => createCompanyEnrichMcpServer({
|
|
1129
|
+
apiEndpoint,
|
|
1130
|
+
getAccessToken: () => apiKey
|
|
1131
|
+
}),
|
|
1132
|
+
{
|
|
1133
|
+
legacy: "serve",
|
|
1134
|
+
onerror: (error) => console.error("MCP stdio:", error.message)
|
|
1135
|
+
}
|
|
1136
|
+
);
|