mcp-scraper 0.3.25 → 0.3.26

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.
@@ -0,0 +1,94 @@
1
+ # Spec — server-instructions.ts routing-map rewrite
2
+
3
+ Implements the approved improvements from the MCP-design audit + reviewer feedback. **One file changes:** `src/mcp/server-instructions.ts` (the `SERVER_INSTRUCTIONS` string — the only content loaded into the model's context before it fetches any tool schema). No other source files. Requires a build + Vercel deploy (remote-MCP gets it immediately) + npm republish (the string ships in the stdio package).
4
+
5
+ ## Approved improvements (the full list)
6
+ 1. **Add `reddit_thread` to the map; stop routing Reddit to the browser.** Current line 15 says "Anything without a dedicated tool (e.g. Reddit…) -> browser_* agent" — **stale**, we shipped `reddit_thread` in 0.3.25. A model reading the current map will drive a browser for Reddit instead of calling the dedicated tool.
7
+ 2. **Make discovery→action ID seams explicit and schema-accurate** (reviewer #1). Encode, per chain, what the discovery tool *returns* and what the action tool *takes* — using the real params, not inferred ones.
8
+ 3. **Workflow triggers + boundary** (reviewer #2): plain-language "when to reach for a workflow vs hand-chaining," and state `query_fanout_workflow`'s browser prerequisite.
9
+ 4. **Reorder the no-dedicated-tool branch to check login FIRST** (reviewer #3), so a logged-in site isn't short-circuited into `browser_open` without `browser_profile_connect`.
10
+ 5. **Keep** the `rotateProxies` NOTE (reviewer #4 — defensible cross-cutting hint).
11
+
12
+ Not in this spec (explicitly out): annotations (audited → correct as-is, not a bug), server namespace rename (breaking, deferred decision), tool-count tiering (soft, not needed). `deep_research_workflow` removal already shipped.
13
+
14
+ ## Verified schema facts backing each seam (source of truth)
15
+ | Discovery tool | Returns (output schema) | Action tool | Takes (input schema) | Seam |
16
+ |---|---|---|---|---|
17
+ | `map_site_urls` / `search_serp` | `urls` / `organicResults[].url` | `extract_url` | `url` | url → url |
18
+ | `search_serp` | `organicResults[].url` (incl. reddit.com) | `reddit_thread` | `url` | reddit url → reddit_thread |
19
+ | `maps_search` | `results[].{name, placeUrl, cid}` | `maps_place_intel` | **`businessName` + `location`** (NOT an id) | name → name; **independent, callable directly** |
20
+ | `youtube_harvest` | `videos[].videoId` | `youtube_transcribe` | `videoId` OR `url` | videoId → videoId |
21
+ | `facebook_ad_search` | `advertisers[].{pageId, libraryId}` | `facebook_page_intel` | `pageId` / `libraryId` / `query` | id → id |
22
+ | `facebook_page_intel` | `ads[].videoUrl` | `facebook_ad_transcribe` | `videoUrl` | videoUrl → videoUrl |
23
+ | (organic FB url) | — | `facebook_video_transcribe` | `url` (FB reel/video/post) | url direct |
24
+ | `instagram_profile_content` | `post`/`reel`/`tv` url arrays | `instagram_media_download` | `url` | url → url |
25
+ | (must precede) `browser_open` on chatgpt.com/claude.ai | — | `query_fanout_workflow` | runs against the open AI session | browser-session prerequisite |
26
+
27
+ `facebook_ad_transcribe` does NOT consume anything from `facebook_ad_search` — the videoUrl comes from `facebook_page_intel`. `maps_place_intel` does NOT consume a `place_id` — it takes a business name + location.
28
+
29
+ ## Exact change
30
+ Replace the entire `SERVER_INSTRUCTIONS` template literal in `src/mcp/server-instructions.ts` (lines 1–29) with:
31
+
32
+ ```ts
33
+ export const SERVER_INSTRUCTIONS = `
34
+ This server scrapes and analyzes web, social, search, maps, and site data. Pick a tool by NAME using
35
+ this routing map, then load its schema before calling. Where a tool needs a value another tool
36
+ produces, the seam is noted so you can chain them.
37
+
38
+ ROUTING
39
+ - One web page -> extract_url (takes a url). Whole site (crawl + SEO report) -> extract_site (takes a
40
+ url). Just the URL list -> map_site_urls (takes a url). map_site_urls and search_serp return urls you
41
+ can feed straight into extract_url.
42
+ - Web search (organic SERP) -> search_serp. Full SERP + People-Also-Ask / AI-Overview detail ->
43
+ harvest_paa. search_serp returns organicResults[].url (often including reddit.com threads) to feed
44
+ extract_url or reddit_thread.
45
+ - Google Maps: find places -> maps_search (returns results[] with name, placeUrl, cid). One place
46
+ deep-dive + reviews -> maps_place_intel (takes businessName + location, NOT an id — call it directly
47
+ with a name from a maps_search result or from the user).
48
+ - YouTube: find or list videos -> youtube_harvest (returns videos[].videoId). Transcribe one ->
49
+ youtube_transcribe (takes a videoId from youtube_harvest, or a url).
50
+ - Facebook: find advertisers -> facebook_ad_search (returns advertisers[] with pageId, libraryId). Get
51
+ one advertiser's ads -> facebook_page_intel (takes pageId, libraryId, or query; returns ads[].videoUrl).
52
+ Transcribe an ad video -> facebook_ad_transcribe (takes a videoUrl from facebook_page_intel).
53
+ Transcribe an organic Facebook reel/video/post -> facebook_video_transcribe (takes the Facebook url
54
+ directly).
55
+ - Instagram: profile inventory -> instagram_profile_content (returns post/reel/tv urls). One post or
56
+ reel -> instagram_media_download (takes a url from instagram_profile_content, or a url the user gives).
57
+ - Reddit: a reddit.com thread/post URL -> reddit_thread. It returns the post plus its comment tree and
58
+ handles Reddit's bot wall itself (no login needed). Find threads first with search_serp.
59
+ - No dedicated tool (an arbitrary site, or a logged-in dashboard) -> the browser_* agent. FIRST decide
60
+ whether the site needs a login:
61
+ - Needs a login (ChatGPT, Claude, any account) -> save it first: browser_profile_connect returns an
62
+ mcpscraper.dev sign-in link for the user; one profile holds MANY logins (call it again with the same
63
+ profile + a new domain to add accounts). Poll browser_profile_list until AUTHENTICATED, then
64
+ browser_open with that profile. browser_profile_list also shows what a profile is connected to.
65
+ - No login -> browser_open, then navigate/read.
66
+
67
+ WORKFLOWS (multi-step orchestrations — prefer these over hand-chaining primitives when the whole job is one of these)
68
+ - Build a local business directory for a niche across a state/region -> directory_workflow.
69
+ - Stand up a rank-tracking blueprint (database + cron + ingestion plan) -> rank_tracker_workflow.
70
+ - Find which sources an AI answer cites for a query (AEO) -> query_fanout_workflow (open a browser
71
+ session on chatgpt.com or claude.ai FIRST, then run it against that session).
72
+
73
+ NOTES
74
+ - Bulk / full-site crawls: call extract_site with rotateProxies:true for blocked or rate-limited sites.
75
+ It discovers URLs and returns a saved folder/artifact plus a summary, not the full content inline.
76
+ - Tools that open a browser session or transcribe media cost credits and take longer. Prefer the
77
+ cheapest tool that answers the question (plain search/extract before browser agents).
78
+ - Large results are saved to disk or an artifact and returned as a summary plus a path; read the path
79
+ for full detail rather than expecting the whole payload inline.
80
+ \`.trim()
81
+ ```
82
+
83
+ ## Build / deploy / release
84
+ 1. Edit the one file above.
85
+ 2. `npm run build` (typecheck + bundle; regenerates rate catalog — no functional change here).
86
+ 3. `vercel deploy --prod --yes` → remote-MCP clients get the new routing map immediately.
87
+ 4. **Bump 0.3.25 → 0.3.26** in the 3 version files (`package.json`, `package-lock.json`, `src/version.ts`) and `npm publish` — `SERVER_INSTRUCTIONS` is compiled into the stdio package, so npm-installed clients need the new version to see the corrected map.
88
+ 5. Commit on `main` (now the source of truth): `fix(mcp): routing map — add reddit_thread, explicit chaining seams, workflow triggers, login-first fallback`.
89
+
90
+ ## Verification
91
+ - `grep -c reddit_thread src/mcp/server-instructions.ts` → ≥1 (was 0).
92
+ - `grep -c "without a dedicated tool" src/mcp/server-instructions.ts` → 0 (old Reddit-to-browser line gone).
93
+ - After deploy, the live `/mcp` server-instructions block reflects the new map (inspect via an MCP client's server info, or the SERVER_INSTRUCTIONS in the published tarball).
94
+ - Behavioral smoke (manual, in an MCP client): "get the comments on <reddit thread url>" routes to `reddit_thread`, not `browser_open`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-scraper",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "MCP server for MCP Scraper web intelligence tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,7 +0,0 @@
1
- // src/version.ts
2
- var PACKAGE_VERSION = "0.3.25";
3
-
4
- export {
5
- PACKAGE_VERSION
6
- };
7
- //# sourceMappingURL=chunk-WPHAMNT7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = '0.3.25'\n"],"mappings":";AAAO,IAAM,kBAAkB;","names":[]}