@cognilead/mcp-server 0.1.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 +138 -0
- package/dist/api-client.d.ts +7 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +50 -0
- package/dist/api-client.js.map +1 -0
- package/dist/auth.d.ts +25 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +62 -0
- package/dist/auth.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +21 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +5 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +169 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +153 -0
- package/dist/index.js.map +1 -0
- package/dist/rate-limit.d.ts +17 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +80 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/schemas.d.ts +384 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +206 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tools/check-registry-flags.d.ts +2 -0
- package/dist/tools/check-registry-flags.d.ts.map +1 -0
- package/dist/tools/check-registry-flags.js +31 -0
- package/dist/tools/check-registry-flags.js.map +1 -0
- package/dist/tools/draft-pitch.d.ts +15 -0
- package/dist/tools/draft-pitch.d.ts.map +1 -0
- package/dist/tools/draft-pitch.js +69 -0
- package/dist/tools/draft-pitch.js.map +1 -0
- package/dist/tools/evidence-export.d.ts +7 -0
- package/dist/tools/evidence-export.d.ts.map +1 -0
- package/dist/tools/evidence-export.js +42 -0
- package/dist/tools/evidence-export.js.map +1 -0
- package/dist/tools/find-companies-with-triggers.d.ts +2 -0
- package/dist/tools/find-companies-with-triggers.d.ts.map +1 -0
- package/dist/tools/find-companies-with-triggers.js +29 -0
- package/dist/tools/find-companies-with-triggers.js.map +1 -0
- package/dist/tools/generate-seo-content.d.ts +2 -0
- package/dist/tools/generate-seo-content.d.ts.map +1 -0
- package/dist/tools/generate-seo-content.js +14 -0
- package/dist/tools/generate-seo-content.js.map +1 -0
- package/dist/tools/get-business-sheet.d.ts +2 -0
- package/dist/tools/get-business-sheet.d.ts.map +1 -0
- package/dist/tools/get-business-sheet.js +24 -0
- package/dist/tools/get-business-sheet.js.map +1 -0
- package/dist/tools/ingest-lead.d.ts +2 -0
- package/dist/tools/ingest-lead.d.ts.map +1 -0
- package/dist/tools/ingest-lead.js +26 -0
- package/dist/tools/ingest-lead.js.map +1 -0
- package/dist/tools/rank-companies-in-vertical.d.ts +2 -0
- package/dist/tools/rank-companies-in-vertical.d.ts.map +1 -0
- package/dist/tools/rank-companies-in-vertical.js +33 -0
- package/dist/tools/rank-companies-in-vertical.js.map +1 -0
- package/dist/tools/run-campaign.d.ts +2 -0
- package/dist/tools/run-campaign.d.ts.map +1 -0
- package/dist/tools/run-campaign.js +15 -0
- package/dist/tools/run-campaign.js.map +1 -0
- package/dist/tools/score-dd-risk.d.ts +2 -0
- package/dist/tools/score-dd-risk.d.ts.map +1 -0
- package/dist/tools/score-dd-risk.js +22 -0
- package/dist/tools/score-dd-risk.js.map +1 -0
- package/dist/tools/score-signal.d.ts +15 -0
- package/dist/tools/score-signal.d.ts.map +1 -0
- package/dist/tools/score-signal.js +124 -0
- package/dist/tools/score-signal.js.map +1 -0
- package/dist/tools/suppress.d.ts +2 -0
- package/dist/tools/suppress.d.ts.map +1 -0
- package/dist/tools/suppress.js +13 -0
- package/dist/tools/suppress.js.map +1 -0
- package/package.json +70 -0
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// Zod schemas for tool inputs + hand-rolled JSON Schemas that the MCP
|
|
2
|
+
// `tools/list` response advertises. We hand-roll the JSON Schemas to keep
|
|
3
|
+
// runtime deps to just `@modelcontextprotocol/sdk` and `zod` — pulling in
|
|
4
|
+
// `zod-to-json-schema` would bloat the bin for no real win at this size.
|
|
5
|
+
//
|
|
6
|
+
// IMPORTANT: keep the JSON Schemas in lockstep with the zod schemas below.
|
|
7
|
+
// Both ship the same contract; zod enforces it at runtime, JSON Schema
|
|
8
|
+
// advertises it to the IDE.
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
// ─── Common sub-schemas ─────────────────────────────────────────────────
|
|
11
|
+
const SignalShape = z.object({
|
|
12
|
+
source: z.string().min(1).optional(),
|
|
13
|
+
source_url: z.string().url().nullable().optional(),
|
|
14
|
+
description: z.string().optional(),
|
|
15
|
+
raw_payload: z.record(z.unknown()).optional(),
|
|
16
|
+
});
|
|
17
|
+
const Iso3166 = z.string().length(2);
|
|
18
|
+
// ─── draft_pitch ────────────────────────────────────────────────────────
|
|
19
|
+
export const DraftPitchInput = z.object({
|
|
20
|
+
company_domain: z.string().min(3),
|
|
21
|
+
company_name: z.string().min(1),
|
|
22
|
+
target_product: z.string().min(1),
|
|
23
|
+
signal: SignalShape,
|
|
24
|
+
jurisdiction: Iso3166.default('US'),
|
|
25
|
+
});
|
|
26
|
+
export const DraftPitchJsonSchema = {
|
|
27
|
+
type: 'object',
|
|
28
|
+
required: ['company_domain', 'company_name', 'target_product', 'signal'],
|
|
29
|
+
properties: {
|
|
30
|
+
company_domain: { type: 'string', minLength: 3, description: 'Company domain, e.g. acme.com' },
|
|
31
|
+
company_name: { type: 'string', minLength: 1 },
|
|
32
|
+
target_product: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Your product being pitched, e.g. chainlog, payprimitives',
|
|
35
|
+
},
|
|
36
|
+
signal: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
source: { type: 'string' },
|
|
40
|
+
source_url: { type: ['string', 'null'], format: 'uri' },
|
|
41
|
+
description: { type: 'string' },
|
|
42
|
+
raw_payload: { type: 'object', additionalProperties: true },
|
|
43
|
+
},
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
},
|
|
46
|
+
jurisdiction: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
minLength: 2,
|
|
49
|
+
maxLength: 2,
|
|
50
|
+
default: 'US',
|
|
51
|
+
description: 'ISO 3166 alpha-2 country code; drives EU/CH model routing',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
};
|
|
56
|
+
// ─── score_signal ───────────────────────────────────────────────────────
|
|
57
|
+
export const ScoreSignalInput = z.object({
|
|
58
|
+
signal: SignalShape.extend({
|
|
59
|
+
source: z.string().min(1),
|
|
60
|
+
scraped_at: z.string().datetime().optional(),
|
|
61
|
+
}),
|
|
62
|
+
target_product: z.string().min(1),
|
|
63
|
+
});
|
|
64
|
+
export const ScoreSignalJsonSchema = {
|
|
65
|
+
type: 'object',
|
|
66
|
+
required: ['signal', 'target_product'],
|
|
67
|
+
properties: {
|
|
68
|
+
signal: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
required: ['source'],
|
|
71
|
+
properties: {
|
|
72
|
+
source: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'e.g. github_repo, hn_who_hiring, apify_linkedin_jobs',
|
|
75
|
+
},
|
|
76
|
+
source_url: { type: ['string', 'null'], format: 'uri' },
|
|
77
|
+
description: { type: 'string' },
|
|
78
|
+
scraped_at: { type: 'string', format: 'date-time' },
|
|
79
|
+
raw_payload: { type: 'object', additionalProperties: true },
|
|
80
|
+
},
|
|
81
|
+
additionalProperties: false,
|
|
82
|
+
},
|
|
83
|
+
target_product: { type: 'string', minLength: 1 },
|
|
84
|
+
},
|
|
85
|
+
additionalProperties: false,
|
|
86
|
+
};
|
|
87
|
+
// ─── ingest_lead ────────────────────────────────────────────────────────
|
|
88
|
+
// Mirrors /api/v1/leads POST body shape exactly.
|
|
89
|
+
export const IngestLeadInput = z.object({
|
|
90
|
+
company_domain: z.string().min(3),
|
|
91
|
+
company_name: z.string().min(1),
|
|
92
|
+
target_product: z.string().min(1),
|
|
93
|
+
best_contact_email: z.string().email().nullable(),
|
|
94
|
+
contact_role_class: z
|
|
95
|
+
.enum(['eng_lead', 'cto', 'founder', 'recruit', 'unknown'])
|
|
96
|
+
.nullable(),
|
|
97
|
+
jurisdiction: Iso3166,
|
|
98
|
+
technical_hook_text: z.string().nullable(),
|
|
99
|
+
technical_hook_verified: z.boolean(),
|
|
100
|
+
signal_ids: z.array(z.string()),
|
|
101
|
+
fit_score: z.number().int().min(0).max(100).nullable(),
|
|
102
|
+
});
|
|
103
|
+
export const IngestLeadJsonSchema = {
|
|
104
|
+
type: 'object',
|
|
105
|
+
required: [
|
|
106
|
+
'company_domain',
|
|
107
|
+
'company_name',
|
|
108
|
+
'target_product',
|
|
109
|
+
'best_contact_email',
|
|
110
|
+
'contact_role_class',
|
|
111
|
+
'jurisdiction',
|
|
112
|
+
'technical_hook_text',
|
|
113
|
+
'technical_hook_verified',
|
|
114
|
+
'signal_ids',
|
|
115
|
+
'fit_score',
|
|
116
|
+
],
|
|
117
|
+
properties: {
|
|
118
|
+
company_domain: { type: 'string', minLength: 3 },
|
|
119
|
+
company_name: { type: 'string', minLength: 1 },
|
|
120
|
+
target_product: { type: 'string', minLength: 1 },
|
|
121
|
+
best_contact_email: { type: ['string', 'null'], format: 'email' },
|
|
122
|
+
contact_role_class: {
|
|
123
|
+
type: ['string', 'null'],
|
|
124
|
+
enum: ['eng_lead', 'cto', 'founder', 'recruit', 'unknown', null],
|
|
125
|
+
},
|
|
126
|
+
jurisdiction: { type: 'string', minLength: 2, maxLength: 2 },
|
|
127
|
+
technical_hook_text: { type: ['string', 'null'] },
|
|
128
|
+
technical_hook_verified: { type: 'boolean' },
|
|
129
|
+
signal_ids: { type: 'array', items: { type: 'string' } },
|
|
130
|
+
fit_score: { type: ['integer', 'null'], minimum: 0, maximum: 100 },
|
|
131
|
+
},
|
|
132
|
+
additionalProperties: false,
|
|
133
|
+
};
|
|
134
|
+
// ─── run_campaign ───────────────────────────────────────────────────────
|
|
135
|
+
export const RunCampaignInput = z.object({
|
|
136
|
+
campaign_id: z.string().min(1),
|
|
137
|
+
lead_ids: z.array(z.string()).optional(),
|
|
138
|
+
});
|
|
139
|
+
export const RunCampaignJsonSchema = {
|
|
140
|
+
type: 'object',
|
|
141
|
+
required: ['campaign_id'],
|
|
142
|
+
properties: {
|
|
143
|
+
campaign_id: { type: 'string', minLength: 1 },
|
|
144
|
+
lead_ids: { type: 'array', items: { type: 'string' } },
|
|
145
|
+
},
|
|
146
|
+
additionalProperties: false,
|
|
147
|
+
};
|
|
148
|
+
// ─── suppress ───────────────────────────────────────────────────────────
|
|
149
|
+
export const SuppressInput = z
|
|
150
|
+
.object({
|
|
151
|
+
email: z.string().email().optional(),
|
|
152
|
+
domain: z.string().min(1).optional(),
|
|
153
|
+
reason: z.enum([
|
|
154
|
+
'unsubscribe',
|
|
155
|
+
'bounce_hard',
|
|
156
|
+
'bounce_soft_repeat',
|
|
157
|
+
'reply_negative',
|
|
158
|
+
'gdpr_request',
|
|
159
|
+
'manual',
|
|
160
|
+
]),
|
|
161
|
+
})
|
|
162
|
+
.refine((x) => Boolean(x.email) || Boolean(x.domain), 'either email or domain must be provided');
|
|
163
|
+
export const SuppressJsonSchema = {
|
|
164
|
+
type: 'object',
|
|
165
|
+
required: ['reason'],
|
|
166
|
+
properties: {
|
|
167
|
+
email: { type: 'string', format: 'email' },
|
|
168
|
+
domain: { type: 'string', minLength: 1 },
|
|
169
|
+
reason: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
enum: [
|
|
172
|
+
'unsubscribe',
|
|
173
|
+
'bounce_hard',
|
|
174
|
+
'bounce_soft_repeat',
|
|
175
|
+
'reply_negative',
|
|
176
|
+
'gdpr_request',
|
|
177
|
+
'manual',
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
additionalProperties: false,
|
|
182
|
+
description: 'Either email or domain must be provided.',
|
|
183
|
+
};
|
|
184
|
+
// ─── generate_seo_content ───────────────────────────────────────────────
|
|
185
|
+
export const GenerateSeoContentInput = z.object({
|
|
186
|
+
kind: z.enum(['blog', 'landing', 'recommendations']),
|
|
187
|
+
product: z.string().min(1),
|
|
188
|
+
topic: z.string().min(1),
|
|
189
|
+
target_keywords: z.array(z.string()).optional(),
|
|
190
|
+
audience: z.string().optional(),
|
|
191
|
+
existing_content: z.string().optional(),
|
|
192
|
+
});
|
|
193
|
+
export const GenerateSeoContentJsonSchema = {
|
|
194
|
+
type: 'object',
|
|
195
|
+
required: ['kind', 'product', 'topic'],
|
|
196
|
+
properties: {
|
|
197
|
+
kind: { type: 'string', enum: ['blog', 'landing', 'recommendations'] },
|
|
198
|
+
product: { type: 'string', minLength: 1, description: 'The product/brand the content markets.' },
|
|
199
|
+
topic: { type: 'string', minLength: 1, description: 'Primary topic or page intent.' },
|
|
200
|
+
target_keywords: { type: 'array', items: { type: 'string' } },
|
|
201
|
+
audience: { type: 'string' },
|
|
202
|
+
existing_content: { type: 'string', description: 'For kind=recommendations: the page text to audit.' },
|
|
203
|
+
},
|
|
204
|
+
additionalProperties: false,
|
|
205
|
+
};
|
|
206
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,0EAA0E;AAC1E,0EAA0E;AAC1E,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,4BAA4B;AAE5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,2EAA2E;AAE3E,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAA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CAAwC,EAAE;QAChG,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE;QACrF,eAAe,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QAC7D,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mDAAmD,EAAE;KACvG;IACD,oBAAoB,EAAE,KAAK;CACnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-registry-flags.d.ts","sourceRoot":"","sources":["../../src/tools/check-registry-flags.ts"],"names":[],"mappings":"AAWA,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBzE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// cognilead.check_registry_flags — free, 50/day.
|
|
2
|
+
//
|
|
3
|
+
// Cross-jurisdiction registry lookup waterfall: Zefix (CH) →
|
|
4
|
+
// Companies House (UK) → OpenCorporates (everywhere else). Returns the
|
|
5
|
+
// first match. No personal data — only company-level corporate records.
|
|
6
|
+
import { consumeFreeQuota } from '../rate-limit.js';
|
|
7
|
+
import { lookupAny } from '../../../../lib/pipeline/ingestion/universe/registries.js';
|
|
8
|
+
const TOOL = 'cognilead.check_registry_flags';
|
|
9
|
+
export async function checkRegistryFlags(input) {
|
|
10
|
+
consumeFreeQuota(TOOL);
|
|
11
|
+
const { company_name, jurisdictions } = (input ?? {});
|
|
12
|
+
if (!company_name)
|
|
13
|
+
throw new Error('company_name is required');
|
|
14
|
+
const jurs = Array.isArray(jurisdictions) && jurisdictions.length > 0 ? jurisdictions : ['CH', 'GB'];
|
|
15
|
+
const record = await lookupAny(company_name, jurs);
|
|
16
|
+
if (!record) {
|
|
17
|
+
return { found: false, company_name, tried_jurisdictions: jurs };
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
found: true,
|
|
21
|
+
company_name: record.company_name,
|
|
22
|
+
jurisdiction: record.jurisdiction,
|
|
23
|
+
status: record.status,
|
|
24
|
+
registered_at: record.registered_at,
|
|
25
|
+
registration_number: record.registration_number,
|
|
26
|
+
officers: record.officers.slice(0, 10),
|
|
27
|
+
insolvency_flag: record.insolvency_flag,
|
|
28
|
+
source: record.source,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=check-registry-flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-registry-flags.js","sourceRoot":"","sources":["../../src/tools/check-registry-flags.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,6DAA6D;AAC7D,uEAAuE;AACvE,wEAAwE;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,2DAA2D,CAAA;AAErF,MAAM,IAAI,GAAG,gCAAgC,CAAA;AAE7C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAc;IACrD,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACtB,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAGnD,CAAA;IACD,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAC9D,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACpG,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;IAClD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAA;IAClE,CAAC;IACD,OAAO;QACL,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QACtC,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DraftPitchResult {
|
|
2
|
+
subject_line: string;
|
|
3
|
+
email_body_markdown: string;
|
|
4
|
+
technical_hook_verified: boolean;
|
|
5
|
+
cited_source_url: string | null;
|
|
6
|
+
routing: {
|
|
7
|
+
region: string;
|
|
8
|
+
model: string;
|
|
9
|
+
};
|
|
10
|
+
advice?: string;
|
|
11
|
+
upgrade_hint?: string;
|
|
12
|
+
quota_remaining: number | 'unlimited';
|
|
13
|
+
}
|
|
14
|
+
export declare function draftPitch(rawInput: unknown): Promise<DraftPitchResult>;
|
|
15
|
+
//# sourceMappingURL=draft-pitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-pitch.d.ts","sourceRoot":"","sources":["../../src/tools/draft-pitch.ts"],"names":[],"mappings":"AA4CA,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,uBAAuB,EAAE,OAAO,CAAA;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,GAAG,WAAW,CAAA;CACtC;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4C7E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// cognilead.draft_pitch — free, capped 20/day.
|
|
2
|
+
//
|
|
3
|
+
// Runs locally (no network) in stdio mode so the developer in Cursor/CD
|
|
4
|
+
// gets sub-200ms feedback on a draft. We deliberately replicate the
|
|
5
|
+
// deterministic stub from lib/pipeline/adapters/phi-gateway.ts here rather
|
|
6
|
+
// than importing it, so the MCP package stays publishable standalone.
|
|
7
|
+
// When `createHttpPhiGateway` ships in the hosted product, we switch to
|
|
8
|
+
// hitting `${COGNILEAD_API_URL}/api/v1/draft` instead.
|
|
9
|
+
import { DraftPitchInput } from '../schemas.js';
|
|
10
|
+
import { consumeFreeQuota } from '../rate-limit.js';
|
|
11
|
+
import { loadConfig } from '../config.js';
|
|
12
|
+
const TOOL = 'cognilead.draft_pitch';
|
|
13
|
+
// Mirrors ROUTING_TABLE in lib/pipeline/adapters/phi-gateway.ts.
|
|
14
|
+
const ROUTING_TABLE = [
|
|
15
|
+
{ region: 'CH', jurisdictions: ['CH'], model: 'infomaniak/llama-3.1-70b' },
|
|
16
|
+
{
|
|
17
|
+
region: 'EU',
|
|
18
|
+
jurisdictions: [
|
|
19
|
+
'DE', 'FR', 'IT', 'ES', 'NL', 'BE', 'LU', 'AT',
|
|
20
|
+
'IE', 'PT', 'DK', 'SE', 'FI',
|
|
21
|
+
],
|
|
22
|
+
model: 'mistral/mistral-large-2',
|
|
23
|
+
},
|
|
24
|
+
{ region: 'UK', jurisdictions: ['GB', 'UK'], model: 'anthropic/claude-haiku-4.5-eu' },
|
|
25
|
+
{ region: 'US', jurisdictions: ['US'], model: 'openai/gpt-5' },
|
|
26
|
+
];
|
|
27
|
+
function resolveRouting(jurisdiction) {
|
|
28
|
+
const j = jurisdiction.toUpperCase();
|
|
29
|
+
const hit = ROUTING_TABLE.find((r) => r.jurisdictions.includes(j));
|
|
30
|
+
return hit ?? { region: 'WORLD', model: 'anthropic/claude-haiku-4.5' };
|
|
31
|
+
}
|
|
32
|
+
const VERIFIABLE_HOOK = /(iso 20022|hipaa|fhir|sepa|audit log|pain\.008|swissqrbill|graphql|kubernetes|terraform|postgres|grpc)/i;
|
|
33
|
+
export async function draftPitch(rawInput) {
|
|
34
|
+
const input = DraftPitchInput.parse(rawInput);
|
|
35
|
+
const quota = consumeFreeQuota(TOOL);
|
|
36
|
+
const routing = resolveRouting(input.jurisdiction);
|
|
37
|
+
const url = input.signal.source_url ?? null;
|
|
38
|
+
const desc = input.signal.description ?? '';
|
|
39
|
+
// Verified hook iff (a) we have a source URL AND (b) the description
|
|
40
|
+
// mentions a recognizable technical keyword. Same heuristic as the
|
|
41
|
+
// pipeline's deterministic stub — guarantees the IDE preview matches
|
|
42
|
+
// what the real pipeline would do given the same inputs.
|
|
43
|
+
const verified = !!url && VERIFIABLE_HOOK.test(desc);
|
|
44
|
+
const subject = `Re: ${input.target_product} for ${input.company_name}`.slice(0, 60);
|
|
45
|
+
const body = url
|
|
46
|
+
? `Saw ${input.company_name}'s post (${url}) — the ${input.target_product} ` +
|
|
47
|
+
`primitive removes the ${/iso 20022/i.test(desc) ? 'ISO 20022 pain.008 retries' : 'audit-trail plumbing'} you'd otherwise hand-roll. POST /v1/validate is one call; no SDK needed.`
|
|
48
|
+
: `${input.company_name}: ${input.target_product} drops in via POST /v1/validate. One API call, no SDK.`;
|
|
49
|
+
const result = {
|
|
50
|
+
subject_line: subject,
|
|
51
|
+
email_body_markdown: body.slice(0, 600),
|
|
52
|
+
technical_hook_verified: verified,
|
|
53
|
+
cited_source_url: url,
|
|
54
|
+
routing,
|
|
55
|
+
quota_remaining: Number.isFinite(quota.remaining) ? quota.remaining : 'unlimited',
|
|
56
|
+
};
|
|
57
|
+
if (!verified) {
|
|
58
|
+
result.advice =
|
|
59
|
+
"The signal didn't give a verifiable hook. Try one with a job posting URL or GitHub repo URL.";
|
|
60
|
+
}
|
|
61
|
+
// Soft upgrade hint when the user is in the bottom half of their daily
|
|
62
|
+
// budget — gentle nudge, no blocking.
|
|
63
|
+
const cfg = loadConfig();
|
|
64
|
+
if (!cfg.apiKey && typeof result.quota_remaining === 'number' && result.quota_remaining <= 5) {
|
|
65
|
+
result.upgrade_hint = `${result.quota_remaining} free draft_pitch calls left today. Sign up for higher limits: ${cfg.signupUrl}`;
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=draft-pitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-pitch.js","sourceRoot":"","sources":["../../src/tools/draft-pitch.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,wEAAwE;AACxE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,wEAAwE;AACxE,uDAAuD;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAQpC,iEAAiE;AACjE,MAAM,aAAa,GAAiB;IAClC,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,0BAA0B,EAAE;IAC1E;QACE,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE;YACb,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YAC9C,IAAI,EAAE,IAAI,EAAE,IAAI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ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,GAAG,iBAAiB,CAAC,CAgCtC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// cognilead.evidence_export — gated, Growth+ tier.
|
|
2
|
+
//
|
|
3
|
+
// GET ${COGNILEAD_API_URL}/api/v1/evidence/:lead_id (json)
|
|
4
|
+
// GET ${COGNILEAD_API_URL}/api/v1/evidence/:lead_id/pdf (pdf)
|
|
5
|
+
//
|
|
6
|
+
// For format=pdf the API responds with a signed S3-style download URL +
|
|
7
|
+
// expiry. We never stream raw PDF bytes back over MCP — they'd blow up
|
|
8
|
+
// the IDE transcript and bypass the audit log on the customer side.
|
|
9
|
+
import { EvidenceExportInput } from '../schemas.js';
|
|
10
|
+
import { apiGet } from '../api-client.js';
|
|
11
|
+
import { assertGatedAccess } from '../auth.js';
|
|
12
|
+
export async function evidenceExport(rawInput) {
|
|
13
|
+
assertGatedAccess();
|
|
14
|
+
const input = EvidenceExportInput.parse(rawInput);
|
|
15
|
+
const base = `/api/v1/evidence/${encodeURIComponent(input.lead_id)}`;
|
|
16
|
+
const path = input.format === 'pdf' ? `${base}/pdf` : base;
|
|
17
|
+
try {
|
|
18
|
+
const data = (await apiGet(path));
|
|
19
|
+
if (input.format === 'pdf' && data && typeof data === 'object') {
|
|
20
|
+
// Force-shape the response so the IDE sees the canonical fields even
|
|
21
|
+
// if the API adds extra metadata.
|
|
22
|
+
const result = {
|
|
23
|
+
format: 'pdf',
|
|
24
|
+
download_url: String(data.download_url ?? data.url ?? ''),
|
|
25
|
+
expires_at: String(data.expires_at ?? ''),
|
|
26
|
+
};
|
|
27
|
+
if (!result.download_url) {
|
|
28
|
+
throw new Error('API did not return a download_url for the PDF export');
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
const err = e;
|
|
36
|
+
if (err.status === 402 || err.status === 403) {
|
|
37
|
+
throw new Error(`evidence_export requires the Growth tier or higher. ${err.message ?? ''}`.trim());
|
|
38
|
+
}
|
|
39
|
+
throw e;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=evidence-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-export.js","sourceRoot":"","sources":["../../src/tools/evidence-export.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,oEAAoE;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAQ9C,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAiB;IAEjB,iBAAiB,EAAE,CAAA;IACnB,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAEjD,MAAM,IAAI,GAAG,oBAAoB,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAA;IACpE,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;IAE1D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAmC,CAAA;QACnE,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/D,qEAAqE;YACrE,kCAAkC;YAClC,MAAM,MAAM,GAAsB;gBAChC,MAAM,EAAE,KAAK;gBACb,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;gBACzD,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;aAC1C,CAAA;YACD,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;YACzE,CAAC;YACD,OAAO,MAAM,CAAA;QACf,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAA0C,CAAA;QACtD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CACb,uDAAuD,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAClF,CAAA;QACH,CAAC;QACD,MAAM,CAAC,CAAA;IACT,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-companies-with-triggers.d.ts","sourceRoot":"","sources":["../../src/tools/find-companies-with-triggers.ts"],"names":[],"mappings":"AAYA,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBhF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// cognilead.find_companies_with_triggers — gated.
|
|
2
|
+
//
|
|
3
|
+
// Compound trigger query: companies that have ≥ min_distinct_classes of
|
|
4
|
+
// the requested signal classes within a recency window, scoped to a list
|
|
5
|
+
// of geographies and (optionally) ICP keywords.
|
|
6
|
+
//
|
|
7
|
+
// Calls the hosted API which runs the SQL over the companies + signals
|
|
8
|
+
// tables. The query plan lives at /app/api/v1/intel/triggers/route.ts.
|
|
9
|
+
import { McpAuthError } from '../auth.js';
|
|
10
|
+
import { loadConfig } from '../config.js';
|
|
11
|
+
export async function findCompaniesWithTriggers(input) {
|
|
12
|
+
const cfg = loadConfig();
|
|
13
|
+
if (!cfg.apiKey) {
|
|
14
|
+
throw new McpAuthError('cognilead.find_companies_with_triggers requires a CogniLead API key.');
|
|
15
|
+
}
|
|
16
|
+
const res = await fetch(`${cfg.apiUrl}/v1/intel/triggers`, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
authorization: `Bearer ${cfg.apiKey}`,
|
|
20
|
+
'content-type': 'application/json',
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify(input ?? {}),
|
|
23
|
+
});
|
|
24
|
+
if (!res.ok) {
|
|
25
|
+
throw new Error(`triggers ${res.status}: ${await res.text().catch(() => '')}`);
|
|
26
|
+
}
|
|
27
|
+
return res.json();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=find-companies-with-triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-companies-with-triggers.js","sourceRoot":"","sources":["../../src/tools/find-companies-with-triggers.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,KAAc;IAC5D,MAAM,GAAG,GAAG,UAAU,EAAE,CAAA;IACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,YAAY,CACpB,sEAAsE,CACvE,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,oBAAoB,EAAE;QACzD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,GAAG,CAAC,MAAM,EAAE;YACrC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;KAClC,CAAC,CAAA;IACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,YAAY,GAAG,CAAC,MAAM,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-seo-content.d.ts","sourceRoot":"","sources":["../../src/tools/generate-seo-content.ts"],"names":[],"mappings":"AAUA,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAI5E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// cognilead.generate_seo_content — gated.
|
|
2
|
+
//
|
|
3
|
+
// POSTs to ${COGNILEAD_API_URL}/api/v1/seo/generate with Bearer auth.
|
|
4
|
+
// Generates an SEO blog/landing page or on-page recommendations via
|
|
5
|
+
// phi-cloud. Returns the API response verbatim.
|
|
6
|
+
import { GenerateSeoContentInput } from '../schemas.js';
|
|
7
|
+
import { apiPost } from '../api-client.js';
|
|
8
|
+
import { assertGatedAccess } from '../auth.js';
|
|
9
|
+
export async function generateSeoContent(rawInput) {
|
|
10
|
+
assertGatedAccess();
|
|
11
|
+
const input = GenerateSeoContentInput.parse(rawInput);
|
|
12
|
+
return apiPost('/api/v1/seo/generate', input);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=generate-seo-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-seo-content.js","sourceRoot":"","sources":["../../src/tools/generate-seo-content.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,gDAAgD;AAEhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAiB;IACxD,iBAAiB,EAAE,CAAA;IACnB,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACrD,OAAO,OAAO,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAA;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-business-sheet.d.ts","sourceRoot":"","sources":["../../src/tools/get-business-sheet.ts"],"names":[],"mappings":"AAQA,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBvE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// cognilead.get_business_sheet — gated.
|
|
2
|
+
//
|
|
3
|
+
// Returns the cached business sheet for a domain, or triggers a fresh
|
|
4
|
+
// build (Tier-2 scrape) when none exists / cache expired.
|
|
5
|
+
import { McpAuthError } from '../auth.js';
|
|
6
|
+
import { loadConfig } from '../config.js';
|
|
7
|
+
export async function getBusinessSheet(input) {
|
|
8
|
+
const { domain, force_rebuild } = (input ?? {});
|
|
9
|
+
if (!domain)
|
|
10
|
+
throw new Error('domain is required');
|
|
11
|
+
const cfg = loadConfig();
|
|
12
|
+
if (!cfg.apiKey) {
|
|
13
|
+
throw new McpAuthError('cognilead.get_business_sheet requires a CogniLead API key. Set COGNILEAD_API_KEY.');
|
|
14
|
+
}
|
|
15
|
+
const qs = force_rebuild ? '?force=1' : '';
|
|
16
|
+
const res = await fetch(`${cfg.apiUrl}/v1/intel/business-sheet/${encodeURIComponent(domain)}${qs}`, {
|
|
17
|
+
headers: { authorization: `Bearer ${cfg.apiKey}` },
|
|
18
|
+
});
|
|
19
|
+
if (!res.ok) {
|
|
20
|
+
throw new Error(`business-sheet ${res.status}: ${await res.text().catch(() => '')}`);
|
|
21
|
+
}
|
|
22
|
+
return res.json();
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=get-business-sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-business-sheet.js","sourceRoot":"","sources":["../../src/tools/get-business-sheet.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,sEAAsE;AACtE,0DAA0D;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAc;IACnD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAAiD,CAAA;IAC/F,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;IAClD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAA;IACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,YAAY,CACpB,mFAAmF,CACpF,CAAA;IACH,CAAC;IACD,MAAM,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,4BAA4B,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE;QAClG,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,GAAG,CAAC,MAAM,EAAE,EAAE;KACnD,CAAC,CAAA;IACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,CAAC,MAAM,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACtF,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-lead.d.ts","sourceRoot":"","sources":["../../src/tools/ingest-lead.ts"],"names":[],"mappings":"AAWA,wBAAsB,UAAU,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBpE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// cognilead.ingest_lead — gated.
|
|
2
|
+
//
|
|
3
|
+
// POSTs to ${COGNILEAD_API_URL}/api/v1/leads with Bearer auth. The hosted
|
|
4
|
+
// endpoint runs the same `intersect` stage we'd run locally (suppression,
|
|
5
|
+
// dedup, Chainlog anchor). 409 with a suppression reason is the most
|
|
6
|
+
// likely failure path — we re-surface it as a structured message.
|
|
7
|
+
import { IngestLeadInput } from '../schemas.js';
|
|
8
|
+
import { apiPost } from '../api-client.js';
|
|
9
|
+
import { assertGatedAccess } from '../auth.js';
|
|
10
|
+
export async function ingestLead(rawInput) {
|
|
11
|
+
assertGatedAccess();
|
|
12
|
+
const input = IngestLeadInput.parse(rawInput);
|
|
13
|
+
try {
|
|
14
|
+
return await apiPost('/api/v1/leads', input);
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
const err = e;
|
|
18
|
+
if (err.status === 409) {
|
|
19
|
+
throw new Error(`Lead rejected by intersect gate: ${err.message ?? 'unknown reason'}. ` +
|
|
20
|
+
`This means the company_domain or email is on the suppression list, ` +
|
|
21
|
+
`or a lead with the same (company_domain, target_product) already exists.`);
|
|
22
|
+
}
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ingest-lead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-lead.js","sourceRoot":"","sources":["../../src/tools/ingest-lead.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,qEAAqE;AACrE,kEAAkE;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAiB;IAChD,iBAAiB,EAAE,CAAA;IACnB,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAE7C,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAA0D,CAAA;QACtE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,oCAAoC,GAAG,CAAC,OAAO,IAAI,gBAAgB,IAAI;gBACrE,qEAAqE;gBACrE,0EAA0E,CAC7E,CAAA;QACH,CAAC;QACD,MAAM,CAAC,CAAA;IACT,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rank-companies-in-vertical.d.ts","sourceRoot":"","sources":["../../src/tools/rank-companies-in-vertical.ts"],"names":[],"mappings":"AA+BA,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAoB9E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// cognilead.rank_companies_in_vertical — gated.
|
|
2
|
+
//
|
|
3
|
+
// The keystone tool. Given a vertical description, geographies, and axis
|
|
4
|
+
// weights, returns a ranked list of companies with per-axis evidence.
|
|
5
|
+
//
|
|
6
|
+
// Universe: ~8M global companies discovered via Common Crawl + HTTP Archive
|
|
7
|
+
// + CT logs + national registries. Coverage skews US/UK/DACH (~85%) >
|
|
8
|
+
// JP/KR (~60%) > CN/IN (~50%). Per-field confidence sourced from Mapr.
|
|
9
|
+
//
|
|
10
|
+
// Tier-2 business sheets (per-company structured profile) are built lazily
|
|
11
|
+
// on first query and cached 90 days.
|
|
12
|
+
import { McpAuthError } from '../auth.js';
|
|
13
|
+
import { loadConfig } from '../config.js';
|
|
14
|
+
export async function rankCompaniesInVertical(input) {
|
|
15
|
+
const cfg = loadConfig();
|
|
16
|
+
if (!cfg.apiKey) {
|
|
17
|
+
throw new McpAuthError('cognilead.rank_companies_in_vertical requires a CogniLead API key. Set COGNILEAD_API_KEY.');
|
|
18
|
+
}
|
|
19
|
+
const body = JSON.stringify(input);
|
|
20
|
+
const res = await fetch(`${cfg.apiUrl}/v1/intel/rank`, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers: {
|
|
23
|
+
authorization: `Bearer ${cfg.apiKey}`,
|
|
24
|
+
'content-type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
body,
|
|
27
|
+
});
|
|
28
|
+
if (!res.ok) {
|
|
29
|
+
throw new Error(`rank ${res.status}: ${await res.text().catch(() => '')}`);
|
|
30
|
+
}
|
|
31
|
+
return res.json();
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=rank-companies-in-vertical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rank-companies-in-vertical.js","sourceRoot":"","sources":["../../src/tools/rank-companies-in-vertical.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,yEAAyE;AACzE,sEAAsE;AACtE,EAAE;AACF,4EAA4E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