prospeo-cli 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/AGENTS.md ADDED
@@ -0,0 +1,429 @@
1
+ # AI Agent Guide — Prospeo CLI
2
+
3
+ > This file helps AI agents (Claude, GPT, Gemini, open-source models) install, authenticate, and use the Prospeo CLI to enrich persons and companies, search for leads, and access verified contact data.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install globally
9
+ npm install -g prospeo-cli
10
+
11
+ # Authenticate (non-interactive — best for agents)
12
+ export PROSPEO_API_KEY="your-api-key-here"
13
+
14
+ # Verify it works
15
+ prospeo account info
16
+ ```
17
+
18
+ **Requirements:** Node.js 18+
19
+
20
+ ## Authentication
21
+
22
+ Prospeo uses a simple API key passed as an HTTP header. Provide your key via:
23
+
24
+ ```bash
25
+ # 1. Environment variable (recommended for agents)
26
+ export PROSPEO_API_KEY="your-api-key-here"
27
+
28
+ # 2. Per-command flag
29
+ prospeo person enrich --linkedin-url "..." --api-key "your-api-key-here"
30
+
31
+ # 3. Interactive login (stores in ~/.prospeo/config.json)
32
+ prospeo login
33
+ ```
34
+
35
+ Get your API key: https://prospeo.io/dashboard/api
36
+
37
+ ## Output Format
38
+
39
+ All commands output **JSON to stdout** by default:
40
+
41
+ ```bash
42
+ # Default: compact JSON
43
+ prospeo person enrich --linkedin-url "https://linkedin.com/in/jdoe"
44
+
45
+ # Pretty-printed JSON
46
+ prospeo person enrich --linkedin-url "https://linkedin.com/in/jdoe" --pretty
47
+
48
+ # Select specific fields
49
+ prospeo person enrich --linkedin-url "https://linkedin.com/in/jdoe" --fields person,company
50
+
51
+ # Suppress output (exit code only)
52
+ prospeo person enrich --linkedin-url "https://linkedin.com/in/jdoe" --quiet
53
+ ```
54
+
55
+ **Exit codes:** 0 = success, 1 = error. Errors go to stderr as JSON:
56
+ ```json
57
+ {"error":"No API key found.","code":"AUTH_ERROR"}
58
+ ```
59
+
60
+ ## Discovering Commands
61
+
62
+ ```bash
63
+ # List all command groups
64
+ prospeo --help
65
+
66
+ # List subcommands in a group
67
+ prospeo person --help
68
+
69
+ # Get help for a specific subcommand
70
+ prospeo person enrich --help
71
+ ```
72
+
73
+ ## All Command Groups & Subcommands
74
+
75
+ ### person
76
+ Enrich and search people (200M+ contacts).
77
+
78
+ ```
79
+ enrich Enrich a single person — returns email, mobile, job history, company data
80
+ bulk-enrich Enrich up to 50 persons in one request
81
+ search Search persons with 30+ filters (seniority, title, industry, location, etc.)
82
+ ```
83
+
84
+ ### company
85
+ Enrich and search companies (30M+ companies).
86
+
87
+ ```
88
+ enrich Enrich a single company — 50+ data points including funding, tech stack, headcount
89
+ bulk-enrich Enrich up to 50 companies in one request
90
+ search Search companies with filters (industry, location, funding, employee range, etc.)
91
+ ```
92
+
93
+ ### suggestions
94
+ Free autocomplete — no credits consumed.
95
+
96
+ ```
97
+ location Get location autocomplete for use in search filters
98
+ job-title Get job title autocomplete for use in search filters
99
+ ```
100
+
101
+ ### account
102
+ ```
103
+ info View plan, remaining credits, used credits, and quota renewal date
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Common Workflows for Agents
109
+
110
+ ### Enrich a person by LinkedIn URL
111
+
112
+ ```bash
113
+ prospeo person enrich \
114
+ --linkedin-url "https://linkedin.com/in/jdoe" \
115
+ --pretty
116
+ ```
117
+
118
+ ### Enrich a person by name + company
119
+
120
+ ```bash
121
+ prospeo person enrich \
122
+ --first-name "Eva" \
123
+ --last-name "Kiegler" \
124
+ --company-website "intercom.com"
125
+ ```
126
+
127
+ ### Enrich with mobile number (10 credits)
128
+
129
+ ```bash
130
+ prospeo person enrich \
131
+ --linkedin-url "https://linkedin.com/in/jdoe" \
132
+ --enrich-mobile \
133
+ --only-verified-mobile \
134
+ --pretty
135
+ ```
136
+
137
+ ### Enrich a company by domain
138
+
139
+ ```bash
140
+ prospeo company enrich --website "stripe.com" --pretty
141
+ ```
142
+
143
+ ### Search for VP-level sales leaders at SaaS companies
144
+
145
+ ```bash
146
+ prospeo person search \
147
+ --filters '{"person_seniority":{"include":["VP","C_SUITE"]},"person_job_title":["Head of Sales","VP of Sales","Chief Revenue Officer"],"company_industry":{"include":["TECHNOLOGY"]}}' \
148
+ --pretty
149
+ ```
150
+
151
+ ### Search for Series A/B companies in the US with 51–200 employees
152
+
153
+ ```bash
154
+ prospeo company search \
155
+ --filters '{"company_funding":{"stage":["SERIES_A","SERIES_B"]},"company_location":["United States"],"company_employee_range":{"include":["51_200"]}}' \
156
+ --pretty
157
+ ```
158
+
159
+ ### Paginate through search results
160
+
161
+ ```bash
162
+ # Page 1
163
+ prospeo person search --filters '{"person_seniority":{"include":["DIRECTOR"]}}' --page 1
164
+
165
+ # Page 2
166
+ prospeo person search --filters '{"person_seniority":{"include":["DIRECTOR"]}}' --page 2
167
+ ```
168
+
169
+ ### Bulk enrich 3 persons in one request
170
+
171
+ ```bash
172
+ prospeo person bulk-enrich \
173
+ --data '[
174
+ {"identifier":"lead_001","linkedin_url":"https://linkedin.com/in/person1"},
175
+ {"identifier":"lead_002","email":"jane@stripe.com"},
176
+ {"identifier":"lead_003","first_name":"John","last_name":"Doe","company_website":"acme.com"}
177
+ ]' \
178
+ --only-verified-email \
179
+ --pretty
180
+ ```
181
+
182
+ ### Bulk enrich companies
183
+
184
+ ```bash
185
+ prospeo company bulk-enrich \
186
+ --data '[
187
+ {"identifier":"c1","company_website":"intercom.com"},
188
+ {"identifier":"c2","company_linkedin_url":"https://linkedin.com/company/stripe"},
189
+ {"identifier":"c3","company_website":"hubspot.com"}
190
+ ]' \
191
+ --pretty
192
+ ```
193
+
194
+ ### Find valid location strings for search filters
195
+
196
+ ```bash
197
+ # What location strings can I use for "New York"?
198
+ prospeo suggestions location --query "new york"
199
+ # → returns: "New York", "New York City", "Greater New York City Area", etc.
200
+
201
+ # Then use exact string in search:
202
+ prospeo person search \
203
+ --filters '{"person_location":["New York City, New York, United States"]}' \
204
+ --pretty
205
+ ```
206
+
207
+ ### Find valid job title strings
208
+
209
+ ```bash
210
+ prospeo suggestions job-title --query "chief revenue"
211
+ # → returns: "Chief Revenue Officer", "VP of Revenue", etc.
212
+ ```
213
+
214
+ ### Check remaining credits
215
+
216
+ ```bash
217
+ prospeo account info --pretty
218
+ # → {"current_plan":"GROWTH","remaining_credits":4850,"used_credits":150,...}
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Credit Costs
224
+
225
+ | Operation | Credits |
226
+ |-----------|---------|
227
+ | person enrich (email + company) | 1 |
228
+ | person enrich + mobile | 10 |
229
+ | person bulk-enrich (per matched person) | 1 or 10 |
230
+ | person search (per page with results) | 1 |
231
+ | company enrich | 1 |
232
+ | company bulk-enrich (per matched company) | 1 |
233
+ | company search (per page with results) | 1 |
234
+ | suggestions (location/job-title) | Free |
235
+ | account info | Free |
236
+ | Re-enriching same record (lifetime) | Free |
237
+
238
+ ---
239
+
240
+ ## Search Filter Reference
241
+
242
+ ### Person Search Filters (`prospeo person search --filters '...'`)
243
+
244
+ ```json
245
+ {
246
+ "person_seniority": {
247
+ "include": ["C_SUITE", "VP", "DIRECTOR", "MANAGER", "SENIOR", "ENTRY"],
248
+ "exclude": ["INTERN"]
249
+ },
250
+ "person_job_title": ["Head of Sales", "VP of Engineering"],
251
+ "person_department": {
252
+ "include": ["SALES", "ENGINEERING", "MARKETING", "FINANCE", "HR", "OPERATIONS", "LEGAL", "PRODUCT", "DESIGN", "CUSTOMER_SUCCESS"]
253
+ },
254
+ "person_location": ["United States", "California", "New York City, New York, United States"],
255
+ "person_year_of_experience": { "min": 5, "max": 20 },
256
+ "company_industry": {
257
+ "include": ["TECHNOLOGY", "FINTECH", "HEALTHCARE", "SAAS"],
258
+ "exclude": ["STAFFING"]
259
+ },
260
+ "company_location": ["United States", "Greater New York City Area"],
261
+ "company_employee_range": {
262
+ "include": ["11_50", "51_200", "201_500", "501_1000", "1001_5000"]
263
+ },
264
+ "company_websites": ["stripe.com", "brex.com"],
265
+ "company_names": ["Stripe", "Brex"]
266
+ }
267
+ ```
268
+
269
+ **Important:** Use `prospeo suggestions location` and `prospeo suggestions job-title` to get exact values. You cannot search with ONLY exclude filters — always include at least one include filter.
270
+
271
+ ### Company Search Filters (`prospeo company search --filters '...'`)
272
+
273
+ ```json
274
+ {
275
+ "company_industry": {
276
+ "include": ["TECHNOLOGY", "FINTECH"],
277
+ "exclude": ["CONSULTING"]
278
+ },
279
+ "company_location": ["United States", "California"],
280
+ "company_employee_range": {
281
+ "include": ["51_200", "201_500"]
282
+ },
283
+ "company_funding": {
284
+ "stage": ["SERIES_A", "SERIES_B", "SERIES_C"],
285
+ "last_funding": { "min": 1000000, "max": 50000000 },
286
+ "total_funding": { "min": 5000000 }
287
+ },
288
+ "company": {
289
+ "websites": ["stripe.com", "brex.com"],
290
+ "names": ["Stripe", "Brex"]
291
+ }
292
+ }
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Response Shapes
298
+
299
+ ### Person Enrich Response
300
+ ```json
301
+ {
302
+ "error": false,
303
+ "free_enrichment": false,
304
+ "person": {
305
+ "person_id": "abc123",
306
+ "first_name": "John",
307
+ "last_name": "Doe",
308
+ "full_name": "John Doe",
309
+ "current_job_title": "VP of Sales",
310
+ "headline": "VP of Sales at Acme Corp",
311
+ "linkedin_url": "https://linkedin.com/in/jdoe",
312
+ "email": {
313
+ "email": "john@acme.com",
314
+ "status": "VERIFIED"
315
+ },
316
+ "mobile": { "status": "NOT_ENRICHED" },
317
+ "location": { "country": "United States", "state": "California", "city": "San Francisco" },
318
+ "skills": ["SaaS", "B2B Sales"]
319
+ },
320
+ "company": {
321
+ "company_id": "cccc123",
322
+ "name": "Acme Corp",
323
+ "website": "acme.com",
324
+ "domain": "acme.com",
325
+ "employee_count": 150,
326
+ "industry": "Technology",
327
+ "funding": { "total_funding": 25000000 }
328
+ }
329
+ }
330
+ ```
331
+
332
+ ### Bulk Enrich Response
333
+ ```json
334
+ {
335
+ "error": false,
336
+ "total_cost": 2,
337
+ "matched": [
338
+ { "identifier": "lead_001", "person": {...}, "company": {...} }
339
+ ],
340
+ "not_matched": ["lead_002"],
341
+ "invalid_datapoints": ["lead_003"]
342
+ }
343
+ ```
344
+
345
+ ### Search Response
346
+ ```json
347
+ {
348
+ "error": false,
349
+ "results": [
350
+ { "person": {...}, "company": {...} }
351
+ ],
352
+ "pagination": {
353
+ "current_page": 1,
354
+ "per_page": 25,
355
+ "total_page": 40,
356
+ "total_count": 1000
357
+ }
358
+ }
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Error Codes
364
+
365
+ | Code | Meaning | Fix |
366
+ |------|---------|-----|
367
+ | `AUTH_ERROR` | Invalid or missing API key | Check `PROSPEO_API_KEY` or run `prospeo login` |
368
+ | `INSUFFICIENT_CREDITS` | Account depleted | Add credits at prospeo.io |
369
+ | `NO_MATCH` | No match found for provided data | Try more datapoints |
370
+ | `RATE_LIMIT` | Too many requests | CLI retries automatically with backoff |
371
+ | `VALIDATION_ERROR` | Bad request format | Check `--help` for required fields |
372
+ | `INVALID_FILTERS` | Filter config not supported | Check filter JSON structure |
373
+
374
+ ---
375
+
376
+ ## MCP Server (for Claude, Cursor, VS Code)
377
+
378
+ The CLI includes a built-in MCP server exposing all commands as tools:
379
+
380
+ ```bash
381
+ prospeo mcp
382
+ ```
383
+
384
+ MCP config for Claude Desktop / Cursor:
385
+ ```json
386
+ {
387
+ "mcpServers": {
388
+ "prospeo": {
389
+ "command": "npx",
390
+ "args": ["prospeo-cli", "mcp"],
391
+ "env": {
392
+ "PROSPEO_API_KEY": "your-api-key"
393
+ }
394
+ }
395
+ }
396
+ }
397
+ ```
398
+
399
+ Or if installed globally:
400
+ ```json
401
+ {
402
+ "mcpServers": {
403
+ "prospeo": {
404
+ "command": "prospeo",
405
+ "args": ["mcp"],
406
+ "env": {
407
+ "PROSPEO_API_KEY": "your-api-key"
408
+ }
409
+ }
410
+ }
411
+ }
412
+ ```
413
+
414
+ **MCP tools registered:** `person_enrich`, `person_bulk_enrich`, `person_search`, `company_enrich`, `company_bulk_enrich`, `company_search`, `suggestions_location`, `suggestions_job_title`, `account_info`
415
+
416
+ ---
417
+
418
+ ## Tips for AI Agents
419
+
420
+ 1. **Always `--pretty`** when reading output yourself; use compact JSON when piping to tools
421
+ 2. **Use suggestions first** — before searching by location or job title, run `suggestions location` / `suggestions job-title` to get exact strings
422
+ 3. **Prefer `bulk-enrich`** over multiple single `enrich` calls — it's faster and uses the same credits
423
+ 4. **Check `account info`** before large bulk operations to confirm you have enough credits
424
+ 5. **Pagination** — search returns 25 results/page; check `pagination.total_page` to know how many pages exist
425
+ 6. **`free_enrichment: true`** means a re-enrich of a previously seen record — no charge
426
+ 7. **`not_matched` vs `invalid_datapoints`** — `not_matched` means the data is valid but no result found; `invalid_datapoints` means the data was insufficient to search
427
+ 8. **Rate limits** are handled automatically with exponential backoff — no need to add sleep
428
+ 9. **linkedin_url is the strongest identifier** for person enrichment — use it when available
429
+ 10. **company_website is the strongest identifier** for company enrichment — use it over company_name alone
package/CLAUDE.md ADDED
@@ -0,0 +1,108 @@
1
+ # CLAUDE.md — Developer Guide for prospeo-cli
2
+
3
+ ## Architecture Overview
4
+
5
+ This project follows the **CommandDefinition** pattern used across all bcharleson CLI tools:
6
+
7
+ - **One `CommandDefinition` object** = one CLI subcommand + one MCP tool
8
+ - All commands live in `src/commands/` grouped by resource
9
+ - `src/commands/index.ts` is the single registry — add commands here
10
+ - The MCP server (`src/mcp/server.ts`) auto-registers all commands from `allCommands[]`
11
+ - CLI registration (`registerAllCommands()`) also loops over `allCommands[]`
12
+
13
+ ## Adding a New Command
14
+
15
+ 1. Create `src/commands/{group}/{subcommand}.ts`
16
+ 2. Export a `CommandDefinition` object
17
+ 3. Import and add it to `allCommands[]` in `src/commands/index.ts`
18
+
19
+ That's it — the command automatically appears in both the CLI and the MCP server.
20
+
21
+ ### Command Template
22
+
23
+ ```typescript
24
+ import { z } from 'zod';
25
+ import type { CommandDefinition } from '../../core/types.js';
26
+
27
+ export const resourceActionCommand: CommandDefinition = {
28
+ name: 'resource_action', // snake_case, unique MCP tool name
29
+ group: 'resource', // CLI group name (kebab-case)
30
+ subcommand: 'action', // CLI subcommand name
31
+ description: 'What this does.', // Used in --help and MCP
32
+
33
+ inputSchema: z.object({
34
+ id: z.string().describe('Resource ID'),
35
+ name: z.string().optional().describe('Name'),
36
+ }),
37
+
38
+ cliMappings: {
39
+ args: [{ field: 'id', name: 'id', required: true }], // positional args
40
+ options: [
41
+ { field: 'name', flags: '--name <name>', description: 'Name' },
42
+ ],
43
+ },
44
+
45
+ handler: async (input, client) => {
46
+ return client.post('/endpoint', { data: input });
47
+ },
48
+ };
49
+ ```
50
+
51
+ ## Prospeo API Specifics
52
+
53
+ - **Base URL:** `https://api.prospeo.io`
54
+ - **Auth:** `X-KEY: your_api_key` header (implemented in `ProspeoClient`)
55
+ - **HTTP methods:** All enrichment/search endpoints use POST; account info uses GET
56
+ - **Rate limits:** 429 → CLI retries with exponential backoff automatically
57
+ - **Error flag:** Prospeo can return `{ "error": true }` even on HTTP 200 — the client handles this
58
+ - **Nested body:** All POST bodies use nested `data` object or `filters` + `page`
59
+ - **Credits:** 1 per enrich or search page; 10 if `enrich_mobile: true`; free for suggestions + account
60
+
61
+ ## Project Structure
62
+
63
+ ```
64
+ src/
65
+ index.ts CLI entry point (Commander.js)
66
+ mcp.ts MCP server entry point
67
+ core/
68
+ types.ts CommandDefinition, ProspeoClient, GlobalOptions interfaces
69
+ client.ts HTTP client (X-KEY header, retry, rate limiting)
70
+ config.ts ~/.prospeo/config.json management
71
+ auth.ts API key resolution (flag > env > config)
72
+ errors.ts Typed error classes
73
+ output.ts JSON output formatting
74
+ mcp/
75
+ server.ts MCP server (loops allCommands[], registers as MCP tools)
76
+ commands/
77
+ index.ts allCommands[] registry + registerAllCommands()
78
+ auth/ login, logout (special — no API client)
79
+ mcp/ mcp command registration
80
+ person/ enrich, bulk-enrich, search
81
+ company/ enrich, bulk-enrich, search
82
+ suggestions/ location, job-title (free, no credits)
83
+ account/ info
84
+ ```
85
+
86
+ ## Build & Dev
87
+
88
+ ```bash
89
+ npm install
90
+ npm run dev -- person enrich --linkedin-url "https://linkedin.com/in/jdoe"
91
+ npm run dev:mcp # Run MCP server in dev mode
92
+ npm run build # Build to dist/
93
+ npm run typecheck # TypeScript type check
94
+ ```
95
+
96
+ ## Zod Version Note
97
+
98
+ This project uses Zod v3 (`"zod": "^3.24.0"`). The `inputSchema.shape` property is used in the MCP server to extract the Zod shape for tool registration. Do not upgrade to Zod v4 without testing the MCP server registration.
99
+
100
+ ## Conventions
101
+
102
+ - Use `z.preprocess()` for JSON array/object fields passed as CLI strings (e.g. `--filters`, `--data`)
103
+ - Use `z.coerce.number()` for numeric CLI options (Commander.js passes everything as strings)
104
+ - Boolean CLI flags: use `z.preprocess()` with `v === true || v === 'true'` pattern
105
+ - All `handler` functions must return `Promise<unknown>`
106
+ - Keep command descriptions concise but complete — they appear in MCP tool descriptions seen by AI models
107
+ - All Prospeo POST endpoints expect `Content-Type: application/json` and `X-KEY` header
108
+ - The `data` wrapper object is required for enrich endpoints; `filters` + `page` for search endpoints
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # prospeo-cli
2
+
3
+ > CLI and MCP server for the [Prospeo API](https://prospeo.io) — person/company enrichment and search for AI agents and developers.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g prospeo-cli
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ export PROSPEO_API_KEY="your-api-key"
15
+
16
+ # Enrich a person
17
+ prospeo person enrich --linkedin-url "https://linkedin.com/in/jdoe" --pretty
18
+
19
+ # Enrich a company
20
+ prospeo company enrich --website "stripe.com" --pretty
21
+
22
+ # Search for leads
23
+ prospeo person search \
24
+ --filters '{"person_seniority":{"include":["VP"]},"company_industry":{"include":["TECHNOLOGY"]}}' \
25
+ --pretty
26
+
27
+ # Check your credits
28
+ prospeo account info
29
+ ```
30
+
31
+ ## Commands
32
+
33
+ | Group | Subcommand | Description |
34
+ |-------|-----------|-------------|
35
+ | `person` | `enrich` | Enrich a single person (email, mobile, job history) |
36
+ | `person` | `bulk-enrich` | Enrich up to 50 persons in one request |
37
+ | `person` | `search` | Search 200M+ contacts with 30+ filters |
38
+ | `company` | `enrich` | Enrich a single company (50+ data points) |
39
+ | `company` | `bulk-enrich` | Enrich up to 50 companies in one request |
40
+ | `company` | `search` | Search 30M+ companies with filters |
41
+ | `suggestions` | `location` | Autocomplete location strings (free) |
42
+ | `suggestions` | `job-title` | Autocomplete job title strings (free) |
43
+ | `account` | `info` | View plan, credits, and quota renewal |
44
+
45
+ ## Authentication
46
+
47
+ ```bash
48
+ # Option 1: env var (recommended)
49
+ export PROSPEO_API_KEY="your-api-key"
50
+
51
+ # Option 2: per-command
52
+ prospeo person enrich --api-key "your-api-key" --linkedin-url "..."
53
+
54
+ # Option 3: stored config
55
+ prospeo login
56
+ ```
57
+
58
+ ## MCP Server (for Claude, Cursor, VS Code)
59
+
60
+ ```bash
61
+ prospeo mcp
62
+ ```
63
+
64
+ Add to your MCP config:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "prospeo": {
70
+ "command": "npx",
71
+ "args": ["prospeo-cli", "mcp"],
72
+ "env": { "PROSPEO_API_KEY": "your-api-key" }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ## AI Agent Guide
79
+
80
+ See [AGENTS.md](./AGENTS.md) for a complete guide including all filter options, response schemas, credit costs, and common workflows.
81
+
82
+ ## License
83
+
84
+ MIT