socialcrawl-mcp 1.10.0 → 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.
Files changed (206) hide show
  1. package/README.md +117 -64
  2. package/dist/app.d.ts +7 -0
  3. package/dist/app.js +12 -2
  4. package/dist/auth.d.ts +8 -0
  5. package/dist/auth.js +21 -8
  6. package/dist/client.d.ts +42 -2
  7. package/dist/client.js +158 -23
  8. package/dist/constants.d.ts +6 -1
  9. package/dist/constants.js +6 -1
  10. package/dist/context.d.ts +6 -0
  11. package/dist/cost-guard.d.ts +61 -0
  12. package/dist/cost-guard.js +149 -0
  13. package/dist/data/docs-handwritten.js +142 -48
  14. package/dist/data/docs.d.ts +14 -1
  15. package/dist/data/docs.js +243 -9
  16. package/dist/data/endpoints.d.ts +1 -1
  17. package/dist/data/endpoints.js +9614 -629
  18. package/dist/data/examples.d.ts +3 -0
  19. package/dist/data/examples.js +4 -0
  20. package/dist/data/guide.d.ts +3 -0
  21. package/dist/data/guide.js +4 -0
  22. package/dist/data/outputs.d.ts +18 -0
  23. package/dist/data/outputs.js +883 -0
  24. package/dist/data/platforms.d.ts +1 -1
  25. package/dist/data/platforms.js +52 -28
  26. package/dist/data/recipes.d.ts +3 -0
  27. package/dist/data/recipes.js +3 -0
  28. package/dist/data/registry-meta.d.ts +18 -11
  29. package/dist/data/registry-meta.js +18 -11
  30. package/dist/discovery-routes.d.ts +19 -0
  31. package/dist/discovery-routes.js +46 -0
  32. package/dist/format/csv.d.ts +27 -0
  33. package/dist/format/csv.js +92 -0
  34. package/dist/format/fields.d.ts +34 -0
  35. package/dist/format/fields.js +121 -0
  36. package/dist/format/shape.d.ts +33 -0
  37. package/dist/format/shape.js +210 -0
  38. package/dist/freshness.d.ts +30 -0
  39. package/dist/freshness.js +87 -0
  40. package/dist/hydration.d.ts +84 -0
  41. package/dist/hydration.js +174 -0
  42. package/dist/instructions.d.ts +1 -0
  43. package/dist/instructions.js +19 -0
  44. package/dist/instructions.md +18 -0
  45. package/dist/jobs.d.ts +34 -0
  46. package/dist/jobs.js +66 -0
  47. package/dist/judgments.d.ts +104 -0
  48. package/dist/judgments.js +310 -0
  49. package/dist/oauth/api-key-resolver.d.ts +27 -0
  50. package/dist/oauth/api-key-resolver.js +67 -0
  51. package/dist/oauth/config.d.ts +19 -0
  52. package/dist/oauth/config.js +61 -0
  53. package/dist/oauth/jwt-verifier.d.ts +23 -0
  54. package/dist/oauth/jwt-verifier.js +69 -0
  55. package/dist/oauth/resource-server.d.ts +24 -0
  56. package/dist/oauth/resource-server.js +111 -0
  57. package/dist/oauth/scopes.d.ts +29 -0
  58. package/dist/oauth/scopes.js +70 -0
  59. package/dist/pricing.d.ts +6 -0
  60. package/dist/pricing.js +54 -1
  61. package/dist/prompts/index.d.ts +3 -0
  62. package/dist/prompts/index.js +35 -0
  63. package/dist/prompts/recipe-prompt.d.ts +6 -0
  64. package/dist/prompts/recipe-prompt.js +113 -0
  65. package/dist/resources/index.d.ts +3 -0
  66. package/dist/resources/index.js +166 -0
  67. package/dist/resources/recipe-types.d.ts +81 -0
  68. package/dist/resources/recipe-types.js +2 -0
  69. package/dist/resources/sample-gate.d.ts +45 -0
  70. package/dist/resources/sample-gate.js +575 -0
  71. package/dist/resources/supplier-tokens.d.ts +9 -0
  72. package/dist/resources/supplier-tokens.js +39 -0
  73. package/dist/result.d.ts +40 -0
  74. package/dist/result.js +232 -0
  75. package/dist/results-store.d.ts +16 -0
  76. package/dist/results-store.js +66 -0
  77. package/dist/schemas/outputs.d.ts +866 -0
  78. package/dist/schemas/outputs.js +170 -0
  79. package/dist/schemas/tools.d.ts +219 -39
  80. package/dist/schemas/tools.js +136 -14
  81. package/dist/search/catalog.d.ts +22 -0
  82. package/dist/search/catalog.js +158 -0
  83. package/dist/search/manage-docs.d.ts +24 -0
  84. package/dist/search/manage-docs.js +31 -0
  85. package/dist/search/rank.d.ts +339 -0
  86. package/dist/search/rank.js +800 -0
  87. package/dist/server.d.ts +11 -1
  88. package/dist/server.js +194 -146
  89. package/dist/session-spend.d.ts +7 -0
  90. package/dist/session-spend.js +33 -0
  91. package/dist/sse.d.ts +47 -0
  92. package/dist/sse.js +260 -0
  93. package/dist/timeouts.d.ts +19 -0
  94. package/dist/timeouts.js +47 -0
  95. package/dist/tools/account.d.ts +16 -0
  96. package/dist/tools/account.js +12 -0
  97. package/dist/tools/check-balance.d.ts +3 -0
  98. package/dist/tools/check-balance.js +20 -7
  99. package/dist/tools/collect.d.ts +20 -0
  100. package/dist/tools/collect.js +226 -0
  101. package/dist/tools/discover.d.ts +14 -6
  102. package/dist/tools/discover.js +161 -20
  103. package/dist/tools/endpoint.d.ts +47 -0
  104. package/dist/tools/endpoint.js +409 -0
  105. package/dist/tools/estimate.d.ts +32 -0
  106. package/dist/tools/estimate.js +191 -0
  107. package/dist/tools/find.d.ts +34 -0
  108. package/dist/tools/find.js +486 -0
  109. package/dist/tools/get-docs.d.ts +1 -1
  110. package/dist/tools/get-docs.js +2 -2
  111. package/dist/tools/legacy.d.ts +20 -0
  112. package/dist/tools/legacy.js +190 -0
  113. package/dist/tools/list-endpoints.d.ts +4 -0
  114. package/dist/tools/list-endpoints.js +63 -19
  115. package/dist/tools/list-platforms.js +2 -2
  116. package/dist/tools/manage.d.ts +26 -0
  117. package/dist/tools/manage.js +94 -0
  118. package/dist/tools/monitors.js +1 -1
  119. package/dist/tools/pricing.d.ts +20 -1
  120. package/dist/tools/pricing.js +271 -7
  121. package/dist/tools/request.d.ts +49 -1
  122. package/dist/tools/request.js +366 -26
  123. package/dist/tools/web.d.ts +2 -2
  124. package/dist/tools/web.js +10 -3
  125. package/dist/types.d.ts +229 -0
  126. package/dist/walk-quote.d.ts +26 -0
  127. package/dist/walk-quote.js +75 -0
  128. package/package.json +8 -5
  129. package/dist/__tests__/auth.test.d.ts +0 -1
  130. package/dist/__tests__/auth.test.js +0 -41
  131. package/dist/__tests__/auth.test.js.map +0 -1
  132. package/dist/__tests__/check-balance.test.d.ts +0 -1
  133. package/dist/__tests__/check-balance.test.js +0 -120
  134. package/dist/__tests__/check-balance.test.js.map +0 -1
  135. package/dist/__tests__/client.test.d.ts +0 -1
  136. package/dist/__tests__/client.test.js +0 -166
  137. package/dist/__tests__/client.test.js.map +0 -1
  138. package/dist/__tests__/cohorts.test.d.ts +0 -1
  139. package/dist/__tests__/cohorts.test.js +0 -325
  140. package/dist/__tests__/cohorts.test.js.map +0 -1
  141. package/dist/__tests__/context.test.d.ts +0 -1
  142. package/dist/__tests__/context.test.js +0 -27
  143. package/dist/__tests__/context.test.js.map +0 -1
  144. package/dist/__tests__/coverage.test.d.ts +0 -1
  145. package/dist/__tests__/coverage.test.js +0 -133
  146. package/dist/__tests__/coverage.test.js.map +0 -1
  147. package/dist/__tests__/data-integrity.test.d.ts +0 -1
  148. package/dist/__tests__/data-integrity.test.js +0 -474
  149. package/dist/__tests__/data-integrity.test.js.map +0 -1
  150. package/dist/__tests__/discover.test.d.ts +0 -1
  151. package/dist/__tests__/discover.test.js +0 -311
  152. package/dist/__tests__/discover.test.js.map +0 -1
  153. package/dist/__tests__/http.test.d.ts +0 -1
  154. package/dist/__tests__/http.test.js +0 -221
  155. package/dist/__tests__/http.test.js.map +0 -1
  156. package/dist/__tests__/monitors.test.d.ts +0 -1
  157. package/dist/__tests__/monitors.test.js +0 -133
  158. package/dist/__tests__/monitors.test.js.map +0 -1
  159. package/dist/__tests__/paginate.test.d.ts +0 -1
  160. package/dist/__tests__/paginate.test.js +0 -80
  161. package/dist/__tests__/paginate.test.js.map +0 -1
  162. package/dist/__tests__/preflight.test.d.ts +0 -1
  163. package/dist/__tests__/preflight.test.js +0 -69
  164. package/dist/__tests__/preflight.test.js.map +0 -1
  165. package/dist/__tests__/pricing.test.d.ts +0 -1
  166. package/dist/__tests__/pricing.test.js +0 -143
  167. package/dist/__tests__/pricing.test.js.map +0 -1
  168. package/dist/__tests__/server.test.d.ts +0 -1
  169. package/dist/__tests__/server.test.js +0 -64
  170. package/dist/__tests__/server.test.js.map +0 -1
  171. package/dist/__tests__/truncation.test.d.ts +0 -1
  172. package/dist/__tests__/truncation.test.js +0 -32
  173. package/dist/__tests__/truncation.test.js.map +0 -1
  174. package/dist/__tests__/validation.test.d.ts +0 -1
  175. package/dist/__tests__/validation.test.js +0 -198
  176. package/dist/__tests__/validation.test.js.map +0 -1
  177. package/dist/__tests__/web.test.d.ts +0 -1
  178. package/dist/__tests__/web.test.js +0 -198
  179. package/dist/__tests__/web.test.js.map +0 -1
  180. package/dist/app.js.map +0 -1
  181. package/dist/auth.js.map +0 -1
  182. package/dist/client.js.map +0 -1
  183. package/dist/constants.js.map +0 -1
  184. package/dist/context.js.map +0 -1
  185. package/dist/data/docs-handwritten.js.map +0 -1
  186. package/dist/data/docs.js.map +0 -1
  187. package/dist/data/endpoints.js.map +0 -1
  188. package/dist/data/platforms.js.map +0 -1
  189. package/dist/data/registry-meta.js.map +0 -1
  190. package/dist/http.js.map +0 -1
  191. package/dist/index.js.map +0 -1
  192. package/dist/paginate.js.map +0 -1
  193. package/dist/pricing.js.map +0 -1
  194. package/dist/schemas/tools.js.map +0 -1
  195. package/dist/server.js.map +0 -1
  196. package/dist/tools/check-balance.js.map +0 -1
  197. package/dist/tools/cohorts.js.map +0 -1
  198. package/dist/tools/discover.js.map +0 -1
  199. package/dist/tools/get-docs.js.map +0 -1
  200. package/dist/tools/list-endpoints.js.map +0 -1
  201. package/dist/tools/list-platforms.js.map +0 -1
  202. package/dist/tools/monitors.js.map +0 -1
  203. package/dist/tools/pricing.js.map +0 -1
  204. package/dist/tools/request.js.map +0 -1
  205. package/dist/tools/web.js.map +0 -1
  206. package/dist/types.js.map +0 -1
package/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  # socialcrawl-mcp
4
4
 
5
- **Give your AI agent access to 65 platforms and 572 endpoints — social media, commerce, marketplaces & product reviews, retail, app stores, places, travel & local, business & software reputation, jobs & salaries, markets & finance, congressional trading disclosures, news, web research, full web scraping & browser automation, on-page SEO, prediction markets, search trends, cross-platform Prism composites, and a universal meta-search — through a single API, with exact credit pricing for every endpoint**
5
+ **Give your AI agent access to 67 platforms and 633 endpoints — social media, commerce, marketplaces & product reviews, retail, app stores, places, travel & local, business & software reputation, jobs & salaries, markets & finance, congressional trading disclosures, news, web research, full web scraping & browser automation, on-page SEO, prediction markets, search trends, cross-platform Prism composites, and a universal meta-search — through a single API, with exact credit pricing for every endpoint**
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/socialcrawl-mcp?style=flat-square&color=blue)](https://www.npmjs.com/package/socialcrawl-mcp)
8
8
  [![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-green?style=flat-square)](https://registry.modelcontextprotocol.io)
9
- [![Platforms](https://img.shields.io/badge/Platforms-65-blue?style=flat-square)](https://socialcrawl.dev)
10
- [![Endpoints](https://img.shields.io/badge/Endpoints-572-green?style=flat-square)](https://socialcrawl.dev/docs)
9
+ [![Platforms](https://img.shields.io/badge/Platforms-67-blue?style=flat-square)](https://socialcrawl.dev)
10
+ [![Endpoints](https://img.shields.io/badge/Endpoints-633-green?style=flat-square)](https://socialcrawl.dev/docs)
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)](LICENSE)
12
12
  [![mcp MCP server](https://glama.ai/mcp/servers/socialcrawl/mcp/badges/score.svg)](https://glama.ai/mcp/servers/socialcrawl/mcp)
13
13
 
@@ -23,16 +23,24 @@
23
23
 
24
24
  ## Overview
25
25
 
26
- `socialcrawl-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI agents to the [SocialCrawl API](https://socialcrawl.dev) — a unified data API covering 65 platforms and 572 endpoints.
26
+ `socialcrawl-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI agents to the [SocialCrawl API](https://socialcrawl.dev) — a unified data API covering 67 platforms and 633 endpoints.
27
27
 
28
- Retrieve profiles, posts, comments, search results, trending content, and analytics from TikTok, Instagram, YouTube, Twitter/X, LinkedIn, Reddit, Threads, Douyin, Telegram, Quora, Apple Music, GitHub, Hacker News, Polymarket, and 30 more platforms. Pull products, offers, price history, reviews, and sellers from Amazon, Walmart, Target, Home Depot, eBay, Klarna, AliExpress, Etsy, Sephora, H&M, Kohl's, Wayfair, Gumtree, and Google Shopping; apps, charts, and reviews from Google Play and the Apple App Store; hotels, restaurants, attractions, cruises, and traveler reviews from Tripadvisor, plus local business data from Yelp and Google Business; brand reputation from Trustpilot and software reviews from G2; job listings and salary bands from LinkedIn, Indeed, Bing, and Xing; market quotes, price history, financial statements, and options chains; US congressional trading disclosures; Korean search and Data Lab trend series from Naver; cross-web brand mentions with sentiment via Content Analysis; Google News headlines and Google Trends interest curves — plus web research via Tavily and Perplexity, AI-powered X search via Grok, on-page SEO audits, and a single `/search/everywhere` endpoint that fans out across 14 sources in one call.
28
+ Retrieve profiles, posts, comments, search results, trending content, and analytics from TikTok, Instagram, YouTube, Twitter/X, LinkedIn, Reddit, Threads, Douyin, Xiaohongshu, Telegram, Quora, Bluesky, Apple Music, GitHub, Hacker News, Product Hunt, Polymarket, and 30 more platforms. Pull products, offers, price history, reviews, and sellers from Amazon, Walmart, Target, Home Depot, eBay, Klarna, AliExpress, Etsy, Sephora, H&M, Kohl's, Wayfair, Gumtree, and Google Shopping; apps, charts, and reviews from Google Play and the Apple App Store; hotels, restaurants, attractions, cruises, and traveler reviews from Tripadvisor, plus local business data from Yelp and Google Business; brand reputation from Trustpilot and software reviews from G2; job listings and salary bands from LinkedIn, Indeed, Bing, and Xing; market quotes, price history, financial statements, and options chains; US congressional trading disclosures; Korean search and Data Lab trend series from Naver; cross-web brand mentions with sentiment via Content Analysis; Google News headlines and Google Trends interest curves — plus web research via Tavily and Perplexity, AI-powered X search via Grok, on-page SEO audits, and a single `/search/everywhere` endpoint that fans out across 14 sources in one call.
29
29
 
30
- New in this release (v1.10.0): a full re-sync with the backend registry — **48 → 65 platforms, 381 → 572 endpoints**. Eighteen new platforms land at once: the marketplace and retail wave (**Klarna**, **AliExpress**, **Sephora**, **Gumtree**, **Etsy**, **H&M**, **Kohl's**, **Wayfair**, **G2**, **Yelp**), the data wave (**Finance** with statements and options chains, **Jobs** across four boards with salary bands, **US Congress Trades** with the full statistics suite, **On-Page** SEO audits), and the social wave (**Douyin**, **Telegram**, **Quora**, **Apple Music**). Tripadvisor grows from 2 endpoints to 16 (hotels, restaurants, attractions, cruises), TikTok gains the Ad Library plus playlists, collections, effects and place feeds, Twitter gains tweet/user search with followers, following and retweeters, and Reddit gains user profiles with their post and comment history.
30
+ New in v2.0.0: **seven tools instead of eleven** (`socialcrawl_find`, `socialcrawl_endpoint`, `socialcrawl_estimate`, `socialcrawl_request`, `socialcrawl_collect`, `socialcrawl_account`, `socialcrawl_manage`), ranked endpoint search, and an endpoint contract that says what data comes back. See [Available Tools](#available-tools) for the 1.x → 2.0 mapping; `SOCIALCRAWL_LEGACY_TOOLS=1` keeps the old names for this major version. The catalogue is now 633 endpoints (dump schema v4).
31
31
 
32
- Also new: a tenth tool, **`socialcrawl_cohorts`** — the audience-filtered mention search. Upload a panel of up to 10,000 public identities you already care about and ask which of *them* posted your keywords, with a coverage record for every member so a partial crawl can never read as "nobody talked about you". Its `estimate_cost` action computes the credit ceiling locally, for free, before you commit. `socialcrawl_discover` gains a `status` action over the public `/v1/status` route, so an agent can check a platform's circuit-breaker state before retrying a persistent 502. One API key, one consistent response format, every platform.
32
+ In v1.13.0: a registry re-sync from **575 to 631 endpoints and 65 to 67 platforms**, plus first-class support for the API's new judgment and cost-lever layer.
33
+
34
+ - **56 new endpoints.** Two new platforms: **Xiaohongshu** (search, trending, profile, notes, comments) and **Product Hunt** (launches). There are 22 new LinkedIn routes: profile bundles (`profile/all`, `profile/complete`, `profile/with-posts`), company by domain, also-viewed pages, employee counts, Pulse articles with their comments and reactions, hashtag/company/search-URL search, hiring teams, similar members and followed interests. Facebook gains keyword search over posts, pages, people, videos and groups. Prism adds 12 composites (`find-accounts`, `mentions`, `adverse-screen`, `brief-check`, `format-lift`, `earliness`, `trend-board`, `audience-language`, `comment-leads`, `investigate`) and **async background jobs** (`POST /v1/prism/jobs`, up to 5,000 items). Also new: `search/multi`, `tiktok/similar`, `instagram/media/screen-text`, `pinterest/trends`, `apple_music/charts`, `bluesky/search`, and the free `utility/capabilities` and `utility/plan`.
35
+ - **Judgments, priced exactly.** About 50 list endpoints now label their rows for free by default (sponsored/intent/niche on posts, sentiment/question/purchase_intent/complaint on comments, sentiment/issue on reviews), and searches score relevance for free. Metered presets, `intent` with `offer=`, and `relevant_to=` hold 1 credit per started 25 rows. `socialcrawl_pricing` gains `action: "judgments"`, and `socialcrawl_request` quotes the hold on the call that spends it.
36
+ - **Exact quotes for the call you will make.** `socialcrawl_pricing` with `action: "endpoint"` now takes `params` (the exact query: `include`, `label`, `relevant_to`, `max_pages`, …) and `calls`. It returns an itemised hold per page, per call (× `max_pages`), and for the whole job.
37
+ - **60 endpoints changed price**, mostly flat ladder prices that became metered bands as they gained `label=`, `max_pages`, `seen` and `scan_pages`. Every surface quotes the new bands and names the levers that move them.
38
+ - **New discovery.** `socialcrawl_discover` gains `capabilities` (each cross-cutting param, its price and every endpoint that supports it) and `plan` (a job in plain words turned into priced calls). Endpoint guides and listings show the registry's featured params and curated related endpoints.
39
+ - **Path params and multi-method resources.** `socialcrawl_request` accepts `jobs/{job_id}` with `params: { job_id }` or the concrete path, and takes `method` (or infers POST from a `body`) for resources served by both GET and POST.
40
+ - New docs topics: `judgments` and `batch-jobs`. The `credits` and `pagination` topics cover `max_pages`, `seen`, `since` / `stop_at_id`, `data._warnings` for dropped params, and `meta.hint`.
33
41
 
34
42
  **What the MCP server does:**
35
- - Discovers platforms and endpoints dynamically, or by free-text search across all 572 of them
43
+ - Finds the right endpoint for a task in plain words (ranked search across all 633, with URLs and handles resolved), and tells the agent what data each one returns
36
44
  - Fetches live data on your behalf across every platform, method, and composite
37
45
  - Prices every call up front — ladder, flat, or metered band — so an agent can budget before it spends
38
46
  - Validates requests locally before calling the API: required params, `oneOf` groups, enum values, integer ranges, parameter couplings, and CSV limits. A bad call fails free instead of burning credits
@@ -67,7 +75,7 @@ claude mcp add --scope user --transport http socialcrawl https://mcp.socialcrawl
67
75
 
68
76
  **Cursor / Windsurf / VS Code** — choose the HTTP ("streamable-http") server type with the same URL and header. `x-api-key: sc_your_key_here` works as an alternative header.
69
77
 
70
- The discovery tools (`socialcrawl_list_platforms`, `socialcrawl_list_endpoints`, `socialcrawl_get_docs`) work without a key, so you can explore before signing up. claude.ai custom connectors (Settings → Connectors) require OAuth, which ships in a follow-up release — use the header-based setup above in the meantime.
78
+ The discovery tools (`socialcrawl_find`, `socialcrawl_endpoint`, `socialcrawl_estimate`) work without a key, so you can explore before signing up. claude.ai custom connectors (Settings → Connectors) require OAuth. An OAuth 2.1 resource-server mode is in preview and off by default (`SOCIALCRAWL_OAUTH=1`; see `docs/REMOTE-STREAMABLE-HTTP.md`); until it is enabled on the hosted server, use the header-based setup above.
71
79
 
72
80
  Prefer running it locally? Every stdio option below works exactly as before.
73
81
 
@@ -239,7 +247,7 @@ Show me all the TikTok endpoints
239
247
  Which endpoints can give me video transcripts?
240
248
  ```
241
249
 
242
- The last one is a cross-platform `socialcrawl_list_endpoints` search — no platform needed, it looks across all 572 endpoints.
250
+ Each is a `socialcrawl_find` call: the task in plain words, ranked across all 633 endpoints, no platform needed.
243
251
 
244
252
  ### Learn the API from the API
245
253
 
@@ -255,7 +263,7 @@ Show me exactly how to call the Prism comments endpoint
255
263
  Is this MCP server's endpoint list up to date?
256
264
  ```
257
265
 
258
- All three hit `socialcrawl_discover` and cost nothing.
266
+ These hit `socialcrawl_endpoint` and `socialcrawl_account` and cost nothing.
259
267
 
260
268
  ### Check what something costs before running it
261
269
 
@@ -271,7 +279,7 @@ Show me everything I can call for 1 credit
271
279
  Why did that last call charge me 7 credits instead of 2?
272
280
  ```
273
281
 
274
- The first two hit `socialcrawl_pricing`; the third reads the credit ledger via `socialcrawl_check_balance` with `view: "transactions"` and shows the deduction and refund rows for that `request_id`.
282
+ The first two hit `socialcrawl_estimate`; the third reads the credit ledger via `socialcrawl_account` with `view: "transactions"` and shows the deduction and refund rows for that `request_id`.
275
283
 
276
284
  ### Access documentation
277
285
 
@@ -308,52 +316,50 @@ Every response follows a unified envelope format:
308
316
 
309
317
  ## Available Tools
310
318
 
311
- The MCP server exposes 10 tools:
319
+ Version 2.0.0 exposes 7 tools (about 4.7k tokens of `tools/list`, down from about 12.8k for the 11 tools of 1.x):
312
320
 
313
- | Tool | Description | Needs API key? |
314
- |------|-------------|----------------|
315
- | `socialcrawl_list_platforms` | Discover all 65 platforms, grouped by category, with endpoint counts and per-platform credit ranges | No |
316
- | `socialcrawl_list_endpoints` | Endpoints with their full parameter contract — types, integer ranges, enum values, parameter couplings, CSV limits, pagination style, cache TTL, and pricing. Pass a `platform`, or a `search` term to find an endpoint across all 572. Filter by `method` and `maxCost` | No |
317
- | `socialcrawl_pricing` | Exact credit cost for every endpoint: the tier ladder, every flat override, all metered bands with their charging rules and price-driving parameters, per-platform cost tables, and budget-filtered rankings (`maxCost`, `model`, `sort`) | No |
318
- | `socialcrawl_request` | Make any SocialCrawl API call — profiles, posts, comments, search, trends, analytics, Prism composites. GET endpoints take query `params`; POST batch endpoints (e.g. youtube/videos, prism/profiles) take their array/object `body`. Supports an optional `idempotencyKey` for retry-safe calls | Yes |
319
- | `socialcrawl_check_balance` | Credit balance and recent deductions, or the itemised ledger (`view: "transactions"`) — every deduction and refund keyed by `request_id`. Calls `/v1/credits/{balance,transactions}` — costs 0 credits | Yes |
320
- | `socialcrawl_monitors` | Create and manage stateful monitors that re-run any recipe on a cadence, deliver results to a signed webhook, and accumulate a time-series. Actions: create, list, get, runs, timeseries, pause, resume, delete | Yes |
321
- | `socialcrawl_web` | Full web scraping & browser automation (the `web` platform). Sync scrape/search/map/extract; async crawl/batch_scrape/agent jobs with poll/cancel/errors; free crawl parameter preview; stateful monitors; interactive browser sessions. One `action` per endpoint | Yes |
322
- | `socialcrawl_cohorts` | Audience-filtered mention search (`/v1/cohorts/*`) — upload up to 10,000 public identities you already care about, then ask which of *them* posted your keywords. Actions: create, add_members, estimate_cost (local, free), query, query_status, query_results, query_cancel, get, delete. Everything but the query is 0 credits | Yes |
323
- | `socialcrawl_discover` | The API describing itself, live, at 0 credits (`/v1/utility/*`) — quickstart, the full endpoint catalogue with live metered-aware prices, one endpoint's complete usage guide, the agent context corpus, a freshness check that tells you whether this server's bundled catalogue has fallen behind the API, and every platform's live circuit-breaker `status` | Optional |
324
- | `socialcrawl_get_docs` | API documentation by topic or platform — overview, authentication, credits, pricing, errors, idempotency, pagination, caching, response-schema, limits, monitors, cohorts, discovery, or any platform slug. Long topics are paged, never truncated | No |
321
+ | Tool | What it does | Needs API key? |
322
+ |------|--------------|----------------|
323
+ | `socialcrawl_find` | **Start here.** A task in plain words becomes the best endpoints (3 by default), each with the params the task already supplies (URLs and `@handles` are resolved), the params still missing, the credit cost and the exact call to make. `platform` narrows it. With no task it lists the platforms, or one platform's endpoints. Ranked by the live `/v1/utility/find` when deployed, otherwise by the bundled ranker (BM25 over id, summary, returns, use_when and tags, with a platform boost) | No |
324
+ | `socialcrawl_endpoint` | The contract for one endpoint (`id: "tiktok/post/comments"`): purpose, required and optional params, where the rows are (`rows_at`) and up to 25 response fields, cost and pricing rule, paging, measured latency and timeout, next endpoints, and a sample-response link. A platform slug returns its endpoint table; a topic (`errors`, `pricing`, `pagination`, `judgments`, `hydration`, `overview`, ...) returns that guide. Live through `/v1/utility/endpoint` when a key is set | No |
325
+ | `socialcrawl_estimate` | Exact cost before you spend: one call (`id` + the `params` you will send, `calls` for a job total, `items` for a walk) or a `plan` of calls. Uses `/v1/utility/estimate` when deployed, otherwise the bundled pricing. A platform slug returns its price table; no id returns the pricing overview | No |
326
+ | `socialcrawl_request` | Call one endpoint: `platform`, `resource`, `params` (or `body` for POST batch endpoints). Validates locally first, quotes, refuses above `max_credits`, confirms above `SOCIALCRAWL_CONFIRM_ABOVE`, and returns `structuredContent` (rows, credits, paging). `fields` / `max_items` / `format` shape the result; large pages are cut at row boundaries behind a `socialcrawl://results/<request_id>` link. An unknown platform or resource gets a did-you-mean | Yes |
327
+ | `socialcrawl_collect` | Walk a paged endpoint until `items` unique rows, the last page, or `max_credits`, in one call, with a resource link to every row as JSONL, JSON or CSV | Yes |
328
+ | `socialcrawl_account` | Free checks: `balance` (with this session's spend), `transactions` (the itemised ledger, or the receipts for one `request_id`), `status` (platform health) and `freshness` (is this server's catalogue behind the API) | Yes (except `status`) |
329
+ | `socialcrawl_manage` | Stateful work by `area` + `action`: `monitors` (scheduled recipes), `cohorts` (mention search over your own panel), `web` (scrape, search, map, extract, crawl/batch/agent jobs, change monitors, browser sessions) and `jobs` (Prism background jobs: submit, list, get). The action's fields go in `input`, the resource id in `id`; a wrong field is refused free with the rules | Yes |
325
330
 
326
- Four of the ten tools work without an API key — they query local bundled data generated from the backend registry. `socialcrawl_request`, `socialcrawl_check_balance`, `socialcrawl_monitors`, `socialcrawl_web`, and `socialcrawl_cohorts` require a key. `socialcrawl_discover` uses a key when it has one and falls back to bundled data when it does not (its `status` action needs no key at all).
331
+ **Upgrading from 1.x.** Set `SOCIALCRAWL_LEGACY_TOOLS=1` to also register the nine retired 1.x names as thin wrappers for this major version. The mapping:
327
332
 
328
- ### Discovery — the API describing itself, for free
333
+ | 1.x tool | 2.0 tool |
334
+ |----------|----------|
335
+ | `socialcrawl_list_platforms` | `socialcrawl_find` with no arguments |
336
+ | `socialcrawl_list_endpoints` | `socialcrawl_find` (`task` or `platform`); `socialcrawl_endpoint` for one contract |
337
+ | `socialcrawl_pricing` | `socialcrawl_estimate` |
338
+ | `socialcrawl_discover` | `socialcrawl_endpoint` (endpoint guide), `socialcrawl_find` (catalog, plan), `socialcrawl_account` (freshness, status) |
339
+ | `socialcrawl_get_docs` | `socialcrawl_endpoint` with the topic as `id` |
340
+ | `socialcrawl_check_balance` | `socialcrawl_account` (`requestId` is now `request_id`) |
341
+ | `socialcrawl_monitors` / `socialcrawl_web` / `socialcrawl_cohorts` | `socialcrawl_manage` with `area: "monitors"` / `"web"` / `"cohorts"` |
342
+ | `socialcrawl_request`, `socialcrawl_collect` | unchanged (`platform` is now a plain string with did-you-mean) |
329
343
 
330
- `socialcrawl_discover` drives the **`/v1/utility/*`** family: four endpoints that let any client learn the whole API from inside the API, at **0 credits**. They are served in-process from the endpoint registry — no upstream call, no network hop — so they can never drift from what is actually callable.
344
+ ### Discovery, live and bundled
331
345
 
332
- | Action | Endpoint | What you get |
333
- |--------|----------|--------------|
334
- | `quickstart` | `/v1/utility/quickstart` | Auth, base URL, a runnable first call, the success and error envelopes, the billing model, the **full error taxonomy**, rate limits, and the paging contract — in one response |
335
- | `catalog` | `/v1/utility/endpoints` | Every endpoint with its live metered-aware price label, required and optional params, `oneOf` groups, and paging flag. Filter by `platform` / `search` / `method` |
336
- | `endpoint` | `/v1/utility/endpoint` | One endpoint's complete usage guide — every parameter with type and example, the exact pricing rule, cache TTL, paging recipe, an example response, a copy-paste curl, and related endpoints |
337
- | `llms` | `/v1/utility/llms` | The agent context corpus for the whole API or one platform, as markdown or JSON — bootstrap an agent in one call instead of crawling docs |
338
- | `freshness` | — | Compare the live registry against this server's bundled catalogue |
346
+ `socialcrawl_find`, `socialcrawl_endpoint` and `socialcrawl_estimate` answer from data bundled with the server (generated from the backend registry, dump schema v4) and need no key. With a key they first ask the API's free `/v1/utility/*` routes (`find`, `resolve`, `endpoint`, `estimate`), which answer from the live registry, and fall back to the bundled answer when a route is not deployed. Every one of these is 0 credits.
339
347
 
340
- **Why `freshness` matters.** This server ships a catalogue generated when it was built; the API keeps moving. Data calls always hit the live API and keep working — but discovery, pricing, and local validation answer from that snapshot, so a newly added endpoint looks unknown until you upgrade. One free call tells you which situation you are in:
348
+ **Why freshness matters.** This server ships a catalogue generated when it was built; the API keeps moving. Data calls always hit the live API and keep working, but discovery, pricing and local validation answer from that snapshot. The server checks this itself once per process and, when it is behind, adds one line to the next tool result. One free call tells you which situation you are in:
341
349
 
342
350
  ```
343
- socialcrawl_discover action: "freshness"
351
+ socialcrawl_account view: "freshness"
344
352
  ```
345
353
 
346
- **Bundled vs live.** `list_platforms`, `list_endpoints`, `pricing`, and `get_docs` answer instantly from bundled data and need no key — prefer them for browsing. Reach for `socialcrawl_discover` when correctness matters more than latency: an endpoint looks missing, you need a metered endpoint's exact live price, or you are generating code that must match production today. Without a key it still answers everything except `llms` from bundled data, so discovery never hard-requires auth.
347
-
348
354
  These same endpoints are plain HTTP, so a third-party integration or a non-MCP agent framework gets the identical information with a `curl`.
349
355
 
350
356
  ### Pricing — know the cost before you spend
351
357
 
352
- `socialcrawl_pricing` exists because a single number is a lie for most of the surface. SocialCrawl bills three ways:
358
+ `socialcrawl_estimate` exists because a single number is a lie for most of the surface. SocialCrawl bills three ways:
353
359
 
354
- - **Ladder** (294 endpoints) — the tier rate per request: standard 1cr, advanced 5cr, premium 10cr.
355
- - **Flat** (61 endpoints, 18 of them free) — a per-endpoint override, e.g. `/v1/search/everywhere` at 20cr flat.
356
- - **Metered** (26 endpoints) — the charge depends on the request. An upfront ceiling is deducted and refunded down to the work actually done.
360
+ - **Ladder** (431 endpoints) — the tier rate per request: standard 1cr, advanced 5cr, premium 10cr.
361
+ - **Flat** (70 endpoints, 22 of them free) — a per-endpoint override, e.g. `/v1/search/everywhere` at 20cr flat.
362
+ - **Metered** (130 endpoints) — the charge depends on the request. An upfront ceiling is deducted and refunded down to the work actually done.
357
363
 
358
364
  Quoting a metered endpoint's base cost understates every call: `/v1/search/news` has a 1cr base but really charges **2–62cr** — one credit per Google country leg that returns articles, plus per-article billing when the bing engine is added. The tool returns the real band, the registry's own charging rule, the parameters that move the bill, and the worst case to budget for:
359
365
 
@@ -362,24 +368,69 @@ action: "overview" → ladder, every free endpoint, every flat override, every
362
368
  action: "endpoint" → one endpoint's price, rule, price-driving params, paging cost, worst case
363
369
  action: "platform" → a whole platform's cost table
364
370
  action: "list" → rank/filter by cost — "everything I can call for 1 credit", "the 10 most expensive endpoints"
371
+ action: "hydration" → every include= row join: what it fills, per-row rate, row cap, fully-joined ceiling
372
+ action: "judgments" → every judged list: free default labels/relevance, metered presets, the hold per opt-in
373
+ ```
374
+
375
+ Pass the `include` you intend to send to `action: "endpoint"` and the band becomes arithmetic — the exact hold, itemised per join, using the same formula the backend's pricer runs:
376
+
377
+ ```
378
+ action: "endpoint", platform: "linkedin", resource: "search/people", include: "profile", rows: 3
379
+ → holds 22 credits (10cr page + 12cr for 3 rows of `profile`), settling anywhere down to 10
365
380
  ```
366
381
 
367
- It also states the rules that make the real charge differ from the sticker price: cache hits, idempotent replays, empty results, and upstream failures are all 0 credits.
382
+ Or pass the exact `params` you will send (and `calls`, for a whole job). Joins, metered judgments and `max_pages` are all itemised, and `max_pages` multiplies the page, because each page walked is billed as one call:
383
+
384
+ ```
385
+ action: "endpoint", platform: "youtube", resource: "search", calls: 10,
386
+ params: { query: "espresso", include: "engagement,channel", label: "mention", brand: "Acme", max_pages: "3" }
387
+ → 1cr page + 5cr engagement + 5cr channel + 4cr label=mention = up to 15cr per page
388
+ × 3 pages = up to 45cr per call; 10 calls = up to 450 credits held, settling to what was filled and judged
389
+ ```
390
+
391
+ It also states the rules that make the real charge differ from the sticker price. Cache hits, idempotent replays, empty results, upstream failures and `dry_run=1` previews are all 0 credits; `seen=<id>` discounts each page by its share of rows you already received; `since` / `stop_at_id` end a walk at rows you already hold.
392
+
393
+ ### Judgments — labels and relevance, free by default
394
+
395
+ About 50 list endpoints judge their rows for you at no extra credit. Posts carry `sponsored`, `intent` and `niche`; comments carry `sentiment`, `question`, `purchase_intent` and `complaint`; reviews carry `sentiment` and `issue`. All of these land under `computed.labels`, and the judged searches score each row's relevance to your query under `computed.relevance`. Only these add credits:
396
+
397
+ - a metered preset: `mention` (with `brand=`), `quality`, `injection` on posts; `spam`, `toxic`, `low_quality` on comments; `reports`, `incentivized` on reviews,
398
+ - `label=intent` with `offer=` (what you sell),
399
+ - `relevance=score|filter` with your own topic in `relevant_to=`.
400
+
401
+ Each holds 1 credit per started 25 rows of the page (4cr on a 100-row page) and settles to the rows judged fresh. Already-judged rows and cached pages are free. `judgments=off` turns the defaults off, and `dry_run=1` previews the cost for 0 credits. `socialcrawl_endpoint` with `id: "judgments"` is the full contract.
402
+
403
+ ### Row hydration — one call instead of a page plus a lookup per row
404
+
405
+ Some lists are thin because the upstream publishes nothing else on them: a Pinterest search result has no save count, a LinkedIn reactor row no follower count, a YouTube playlist no view counts or durations. Another SocialCrawl endpoint answers each of those for one row — so 33 endpoints now accept an `include=` token that joins every row to that sibling in the same call.
406
+
407
+ ```
408
+ GET /v1/pinterest/search?query=kitchen&include=engagement → saves, likes, comments, shares on every row
409
+ GET /v1/youtube/playlist?playlistId=PL...&include=engagement,channel
410
+ GET /v1/linkedin/search/people?keywords=cto&include=profile&limit=3
411
+ ```
412
+
413
+ - **Opt-in.** No token, no join, no extra credit, no extra latency — a caller who never asks pays exactly what they always paid.
414
+ - **Billed per row actually filled.** The ceiling is held up front; a credit is kept only for a row a fresh sibling lookup filled. Rows served from the sibling's cache are free, unfillable rows are refunded, and a page that joined in full is cached whole, so an immediate repeat is 0 credits.
415
+ - **A row cap caps the bill.** `limit=3&include=profile` on LinkedIn holds 22 credits, not 50.
416
+ - **It tells you what it did.** `data.hydration` reports rows, lookups, cache hits, credits held vs kept, and milliseconds; `_warnings` carries `<token>_partial` when only some rows filled.
417
+
418
+ `socialcrawl_endpoint` with `id: "hydration"` lists every join, its price and the full contract; `socialcrawl_estimate` quotes one call with its `include`.
368
419
 
369
420
  ### Monitors — schedule any recipe
370
421
 
371
- `socialcrawl_monitors` wraps any registry endpoint or Prism composite in a scheduled, stateful monitor (`/v1/monitors/*`). It re-runs the recipe hourly/daily/weekly (or on a cron), delivers each result to an HMAC-signed webhook, raises alerts on metric thresholds or changes, and keeps a per-run time-series you can read back. *"Prism answers once; monitors watch it for you."* Managing monitors costs 0 credits; each scheduled run bills the recipe's normal cost plus a 1-credit scheduling premium. See `socialcrawl_get_docs` topic `monitors` for the full contract.
422
+ `socialcrawl_manage` with `area: "monitors"` wraps any registry endpoint or Prism composite in a scheduled, stateful monitor (`/v1/monitors/*`). It re-runs the recipe hourly/daily/weekly (or on a cron), delivers each result to an HMAC-signed webhook, raises alerts on metric thresholds or changes, and keeps a per-run time-series you can read back. *"Prism answers once; monitors watch it for you."* Managing monitors costs 0 credits; each scheduled run bills the recipe's normal cost plus a 1-credit scheduling premium. See `socialcrawl_endpoint` with `id: "monitors"` for the full contract.
372
423
 
373
424
  ### Web — scrape, crawl, browse
374
425
 
375
- `socialcrawl_web` drives the full web-scraping and browser-automation surface (the `web` platform, `/v1/web/*`) through a single `action` parameter:
426
+ `socialcrawl_manage` with `area: "web"` drives the full web-scraping and browser-automation surface (the `web` platform, `/v1/web/*`) through a single `action` parameter:
376
427
 
377
428
  - **Sync reads** — `scrape` (URL → markdown/HTML/screenshot/links), `search` (web search with page content), `map` (discover a site's URLs), `extract` (LLM structured data from a page).
378
429
  - **Async jobs** — `crawl` a whole site, `batch_scrape` many URLs, or `agent` (autonomous multi-step web task); each returns a job you poll with `job_get`/`job_list`, inspect with `job_errors` (per-page failures), and stop with `job_cancel`. `crawl_preview` dry-runs a crawl's parameters for free before you pay for it.
379
430
  - **Monitors** — `monitor_create`/`list`/`get`/`update`/`delete`/`checks` re-check a URL on a cadence and deliver changes to a webhook.
380
431
  - **Sessions** — `session_create`/`get`/`list`, `session_execute` (run code in the live page), `session_close`.
381
432
 
382
- Most of the paid web surface is metered rather than flat: a crawl holds `limit` credits and refunds every page it did not crawl; a session holds against `ttl_seconds` and settles on close. Job, monitor, and session management is 0 credits. See `socialcrawl_get_docs` topic `web`, or `socialcrawl_pricing` with `platform: "web"`.
433
+ Most of the paid web surface is metered rather than flat: a crawl holds `limit` credits and refunds every page it did not crawl; a session holds against `ttl_seconds` and settles on close. Job, monitor, and session management is 0 credits. See `socialcrawl_endpoint` with `id: "web"`, or `socialcrawl_estimate` with `id: "web"`.
383
434
 
384
435
  ### Smart validation
385
436
 
@@ -393,13 +444,13 @@ Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make t
393
444
 
394
445
  | Platform | Endpoints | Data Available |
395
446
  |----------|-----------|----------------|
396
- | **LinkedIn** | 45 | Profiles & company pages, posts, reposts, reactions, comments & replies, people/company-people search, profile sub-resources (experience, education, skills, certifications…), the complete post-history archive walk (metered per post), jobs (search, company jobs, details), company insights, groups, transcripts, Ad Library, profile-360 |
397
- | **Instagram** | 37 | Profiles, account transparency (profile/about), posts, reels, comments & comment replies, highlights, stories, tagged & location feeds, followers/following, similar accounts, post likers, reshare stats, one-call reels/posts feeds with share counts, engagement analytics, universal + popular-post search, reels/hashtag/profile/location/music search, trending, transcripts, profile-360 |
398
- | **TikTok** | 34 | Profiles, videos, comments & replies, on-screen text extraction, keyword/hashtag/user/music search + suggestions, hashtag details, trending, audience, followers, liked videos, playlists & collections, place feeds, effects, live, songs, transcripts, Ad Library, profile-360 |
399
- | **Prism** | 33 | Cross-platform composites — URL lookup, comment harvesting, batch comment/profile lookup, handle-audit, brand mentions, demand signals, AI visibility, crisis radar/post-mortem, reputation, share-of-voice, creator vetting & creator cards, org radar, Korea gap, AI consensus answers, video/app/product intelligence |
447
+ | **LinkedIn** | 68 | Profiles (single sub-resources or one-call bundles: all, complete, with-posts) & company pages (incl. lookup by domain, also-viewed, employee counts), posts & post-with-comments, reposts, reactions, comments & replies, Pulse articles with comments and reactions, people search (keyword or search-URL), company & hashtag search, similar members, profile sub-resources (experience, education, skills, position skills, certifications, followed schools/newsletters/Top Voices, last activity…), jobs (search, company jobs, jobs a member posted, hiring team, details), company insights, groups, the complete post-history archive (metered per post), transcripts, Ad Library, profile-360 |
448
+ | **Prism** | 46 | Cross-platform composites — URL lookup, comment harvesting, batch post-stats/profile/comment lookup, async background jobs of up to 5,000 items, handle-audit, name→accounts resolution (find-accounts), handle/link mentions, adverse-post screening, campaign-brief checks, hook/format lift, term earliness, a no-keyword country trend board, commenter language mix, comment-sourced buyer leads, brand mentions, demand signals, AI visibility, crisis radar/post-mortem, reputation, share-of-voice, creator vetting & creator cards, org radar, Korea gap, AI consensus answers, video/app/product intelligence |
449
+ | **Instagram** | 38 | Profiles, account transparency (profile/about), posts, reels, comments & comment replies, highlights, stories, tagged & location feeds, followers/following, similar accounts, post likers, reshare stats, one-call reels/posts feeds with share counts, engagement analytics, universal + popular-post search, reels/hashtag/profile/location/music search (reel search with creator cards via `include=creator`), on-screen text (OCR), trending, transcripts, profile-360 |
450
+ | **TikTok** | 37 | Profiles, videos, comments & replies, on-screen text extraction, keyword/hashtag/user/music search + suggestions, hashtag details, trending (global or in-country For You), TikTok's own popular-hashtag and Top Videos boards, audience, similar accounts, followers, liked videos, playlists & collections, place feeds, effects, live, songs, transcripts, Ad Library, profile-360 |
451
+ | **Facebook** | 29 | Pages, groups & group posts, posts, comments & replies, photos, reels (incl. full reels feed with view counts), events & event search, Marketplace, keyword search over posts/pages/people/videos/groups, transcripts, full Ad Library |
400
452
  | **YouTube** | 29 | Channels, videos, shorts, comments & replies, sponsors, playlists & items, community posts, search (advanced + autocomplete), trending, live streams, channel contact email lookup, media files (audio/video/subtitles/thumbnails), transcripts, batch videos/channels/transcripts, profile-360 |
401
- | **Facebook** | 24 | Pages, groups & group posts, posts, comments, photos, reels (incl. full reels feed with view counts), events, Marketplace, transcripts, full Ad Library |
402
- | **Web Scraping** | 22 | Scrape, web search, site map, LLM extract, async crawl/batch-scrape/agent jobs with per-page error feeds, change monitors, interactive browser sessions, document parse — driven by `socialcrawl_web` |
453
+ | **Web Scraping** | 22 | Scrape, web search, site map, LLM extract, async crawl/batch-scrape/agent jobs with per-page error feeds, change monitors, interactive browser sessions, document parse — driven by `socialcrawl_manage` (area `web`) |
403
454
  | **US Congress Trades** | 19 | US Congress STOCK Act disclosures — trade feeds (all/48h/7d), members, per-politician and per-ticker stats and trades, state delegations, and the full statistics suite (party, sectors, issuers, volume, unusual activity, buy/sell ratio, late filings) |
404
455
  | **Klarna** | 18 | Product details and every merchant offer, keyword search + suggestions, user and professional reviews with score overviews, price history, product comparison, category browsing with filters/keywords/buying guides, store listings |
405
456
  | **Tripadvisor** | 16 | Hotels, restaurants, attractions and cruise ships — search and full detail for each, traveler reviews with owner replies, place lookup by URL, destination autocomplete, experience types |
@@ -421,31 +472,32 @@ Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make t
421
472
  | **G2** | 7 | Software marketplace — product pages, reviews, category listings and the category index, vendor profiles and their catalogue, product URL index |
422
473
  | **Quora** | 7 | Question search and detail, answer search, Space post search, profile search, Space/topic search |
423
474
  | **H&M** | 6 | Keyword search + suggestions, store listings by country, countries/languages, category tree, per-product supplier and factory disclosure |
475
+ | **Pinterest** | 6 | Pins, boards, user boards, search, Pinterest Trends by country, URL save-counts |
424
476
  | **Spotify** | 6 | Artists, tracks, albums, podcasts, episodes, search |
425
477
  | **Threads** | 6 | Profiles, posts, post comments, keyword search, user search |
478
+ | **Utility** | 6 | Free API self-discovery — quickstart, endpoint catalogue, per-endpoint usage guide, cross-cutting capabilities index, plain-words call planner, LLM context payload. 0 credits, served from the live registry. Behind `socialcrawl_find`, `socialcrawl_endpoint`, `socialcrawl_estimate` and `socialcrawl_account` |
479
+ | **Xiaohongshu** | 6 | RED / Little Red Book — note search, hot-search board, creator profiles and their notes, note detail, top-level comments (5cr per returned row) |
480
+ | **Apple Music** | 5 | Catalog search, artist, album, track, per-country charts (songs, albums, music videos, playlists) |
426
481
  | **Google Shopping** | 5 | Product search, product details, price history, cross-retailer reviews, per-seller offers |
427
482
  | **Kohl's** | 5 | Keyword search, reviews, product questions and answers, store lookup, category tree |
428
- | **Pinterest** | 5 | Pins, boards, search, URL save-counts |
429
483
  | **Rumble** | 5 | Search, channel videos, video details, comments, transcripts |
430
484
  | **Target** | 5 | Product details by TCIN, reviews, category browsing, full taxonomy, store lookup |
431
485
  | **TikTok Shop** | 5 | Products, reviews, listings, search, creator showcases |
486
+ | **Universal Search** | 5 | One query fanned out across 14 platforms (20cr flat); `multi` — each named platform's own native search in one call at the sum of their page prices; forums lane; multi-country news lane (metered); creator-discovery lane across TikTok/Threads/Instagram |
432
487
  | **Walmart** | 5 | Product details, reviews, keyword search, category browsing, seller offers |
433
488
  | **Yelp** | 5 | Business profiles by encid, business reviews, business search (compact and full-card), search suggestions |
434
- | **Apple Music** | 4 | Catalog search, artist, album, track |
489
+ | **Bluesky** | 4 | Profiles, user posts, post details, keyword post search |
435
490
  | **Etsy** | 4 | Listings by id or URL, a shop's catalogue, similar listings, search suggestions |
436
491
  | **Hacker News** | 4 | Story search, story, comment tree, profile |
437
492
  | **Home Depot** | 4 | Keyword search, product details by item id or URL (store/zip-aware pricing), reviews, store lookup by ZIP |
438
493
  | **Tavily** | 4 | Web search (with LLM answer), URL extraction, sitemap, full crawl |
439
494
  | **Twitch** | 4 | Profiles, clips, videos, schedules |
440
- | **Universal Search** | 4 | One query fanned out across 14 platforms (20cr flat); forums lane; multi-country news lane (metered); creator-discovery lane across TikTok/Threads/Instagram |
441
- | **Utility** | 4 | Free API self-discovery — quickstart, endpoint catalogue, per-endpoint usage guide, LLM context payload. 0 credits, served from the live registry. Driven by `socialcrawl_discover` |
442
- | **Bluesky** | 3 | Profiles, posts |
495
+ | **Google Trends** | 3 | Interest-over-time (explore), rising/breakout related queries, and Trending Now by location |
443
496
  | **Kwai** | 3 | Profiles, posts |
444
497
  | **Telegram** | 3 | Public channel profiles, channel post feeds, single post lookup |
445
498
  | **Truth Social** | 3 | Profiles, posts |
446
499
  | **Wayfair** | 3 | Product search, product details by SKU, reviews |
447
500
  | **eBay** | 2 | Listing search incl. sold/completed with realised prices, listing details |
448
- | **Google Trends** | 2 | Interest-over-time (explore) + rising/breakout related queries |
449
501
  | **Snapchat** | 2 | Profiles, Spotlight comments |
450
502
  | **Trustpilot** | 2 | Business search, company reviews |
451
503
  | **Google News** | 1 | Real-time Google News SERP search |
@@ -458,12 +510,13 @@ Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make t
458
510
  | **Perplexity** | 1 | Sonar web research with cited sources |
459
511
  | **Pillar** | 1 | Link pages |
460
512
  | **Polymarket** | 1 | Prediction-market research — multi-query fan-out + ranking |
513
+ | **Product Hunt** | 1 | Current Product Hunt launches (~50 per page), optionally by topic |
461
514
 
462
- **Total: 572 endpoints across 65 platforms.**
515
+ **Total: 633 endpoints across 67 platforms.**
463
516
 
464
517
  ## Error Handling
465
518
 
466
- The MCP server handles errors gracefully and gives the agent actionable guidance:
519
+ The MCP server handles errors gracefully and gives the agent actionable guidance. Every API error passes the server's own `error.message` through, followed by `reason: …` when the API names one and `request_id: req-…` on its own line (read from the body, or the `X-Request-Id` header when the body is not JSON). Quote the `request_id` when you report a problem: it is how a call is found in the logs and the credit ledger.
467
520
 
468
521
  | Error | What the agent sees |
469
522
  |-------|---------------------|
@@ -473,7 +526,7 @@ The MCP server handles errors gracefully and gives the agent actionable guidance
473
526
  | Bad platform/resource | Suggests using discovery tools to find the right endpoint |
474
527
  | Missing parameters | Lists exactly what's missing with examples — caught locally, before billing |
475
528
  | Invalid parameter value | Names the illegal enum value, out-of-range integer, broken coupling, or over-long CSV — caught locally, before billing |
476
- | Resource not found (404) | Reports the upstream resource doesn't exist; credits auto-refunded (BIL-01) |
529
+ | Resource not found (404) | The server's reason the item is missing (e.g. `reason: video_gone`) and whether you were charged (BIL-01) |
477
530
  | Idempotency-Key conflict (409) | Tells the agent the key was used by another account — generate a fresh one |
478
531
  | Idempotency-Key payload mismatch (422) | Tells the agent the same key was reused with different params |
479
532
  | Method not allowed (405) | Reports the wrong HTTP method for that route |
@@ -481,8 +534,8 @@ The MCP server handles errors gracefully and gives the agent actionable guidance
481
534
  | Rate limited (429) | Over the 600 req/min per-key window — unbilled; back off and retry |
482
535
  | Concurrency limit (429) | Asks the caller to back off (50 concurrent/key max) |
483
536
  | Key budget exceeded (402) | This key's own spend cap is spent while the account still has credits — raise the cap, don't top up |
484
- | Upstream error (502) | Reports the failure; credits refunded automatically |
485
- | Platform unavailable (503) | Circuit breaker open; credits refunded; retry in 30s |
537
+ | Upstream error (502) | The server's account of which platform failed, the refund, and when to retry |
538
+ | Platform unavailable (503) | The server's cause (circuit breaker open or upstream throttling) and retry hint; credits refunded |
486
539
 
487
540
  ## Links
488
541
 
package/dist/app.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import express from "express";
2
+ import { type OAuthResourceServerConfig } from "./oauth/config.js";
2
3
  export interface AppConfig {
3
4
  /** SocialCrawl API origin the tools call, no trailing slash. */
4
5
  baseUrl: string;
@@ -25,5 +26,11 @@ export interface AppConfig {
25
26
  * (e.g. 1 for one load balancer) only where that is actually true.
26
27
  */
27
28
  trustProxy?: number | boolean;
29
+ /**
30
+ * OAuth 2.1 resource-server mode (preview). Omitted → read from env
31
+ * (`SOCIALCRAWL_OAUTH=1` + settings, see oauth/config.ts); `null` → off.
32
+ * Off is the default and leaves every existing behaviour unchanged.
33
+ */
34
+ oauth?: OAuthResourceServerConfig | null;
28
35
  }
29
36
  export declare function buildApp(config: AppConfig): express.Express;
package/dist/app.js CHANGED
@@ -5,7 +5,10 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
5
5
  import { extractApiKey } from "./auth.js";
6
6
  import { createServer } from "./server.js";
7
7
  import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
8
+ import { oauthConfigFromEnv } from "./oauth/config.js";
9
+ import { mountProtectedResourceMetadata, oauthGate, RESOLVED_API_KEY } from "./oauth/resource-server.js";
8
10
  export function buildApp(config) {
11
+ const oauth = config.oauth === undefined ? oauthConfigFromEnv(process.env) : (config.oauth ?? undefined);
9
12
  const app = express();
10
13
  app.set("trust proxy", config.trustProxy ?? false);
11
14
  app.use(express.json({ limit: "1mb" }));
@@ -43,6 +46,9 @@ export function buildApp(config) {
43
46
  });
44
47
  next();
45
48
  });
49
+ if (oauth) {
50
+ mountProtectedResourceMetadata(app, oauth);
51
+ }
46
52
  // The xForwardedForHeader validation would 500 any request carrying an
47
53
  // X-Forwarded-For header while `trust proxy` is off. We ignore that header
48
54
  // deliberately in that case (req.ip = socket address), so silence it.
@@ -72,9 +78,13 @@ export function buildApp(config) {
72
78
  // ApiContext documents baseUrl as "no trailing slash" — enforce it here so a
73
79
  // misconfigured env value doesn't produce `//v1/...` upstream URLs.
74
80
  const baseUrl = config.baseUrl.replace(/\/+$/, "");
75
- app.post("/mcp", async (req, res) => {
81
+ // With OAuth on, the gate answers 401/403 or resolves the token's API key
82
+ // into res.locals; without it, the key comes straight from the headers.
83
+ const mcpGate = oauth ? [oauthGate(oauth)] : [];
84
+ app.post("/mcp", ...mcpGate, async (req, res) => {
76
85
  // Stateless: fresh server + transport per request, key bound via closure.
77
- const ctx = { apiKey: extractApiKey(req.headers), baseUrl };
86
+ const resolvedKey = res.locals[RESOLVED_API_KEY];
87
+ const ctx = { apiKey: resolvedKey ?? extractApiKey(req.headers), baseUrl };
78
88
  const server = createServer(ctx);
79
89
  const transport = new StreamableHTTPServerTransport({
80
90
  sessionIdGenerator: undefined,
package/dist/auth.d.ts CHANGED
@@ -6,3 +6,11 @@ import type { IncomingHttpHeaders } from "node:http";
6
6
  * no credentials must get an anonymous context, not the operator's key.
7
7
  */
8
8
  export declare function extractApiKey(headers: IncomingHttpHeaders): string;
9
+ /**
10
+ * True for a compact JWS (`header.payload.signature`, base64url segments).
11
+ * With OAuth on, this is how a Bearer access token is told apart from a
12
+ * SocialCrawl API key sent as Bearer (API keys never contain dots).
13
+ */
14
+ export declare function isJwtShaped(value: string): boolean;
15
+ /** The trimmed `Authorization: Bearer` value, or "" when absent/empty/another scheme. */
16
+ export declare function extractBearerToken(headers: IncomingHttpHeaders): string;
package/dist/auth.js CHANGED
@@ -5,14 +5,11 @@
5
5
  * no credentials must get an anonymous context, not the operator's key.
6
6
  */
7
7
  export function extractApiKey(headers) {
8
- const auth = headers.authorization;
9
- if (typeof auth === "string" && auth.toLowerCase().startsWith("bearer ")) {
10
- const token = auth.slice(7).trim();
11
- // A whitespace-only bearer value falls through to x-api-key instead of
12
- // silently downgrading a caller who sent both headers to anonymous.
13
- if (token !== "") {
14
- return token;
15
- }
8
+ const token = extractBearerToken(headers);
9
+ // A whitespace-only bearer value falls through to x-api-key instead of
10
+ // silently downgrading a caller who sent both headers to anonymous.
11
+ if (token !== "") {
12
+ return token;
16
13
  }
17
14
  const xKey = headers["x-api-key"];
18
15
  if (typeof xKey === "string") {
@@ -20,4 +17,20 @@ export function extractApiKey(headers) {
20
17
  }
21
18
  return "";
22
19
  }
20
+ /**
21
+ * True for a compact JWS (`header.payload.signature`, base64url segments).
22
+ * With OAuth on, this is how a Bearer access token is told apart from a
23
+ * SocialCrawl API key sent as Bearer (API keys never contain dots).
24
+ */
25
+ export function isJwtShaped(value) {
26
+ return /^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/.test(value);
27
+ }
28
+ /** The trimmed `Authorization: Bearer` value, or "" when absent/empty/another scheme. */
29
+ export function extractBearerToken(headers) {
30
+ const auth = headers.authorization;
31
+ if (typeof auth === "string" && auth.toLowerCase().startsWith("bearer ")) {
32
+ return auth.slice(7).trim();
33
+ }
34
+ return "";
35
+ }
23
36
  //# sourceMappingURL=auth.js.map
package/dist/client.d.ts CHANGED
@@ -1,6 +1,29 @@
1
1
  import type { ApiContext } from "./context.js";
2
+ /** One streamed chunk landed: `progress` counts chunks so far (the total is unknown). */
3
+ export interface ProgressTick {
4
+ progress: number;
5
+ message?: string;
6
+ }
7
+ /** Response facts the caller may want beyond the body text. */
8
+ export interface ResponseMeta {
9
+ /** Seconds from a `Retry-After` header, when the server sent one. */
10
+ retryAfterS?: number;
11
+ }
12
+ /** Options shared by `makeRequest` and `apiRequest` for slow calls. */
13
+ interface LongCallOptions {
14
+ /** Client timeout for this call; defaults to the fixed 30 s. */
15
+ timeoutMs?: number;
16
+ /** Send `Accept: text/event-stream`. A stream is assembled whether or not this is set. */
17
+ stream?: boolean;
18
+ /** Called once per streamed chunk. */
19
+ onProgress?: (tick: ProgressTick) => void;
20
+ /** Filled in with response facts (Retry-After). */
21
+ meta?: ResponseMeta;
22
+ }
23
+ /** `Retry-After` as whole seconds (delta-seconds or an HTTP date), capped at an hour. */
24
+ export declare function parseRetryAfter(value: string | null | undefined, now?: number): number | undefined;
2
25
  export declare const NO_API_KEY_ERROR: string;
3
- interface RequestOptions {
26
+ interface RequestOptions extends LongCallOptions {
4
27
  platform: string;
5
28
  resource: string;
6
29
  params?: Record<string, string>;
@@ -11,9 +34,15 @@ interface RequestOptions {
11
34
  * (with a `X-Idempotent-Replay: true` header), and deduct 0 new credits.
12
35
  */
13
36
  idempotencyKey?: string;
37
+ /**
38
+ * Return the body whole. The caller shapes it at row boundaries itself
39
+ * (`socialcrawl_request`); the default cut is a plain character slice and
40
+ * can land mid-JSON.
41
+ */
42
+ raw?: boolean;
14
43
  }
15
44
  export declare function makeRequest(ctx: ApiContext, options: RequestOptions): Promise<string>;
16
- interface ApiRequestOptions {
45
+ interface ApiRequestOptions extends LongCallOptions {
17
46
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
18
47
  /** Path under the base URL, starting with a slash (e.g. "/v1/monitors"). */
19
48
  path: string;
@@ -27,6 +56,8 @@ interface ApiRequestOptions {
27
56
  * "monitors" for backward compatibility with the monitors caller.
28
57
  */
29
58
  errorPlatform?: string;
59
+ /** Return the body whole (see `RequestOptions.raw`). */
60
+ raw?: boolean;
30
61
  /**
31
62
  * Set for the handful of `/v1` routes that carry `security: []` — currently
32
63
  * only `GET /v1/status`. Those answer without a key, and discovery must not
@@ -42,4 +73,13 @@ interface ApiRequestOptions {
42
73
  * same x-api-key auth, timeout, error mapping, and truncation.
43
74
  */
44
75
  export declare function apiRequest(ctx: ApiContext, options: ApiRequestOptions): Promise<string>;
76
+ /**
77
+ * Maps a non-2xx response to the text the agent sees. The server's own
78
+ * `error.message` is always passed through (a fixed lead-in only names the
79
+ * category), and `details.reason` plus the `request_id` (from the body, else the
80
+ * `X-Request-Id` header) are appended on their own lines: the request id is what
81
+ * support needs to find the call, and dropping it left customers with nothing
82
+ * to quote. The "Error:" prefix is what the tools key on to treat it as a failure.
83
+ */
84
+ export declare function formatHttpError(status: number, body: string, options: RequestOptions, headerRequestId?: string | null, retryAfterS?: number): string;
45
85
  export {};