mcp-scraper 0.6.0 → 0.7.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.
Files changed (51) hide show
  1. package/dist/bin/api-server.cjs +296 -198
  2. package/dist/bin/api-server.cjs.map +1 -1
  3. package/dist/bin/api-server.js +2 -2
  4. package/dist/bin/mcp-scraper-cli.cjs +1 -1
  5. package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
  6. package/dist/bin/mcp-scraper-cli.js +1 -1
  7. package/dist/bin/mcp-scraper-install.cjs +1 -1
  8. package/dist/bin/mcp-scraper-install.cjs.map +1 -1
  9. package/dist/bin/mcp-scraper-install.js +1 -1
  10. package/dist/bin/mcp-stdio-server.cjs +3 -3
  11. package/dist/bin/mcp-stdio-server.cjs.map +1 -1
  12. package/dist/bin/mcp-stdio-server.js +3 -3
  13. package/dist/bin/paa-harvest.cjs +166 -74
  14. package/dist/bin/paa-harvest.cjs.map +1 -1
  15. package/dist/bin/paa-harvest.js +1 -1
  16. package/dist/chunk-EGWJ74EX.js +7 -0
  17. package/dist/chunk-EGWJ74EX.js.map +1 -0
  18. package/dist/{chunk-APJO2XV5.js → chunk-HL33CGJF.js} +3 -3
  19. package/dist/{chunk-APJO2XV5.js.map → chunk-HL33CGJF.js.map} +1 -1
  20. package/dist/{chunk-AUCXKRRH.js → chunk-RMPPYKUV.js} +167 -75
  21. package/dist/chunk-RMPPYKUV.js.map +1 -0
  22. package/dist/{chunk-BL7BBSYF.js → chunk-RUGJE5EB.js} +2 -2
  23. package/dist/{chunk-3K5GT6VG.js → chunk-YGRZU7IR.js} +3 -3
  24. package/dist/index.cjs +166 -74
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/{server-WHM446IZ.js → server-JNY4XPZE.js} +81 -76
  28. package/dist/server-JNY4XPZE.js.map +1 -0
  29. package/dist/{site-extract-repository-U476J44K.js → site-extract-repository-NVSZH35Y.js} +3 -3
  30. package/dist/{worker-KJZ3ZN2N.js → worker-JQTS437L.js} +4 -4
  31. package/dist/worker-JQTS437L.js.map +1 -0
  32. package/package.json +1 -1
  33. package/dist/chunk-AUCXKRRH.js.map +0 -1
  34. package/dist/chunk-F2BXETDX.js +0 -7
  35. package/dist/chunk-F2BXETDX.js.map +0 -1
  36. package/dist/server-WHM446IZ.js.map +0 -1
  37. package/dist/worker-KJZ3ZN2N.js.map +0 -1
  38. package/docs/spec-browser-routing.md +0 -108
  39. package/docs/spec-kernel-computer-controls.md +0 -166
  40. package/docs/spec-mcp-tools.md +0 -146
  41. package/docs/spec-server-instructions.md +0 -94
  42. package/docs/specs/agent-ready-seo-packet-spec.md +0 -237
  43. package/docs/specs/audit-visual-demo.md +0 -309
  44. package/docs/specs/cli-agent-wiring-spec.md +0 -206
  45. package/docs/specs/local-competitive-audit-spec.md +0 -311
  46. package/docs/specs/scheduled-workflows-api-spec.md +0 -304
  47. package/docs/specs/seo-cli-growth-roadmap-spec.md +0 -181
  48. package/docs/specs/seo-workflow-runner-and-reports-spec.md +0 -241
  49. /package/dist/{chunk-BL7BBSYF.js.map → chunk-RUGJE5EB.js.map} +0 -0
  50. /package/dist/{chunk-3K5GT6VG.js.map → chunk-YGRZU7IR.js.map} +0 -0
  51. /package/dist/{site-extract-repository-U476J44K.js.map → site-extract-repository-NVSZH35Y.js.map} +0 -0
@@ -1,206 +0,0 @@
1
- # CLI Agent Wiring — Implementation Spec
2
-
3
- Make MCP Scraper easy to wire into AI agents. This is the lowest-friction market-share feature: users should be able to install, verify, and prompt their agent correctly without reading a long README.
4
-
5
- ## Goals
6
-
7
- - Generate correct MCP configs for common AI-agent hosts.
8
- - Verify local setup with a single `doctor` command.
9
- - Provide copyable prompts for high-value workflows.
10
- - Keep stdio MCP servers protocol-safe and silent.
11
- - Make updates obvious: users on `mcp-scraper@latest` still need to restart their MCP client.
12
-
13
- ## New binary
14
-
15
- Add a human-facing CLI binary:
16
-
17
- ```json
18
- {
19
- "bin": {
20
- "mcp-scraper-cli": "dist/bin/mcp-scraper-cli.js"
21
- }
22
- }
23
- ```
24
-
25
- Do not repurpose `mcp-scraper`; it is already a stdio MCP server. Do not print terminal UI from any stdio MCP server.
26
-
27
- ## Command surface
28
-
29
- ```bash
30
- mcp-scraper-cli doctor
31
- mcp-scraper-cli agent install codex
32
- mcp-scraper-cli agent install claude
33
- mcp-scraper-cli agent install claude-desktop
34
- mcp-scraper-cli agent prompt list
35
- mcp-scraper-cli agent prompt agent-packet
36
- mcp-scraper-cli agent prompt local-competitive-audit
37
- mcp-scraper-cli agent config codex --api-key sk_live_...
38
- mcp-scraper-cli agent config claude --api-key sk_live_...
39
- ```
40
-
41
- Flags:
42
-
43
- ```bash
44
- --api-key <key> # optional; if omitted, use env placeholder
45
- --output <path> # write generated config/prompt to a file
46
- --combined # default true; uses mcp-scraper-combined
47
- --browser-tools # default true in combined mode
48
- --no-color
49
- --json # machine-readable output for scripts
50
- ```
51
-
52
- ## `doctor`
53
-
54
- Checks:
55
-
56
- | Check | Pass condition | Fix text |
57
- |---|---|---|
58
- | Node version | `>=20` | Install Node 20+ |
59
- | npm package | `npm view mcp-scraper version` succeeds | Check npm/network |
60
- | local CLI version | package version available from `PACKAGE_VERSION` | Update/reinstall |
61
- | API key | `MCP_SCRAPER_API_KEY` set or key file exists | Set env or config |
62
- | hosted API | `GET /me` with key succeeds | Verify key/account |
63
- | output dir | writable `MCP_SCRAPER_OUTPUT_DIR` or default downloads dir | Create/fix permissions |
64
- | MCP command | generated `npx -y -p mcp-scraper@latest mcp-scraper-combined` | Restart MCP client |
65
- | browser service readiness | only check if browser tools are requested | Configure API key |
66
-
67
- Output shape for `--json`:
68
-
69
- ```ts
70
- interface DoctorOutput {
71
- ok: boolean
72
- version: string
73
- npmLatest: string | null
74
- checks: Array<{
75
- id: string
76
- label: string
77
- status: 'pass' | 'warn' | 'fail' | 'skip'
78
- detail: string
79
- fix?: string
80
- }>
81
- recommendedConfig: {
82
- command: 'npx'
83
- args: string[]
84
- env: Record<string, string>
85
- }
86
- }
87
- ```
88
-
89
- ## Agent install generators
90
-
91
- ### Codex
92
-
93
- Print TOML:
94
-
95
- ```toml
96
- [mcp_servers.mcp-scraper]
97
- command = "npx"
98
- args = ["-y", "-p", "mcp-scraper@latest", "mcp-scraper-combined"]
99
- env = { MCP_SCRAPER_API_KEY = "sk_live_your_key" }
100
- ```
101
-
102
- Also print the restart requirement:
103
-
104
- ```text
105
- Restart Codex so the MCP client starts a fresh npx process.
106
- ```
107
-
108
- ### Claude Code
109
-
110
- Print command:
111
-
112
- ```bash
113
- claude mcp add mcp-scraper --scope user \
114
- --env MCP_SCRAPER_API_KEY=sk_live_your_key \
115
- -- npx -y -p mcp-scraper@latest mcp-scraper-combined
116
- ```
117
-
118
- ### Claude Desktop
119
-
120
- Print JSON:
121
-
122
- ```json
123
- {
124
- "mcpServers": {
125
- "mcp-scraper": {
126
- "command": "npx",
127
- "args": ["-y", "-p", "mcp-scraper@latest", "mcp-scraper-combined"],
128
- "env": {
129
- "MCP_SCRAPER_API_KEY": "sk_live_your_key"
130
- }
131
- }
132
- }
133
- }
134
- ```
135
-
136
- Also point to the MCPB:
137
-
138
- ```text
139
- Desktop Extension: https://mcpscraper.dev/downloads/mcp-scraper.mcpb
140
- ```
141
-
142
- ## Prompt library
143
-
144
- Store prompt templates in:
145
-
146
- ```text
147
- src/cli/prompts/
148
- agent-packet.md
149
- local-competitive-audit.md
150
- directory-workflow.md
151
- map-comparison.md
152
- serp-comparison.md
153
- paa-expansion-brief.md
154
- ai-overview-language.md
155
- ai-citation-monitor.md
156
- serp-brief.md
157
- ```
158
-
159
- Command:
160
-
161
- ```bash
162
- mcp-scraper-cli agent prompt agent-packet
163
- ```
164
-
165
- Example `agent-packet.md`:
166
-
167
- ```md
168
- Use MCP Scraper as the evidence layer. First call search/PAA tools for the keyword and target domain. Save all source URLs and cite every recommendation to a live evidence item. Then produce: brief.md, tasks.md, and a concise HTML-ready summary.
169
- ```
170
-
171
- Prompts should name tool intent, not implementation vendors.
172
-
173
- ## Files
174
-
175
- New:
176
-
177
- - `bin/mcp-scraper-cli.ts`
178
- - `src/cli/agent-config.ts`
179
- - `src/cli/doctor.ts`
180
- - `src/cli/prompts.ts`
181
- - `src/cli/prompts/*.md`
182
- - `tests/unit/cli-agent-config.test.ts`
183
- - `tests/unit/cli-doctor.test.ts`
184
- - `tests/unit/cli-prompts.test.ts`
185
-
186
- Modified:
187
-
188
- - `package.json` bin and tsup entries.
189
- - `README.md` install section.
190
- - `src/install-terminal.ts` to mention `mcp-scraper-cli doctor`.
191
-
192
- ## Tests
193
-
194
- - Snapshot generated Codex TOML, Claude command, Claude Desktop JSON.
195
- - `doctor --json` with mocked checks returns stable JSON.
196
- - Prompt listing and prompt rendering works.
197
- - No generated prompt or CLI text includes hidden vendor names.
198
- - `mcp-scraper-cli --help` exits 0 and does not require an API key.
199
-
200
- ## Release notes
201
-
202
- Installer message candidate:
203
-
204
- ```text
205
- Newest: agent install helpers, setup doctor, and workflow prompts for Codex and Claude.
206
- ```
@@ -1,311 +0,0 @@
1
- # Local Competitive Audit Workflow — Implementation Spec
2
-
3
- `local-competitive-audit` turns city selection, Maps search, and review/profile hydration into an SEO market audit. It builds on existing `directory_workflow`, `maps_search`, and `maps_place_intel`.
4
-
5
- ## User promise
6
-
7
- ```bash
8
- mcp-scraper-cli workflow run local-competitive-audit \
9
- --query "roofers" \
10
- --state TN \
11
- --min-pop 100000 \
12
- --per-city 20 \
13
- --hydrate-top 5 \
14
- --reviews 50 \
15
- --concurrency 5
16
- ```
17
-
18
- The workflow answers:
19
-
20
- - Which businesses rank in each city?
21
- - What position are they in?
22
- - How many reviews and what star rating?
23
- - What categories are competitors using?
24
- - What do reviews say customers praise or complain about?
25
- - Which cities look easiest or hardest to compete in?
26
- - Which competitors should the client study?
27
-
28
- ## Current capabilities to reuse
29
-
30
- Existing `directory_workflow` already:
31
-
32
- - Selects US cities from Census population data.
33
- - Optionally enriches with US ZIP groups.
34
- - Runs Maps searches city-by-city.
35
- - Saves CSV with `source_location`, `result_position`, `business_name`, `review_stars`, `category`, address, phone, URLs, CIDs, population, ZIP groups.
36
-
37
- Existing `maps_place_intel` already:
38
-
39
- - Hydrates one known/named business.
40
- - Returns rating, review count, category, hours, phone, website, booking URL, review histogram, review topics, about attributes, and optional review cards.
41
-
42
- ## Required base improvement
43
-
44
- Add `review_count` to Maps search and directory CSV output.
45
-
46
- Current Maps search extraction includes `reviewCount` in structured result types. Directory CSV currently writes `review_stars` but not review count. Add:
47
-
48
- ```text
49
- review_count
50
- ```
51
-
52
- Next to `review_stars`.
53
-
54
- Files:
55
-
56
- - `src/directory/directory-workflow.ts`
57
- - `src/mcp/mcp-tool-schemas.ts` descriptions/output schema if needed.
58
- - `src/mcp/mcp-response-formatter.ts` if table output should show count.
59
- - Tests that assert CSV header and row value.
60
-
61
- ## Inputs
62
-
63
- CLI flags:
64
-
65
- ```bash
66
- --query <business category> # required, e.g. roofers
67
- --state <US state> # required
68
- --min-pop <number> # default 100000
69
- --max-cities <number> # optional
70
- --per-city <number> # default 20, cap 50
71
- --hydrate-top <number> # default 5, cap 10
72
- --reviews <number> # default 50, cap 200
73
- --concurrency <number> # default 5
74
- --proxy-mode location # default
75
- --include-reviews # default true when reviews > 0
76
- --output-dir <path>
77
- --return-partial # default true
78
- ```
79
-
80
- Structured input:
81
-
82
- ```ts
83
- interface LocalCompetitiveAuditInput {
84
- query: string
85
- state: string
86
- minPopulation: number
87
- maxCities?: number
88
- maxResultsPerCity: number
89
- hydrateTop: number
90
- maxReviews: number
91
- concurrency: number
92
- proxyMode: 'location' | 'configured' | 'none'
93
- returnPartial: boolean
94
- }
95
- ```
96
-
97
- ## Workflow steps
98
-
99
- ### 1. Market seed
100
-
101
- Call `directory_workflow` with:
102
-
103
- - `query`
104
- - `state`
105
- - `minPopulation`
106
- - `maxResultsPerCity`
107
- - `concurrency`
108
- - `proxyMode: "location"` by default for Maps evidence; use `"configured"` only when city/ZIP-targeted residential proxy evidence should be skipped
109
-
110
- Save the raw structured result and directory CSV.
111
-
112
- ### 2. Competitor selection
113
-
114
- For each successful city:
115
-
116
- - Select top `hydrateTop` businesses by `result_position`.
117
- - Deduplicate by CID first, then place URL, then normalized name + city.
118
- - Carry city/rank context forward into hydration.
119
-
120
- ### 3. Profile hydration
121
-
122
- For each selected competitor:
123
-
124
- Call `maps_place_intel` with:
125
-
126
- ```ts
127
- {
128
- businessName,
129
- location: sourceLocation,
130
- includeReviews: maxReviews > 0,
131
- maxReviews
132
- }
133
- ```
134
-
135
- Concurrency:
136
-
137
- - Default 3 profile hydrations at a time.
138
- - Keep city Maps search concurrency separate from hydration concurrency.
139
-
140
- ### 4. Review insight extraction
141
-
142
- No server-side LLM required for first version. Use structured Maps profile evidence and extractive review analysis.
143
-
144
- Inputs:
145
-
146
- - `reviewCount`
147
- - `reviewHistogram`
148
- - `reviewTopics`
149
- - `reviews[].stars`
150
- - `reviews[].text`
151
- - `reviews[].ownerResponse`
152
- - `aboutAttributes`
153
-
154
- Derived fields:
155
-
156
- ```ts
157
- interface ReviewInsights {
158
- reviewCount: string | null
159
- averageRating: string | null
160
- histogram: Array<{ stars: number; count: string }>
161
- topics: Array<{ label: string; count: string }>
162
- praiseTerms: Array<{ term: string; count: number }>
163
- complaintTerms: Array<{ term: string; count: number }>
164
- samplePositiveReviews: Array<{ stars: string | null; text: string }>
165
- sampleNegativeReviews: Array<{ stars: string | null; text: string }>
166
- ownerResponseRate: number | null
167
- }
168
- ```
169
-
170
- Simple extraction rules:
171
-
172
- - Positive sample: 5-star reviews with text, longest useful snippets first.
173
- - Negative sample: 1-3 star reviews with text, longest useful snippets first.
174
- - Praise/complaint terms: n-grams from review text after stopword removal, separated by star band.
175
- - Owner response rate: reviews with `ownerResponse` / reviews with text.
176
-
177
- ### 5. Market scoring
178
-
179
- Calculate city-level and competitor-level scores.
180
-
181
- City fields:
182
-
183
- ```ts
184
- interface CityAuditSummary {
185
- city: string
186
- state: string
187
- population: number | null
188
- resultCount: number
189
- medianReviewCount: number | null
190
- medianRating: number | null
191
- topThreeAverageReviewCount: number | null
192
- categories: Array<{ category: string; count: number }>
193
- opportunityScore: number
194
- difficultyScore: number
195
- notes: string[]
196
- }
197
- ```
198
-
199
- Initial scoring:
200
-
201
- - Difficulty increases with top-three review count, rating, number of results with websites, and category consistency.
202
- - Opportunity increases when top results have low review counts, missing websites, weak ratings, sparse categories, or incomplete profiles.
203
-
204
- Do not overstate precision. Label these as heuristic scores.
205
-
206
- ## Artifacts
207
-
208
- ```text
209
- local-competitive-audit/
210
- manifest.json
211
- report.html
212
- summary.md
213
- evidence.json
214
- city-summary.csv
215
- competitors.csv
216
- review-insights.csv
217
- tasks.md
218
- raw/directory-workflow.json
219
- raw/maps-place-intel/*.json
220
- logs/attempts.jsonl
221
- ```
222
-
223
- ### `competitors.csv`
224
-
225
- Columns:
226
-
227
- ```text
228
- city,state,source_location,result_position,business_name,category,review_stars,review_count,phone,website_url,place_url,cid,cid_decimal,hydrated,review_topics,owner_response_rate
229
- ```
230
-
231
- ### `review-insights.csv`
232
-
233
- Columns:
234
-
235
- ```text
236
- city,business_name,cid,review_count,average_rating,topic,praise_terms,complaint_terms,positive_sample,negative_sample
237
- ```
238
-
239
- ### `city-summary.csv`
240
-
241
- Columns:
242
-
243
- ```text
244
- city,state,population,result_count,median_review_count,median_rating,top_three_average_review_count,top_categories,opportunity_score,difficulty_score
245
- ```
246
-
247
- ## HTML report sections
248
-
249
- 1. Executive summary.
250
- 2. City opportunity table.
251
- 3. Top competitors by city.
252
- 4. Review count/rating distribution.
253
- 5. Category patterns.
254
- 6. Review themes: praise and complaints.
255
- 7. Weak competitor opportunities.
256
- 8. Recommended content/GBP actions.
257
- 9. Diagnostics: failed cities, failed profile hydrations, attempts.
258
-
259
- ## Agent task output
260
-
261
- `tasks.md` should include:
262
-
263
- ```md
264
- - [ ] Build city landing page recommendations from `city-summary.csv`.
265
- - [ ] Use review praise/complaint themes as customer-language evidence.
266
- - [ ] Identify competitors with low review count but high rank.
267
- - [ ] Compare target GBP category and review profile against top competitors.
268
- - [ ] Draft GBP/content improvements without inventing review claims.
269
- ```
270
-
271
- ## MCP tool option
272
-
273
- After CLI proof, add an MCP tool:
274
-
275
- ```text
276
- local_competitive_audit
277
- ```
278
-
279
- Description:
280
-
281
- ```text
282
- Run a local SEO competitive audit by selecting city markets, searching Google Maps competitors, hydrating top profiles, collecting review/category evidence, and saving CSV/HTML artifacts. Use when the user asks who ranks locally, how strong competitors are, what reviews say, or where market opportunities exist.
283
- ```
284
-
285
- This tool should return `structuredContent` with artifact paths and city/competitor summaries.
286
-
287
- ## Credit model
288
-
289
- Estimate:
290
-
291
- - Directory seed: `cities * maps_search`.
292
- - Profile hydration: `hydrated_profiles * maps_place_intel`.
293
- - Reviews: `collected_review_cards * maps_review`.
294
-
295
- For CLI runs, print estimated costs before hosted execution unless `--yes` is passed.
296
-
297
- ## Partial-result behavior
298
-
299
- - If some cities fail, still audit successful cities.
300
- - If hydration fails, keep base directory row and mark `hydrated=false`.
301
- - If reviews are unavailable, keep profile metadata and mark `reviewsStatus`.
302
- - If all directory cities fail, workflow fails with no audit report except diagnostics.
303
-
304
- ## Tests
305
-
306
- - Directory fixture + profile fixtures produce all three CSVs.
307
- - `review_count` is preserved from Maps search into directory CSV.
308
- - Deduping by CID prevents duplicate hydration.
309
- - Review insight extraction is deterministic.
310
- - Partial hydration failure writes warning and keeps report.
311
- - HTML report escapes review text.