socialcrawl-mcp 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -20
- package/dist/app.d.ts +3 -3
- package/dist/app.js +5 -1
- package/dist/client-tag.d.ts +13 -0
- package/dist/client-tag.js +17 -0
- package/dist/client.js +6 -4
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/context.d.ts +6 -0
- package/dist/context.js +1 -0
- package/dist/data/docs-async.d.ts +2 -2
- package/dist/data/docs-async.js +137 -116
- package/dist/data/docs-handwritten.js +46 -5
- package/dist/data/docs.js +2 -0
- package/dist/data/endpoints.js +13111 -10305
- package/dist/data/examples.js +2 -2
- package/dist/data/guide.d.ts +2 -2
- package/dist/data/guide.js +2 -2
- package/dist/data/outputs.js +324 -219
- package/dist/data/platforms.js +207 -48
- package/dist/data/recipes.js +1 -1
- package/dist/data/registry-meta.d.ts +8 -8
- package/dist/data/registry-meta.js +8 -8
- package/dist/hydration.js +21 -3
- package/dist/oauth/config.d.ts +19 -4
- package/dist/oauth/config.js +31 -6
- package/dist/schemas/async.d.ts +37 -27
- package/dist/schemas/async.js +28 -9
- package/dist/schemas/outputs.d.ts +2 -2
- package/dist/schemas/tools.d.ts +18 -6
- package/dist/schemas/tools.js +24 -4
- package/dist/server.js +6 -5
- package/dist/tools/account.d.ts +4 -1
- package/dist/tools/account.js +1 -1
- package/dist/tools/async-common.js +3 -1
- package/dist/tools/check-balance.d.ts +4 -2
- package/dist/tools/check-balance.js +9 -0
- package/dist/tools/discover-runs.js +117 -11
- package/dist/tools/estimate.js +10 -1
- package/dist/tools/manage.js +2 -0
- package/dist/tools/monitors.d.ts +7 -1
- package/dist/tools/monitors.js +26 -2
- package/package.json +75 -75
package/README.md
CHANGED
|
@@ -48,10 +48,12 @@ claude mcp add --scope user --transport http socialcrawl https://mcp.socialcrawl
|
|
|
48
48
|
|
|
49
49
|
**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.
|
|
50
50
|
|
|
51
|
-
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.
|
|
51
|
+
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. The server has an OAuth 2.1 resource-server mode that turns on whenever `SOCIALCRAWL_OAUTH_KEY_LOOKUP_SECRET` is set (see `docs/REMOTE-STREAMABLE-HTTP.md`); until it is enabled on the hosted server, use the header-based setup above. The key header keeps working after OAuth is enabled.
|
|
52
52
|
|
|
53
53
|
Prefer running it locally? Every stdio option below works exactly as before.
|
|
54
54
|
|
|
55
|
+
To label this server's spend, set `SOCIALCRAWL_CLIENT_TAG` (stdio) or send an `x-client-tag` header (remote): 1-64 letters, digits, `.`, `_`, `:` or `-`. It is stored on every charge, so `socialcrawl_account` `view: "usage"` with `group_by: "tag"` shows spend per tag.
|
|
56
|
+
|
|
55
57
|
### npm
|
|
56
58
|
|
|
57
59
|
```bash
|
|
@@ -153,7 +155,7 @@ Restart your AI client after saving the configuration.
|
|
|
153
155
|
|
|
154
156
|
`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 over social, commerce, jobs, finance, research and web data. `socialcrawl_find` with no task lists every platform; `socialcrawl_account` view `freshness` shows the live counts.
|
|
155
157
|
|
|
156
|
-
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 many 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 the major social platforms, news, Quora and Naver in one call. New in 2.2.0: Weibo, Goodreads, Airbnb, Booking.com, Bing and DuckDuckGo.
|
|
158
|
+
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 many 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 the major social platforms, news, Quora and Naver in one call. New in 2.2.0: Weibo, Goodreads, Airbnb, Booking.com, Bing and DuckDuckGo. New in 2.3.0: 20 more platforms — Zillow, Redfin, Realtor.com, Apartments.com, Homes.com, Apple Maps, Yahoo, Yandex, Baidu, Wikipedia, Stack Overflow, npm, PyPI, Steam, SoundCloud, IKEA, Kroger, Sprouts, Best Buy and idealo — plus Google Maps reviews and review history, company job boards, bulk review history, and every price change since 2.2.0.
|
|
157
159
|
|
|
158
160
|
New in v2.0.0: **seven tools instead of eleven** (`socialcrawl_find`, `socialcrawl_endpoint`, `socialcrawl_estimate`, `socialcrawl_request`, `socialcrawl_collect`, `socialcrawl_account`, `socialcrawl_manage`). See [Available Tools](#available-tools) for the 1.x → 2.0 mapping and [CHANGELOG.md](CHANGELOG.md) for every release.
|
|
159
161
|
|
|
@@ -427,35 +429,35 @@ Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make t
|
|
|
427
429
|
| Platform | Data Available |
|
|
428
430
|
|----------|----------------|
|
|
429
431
|
| **LinkedIn** | 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 |
|
|
430
|
-
| **Prism** | 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 |
|
|
432
|
+
| **Prism** | Cross-platform composites — URL lookup, comment harvesting, batch post-stats/profile/comment lookup, async background jobs of up to 5,000 items (or 1,000 calls of any GET endpoint), bulk review history for up to 20,000 Yelp/Tripadvisor/App Store/Google Play items (`reviews/bulk`), 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 |
|
|
431
433
|
| **Instagram** | 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 |
|
|
432
434
|
| **TikTok** | 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 |
|
|
433
|
-
| **Facebook** | 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 |
|
|
434
|
-
| **YouTube** | Channels, videos, shorts, comments & replies, sponsors, playlists & items, community posts, search (advanced
|
|
435
|
+
| **Facebook** | Pages, groups & group posts, a group's upcoming events (with details), posts, comments & replies (with sticker/GIF/image media), 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 |
|
|
436
|
+
| **YouTube** | Channels, videos, shorts, comments & replies, sponsors, playlists & items, community posts, search (advanced with `features`, autocomplete), search inside one channel, channel podcasts, trending, live streams, `sort=oldest` on videos and shorts, channel contact email lookup, media files (audio/video/subtitles/thumbnails), transcripts, batch videos/channels/transcripts, profile-360 |
|
|
435
437
|
| **Web Scraping** | 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`) |
|
|
436
438
|
| **US Congress Trades** | 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) |
|
|
437
439
|
| **Klarna** | 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 |
|
|
438
|
-
| **Tripadvisor** | Hotels, restaurants
|
|
440
|
+
| **Tripadvisor** | Hotels, restaurants and attractions — search and full detail for each — plus cruise details and reviews; traveler reviews up to 500 deep with visit month, traveller type, sub-ratings and owner replies; place lookup by URL, destination autocomplete, experience types |
|
|
439
441
|
| **Twitter/X** | Profiles, tweets and replies, tweet & user search, user media, followers, following, retweeters, communities, video transcripts, AI search via Grok, profile-360 |
|
|
440
442
|
| **Naver** | Korea's #1 portal — blog, news, encyclopedia, cafe, KiN, local, image, web search, errata & adult classifiers, Data Lab search-trend & shopping-insight series, brief |
|
|
441
443
|
| **Reddit** | Subreddits, post detail, comments, user profiles with post and comment history, keyword/comment/media search, subreddit discovery, transcripts, omni-search VoC sweep |
|
|
442
|
-
| **GitHub** | Users, repos, issues, PRs, READMEs, releases, search, repo dossier, user profile-velocity |
|
|
444
|
+
| **GitHub** | Users, repos (stars, forks, open issues, language), repository search with qualifiers, issues and PRs (state, merged, labels, full body), READMEs, releases, search, repo dossier, user profile-velocity |
|
|
443
445
|
| **Gumtree** | UK classifieds — listing search and details, similar listings, seller profiles and their ads, search suggestions, trending searches, category tree with filters, location lookup |
|
|
444
|
-
| **Jobs** | Job search and listing detail across LinkedIn, Indeed, Bing and Xing, LinkedIn organization-id resolution
|
|
446
|
+
| **Jobs** | Job search and listing detail across LinkedIn, Indeed (with job type, workplace, salary and recency filters), Google Jobs, Bing and Xing; a company's open roles on Greenhouse, Lever, Ashby or Workday; Levels.fyi jobs with pay; LinkedIn organization-id resolution; salary ranges by title and country |
|
|
445
447
|
| **Sephora** | Product details, reviews, keyword search + suggestions, category tree browsing, brand listings and per-brand products, store lookup, per-SKU in-store availability |
|
|
446
448
|
| **Content Analysis** | Cross-web brand mentions, sentiment, rating distributions, phrase/category trends |
|
|
447
|
-
| **Google** | Web search,
|
|
449
|
+
| **Google** | Web search, Images, Patents, AI Overview, autocomplete, Maps business search (rating and opening-hours filters), Business Profile (info, Maps reviews up to 1,000 deep with sort/since/phrase/topic filters, an async review history up to 10,000 reviews, extended reviews, contributor reviews, popular times, photos, menu, updates, Q&A), Ads Transparency, keyword volume, Travel hotels |
|
|
448
450
|
| **AliExpress** | Product details, keyword search, similar products, reviews, per-SKU shipping, hot products, featured promotions, category tree |
|
|
449
451
|
| **Apple App Store** | App search, search suggestions, app details, reviews, charts, listings database, reference data |
|
|
450
|
-
| **Google Play** | App search, search suggestions, app details, reviews, charts, listings database, reference data |
|
|
451
|
-
| **Amazon** | Product search, ASIN details, reviews, sellers, shop pages, Best Sellers charts, current deals, seller profiles — ~13 marketplaces |
|
|
452
|
+
| **Google Play** | App search, books and audiobooks search, films and shows search, search suggestions, app details, reviews with developer replies, charts, listings database, reference data |
|
|
453
|
+
| **Amazon** | Product search and suggestions, ASIN details, reviews, sellers, shop pages, Best Sellers charts, current deals, seller profiles — ~13 marketplaces |
|
|
452
454
|
| **Douyin** | China's TikTok — video search, creator profiles and feeds, video detail, comments and comment replies, creator search, hot-search board (mostly metered per row) |
|
|
453
455
|
| **Finance** | Instrument quotes, ticker search, markets overview, instrument news, daily price history, company financial statements, options chains |
|
|
454
|
-
| **G2** | Software marketplace — product pages, reviews, category listings and the category index, vendor profiles and their catalogue, product URL index |
|
|
456
|
+
| **G2** | Software marketplace — product pages, reviews (`depth` 1-100, did-you-mean on an unknown slug), category listings and the category index, vendor profiles and their catalogue, a searchable product URL index |
|
|
455
457
|
| **Quora** | Question search and detail, answer search, Space post search, profile search, Space/topic search |
|
|
456
458
|
| **H&M** | Keyword search + suggestions, store listings by country, countries/languages, category tree, per-product supplier and factory disclosure |
|
|
457
|
-
| **Pinterest** |
|
|
458
|
-
| **Spotify** | Artists, tracks, albums, podcasts, episodes, search |
|
|
459
|
+
| **Pinterest** | Profiles, pins, boards, user boards, search, Pinterest Trends by country, URL save-counts |
|
|
460
|
+
| **Spotify** | Artists, tracks, albums, playlists with tracks, podcasts, episodes, search |
|
|
459
461
|
| **Threads** | Profiles, posts, post comments, keyword search, user search |
|
|
460
462
|
| **Utility** | 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` |
|
|
461
463
|
| **Xiaohongshu** | RED / Little Red Book — note search, hot-search board, creator profiles and their notes, note detail, top-level comments (5cr per returned row) |
|
|
@@ -467,16 +469,16 @@ Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make t
|
|
|
467
469
|
| **TikTok Shop** | Products, reviews, listings, search, creator showcases |
|
|
468
470
|
| **Universal Search** | One query fanned out across many platforms (20cr flat) — with date windows, platform include/exclude, languages, country and `depth=quick`; lists of up to 100 searches as one background run and scheduled watches that deliver only new rows (`POST`, managed with `socialcrawl_manage` area `search_runs`); `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 |
|
|
469
471
|
| **Walmart** | Product details, reviews, keyword search, category browsing, seller offers |
|
|
470
|
-
| **Yelp** | Business profiles by
|
|
471
|
-
| **Bluesky** | Profiles, user posts, post details, keyword post search |
|
|
472
|
+
| **Yelp** | Business profiles by id, name slug or any `/biz/` link (phone, website, amenities, neighborhoods), reviews at 1 credit a page (`limit`, `sort`, rating/language/text filters, hidden not-recommended reviews), an async review history, business search (compact and full-card, `bbox` tiling past 240 results) |
|
|
473
|
+
| **Bluesky** | Profiles, user posts (filter + cursor), followers, post details, keyword post search |
|
|
472
474
|
| **Etsy** | Listings by id or URL, a shop's catalogue, similar listings, search suggestions |
|
|
473
|
-
| **Hacker News** | Story search,
|
|
475
|
+
| **Hacker News** | Story search, front-page feeds (top, new, best, Ask, Show, job), story and comment tree by id or URL, profile |
|
|
474
476
|
| **Home Depot** | Keyword search, product details by item id or URL (store/zip-aware pricing), reviews, store lookup by ZIP |
|
|
475
477
|
| **Tavily** | Web search (with LLM answer), URL extraction, sitemap, full crawl |
|
|
476
478
|
| **Twitch** | Profiles, clips, videos, schedules |
|
|
477
479
|
| **Google Trends** | Interest-over-time (explore), rising/breakout related queries, and Trending Now by location |
|
|
478
480
|
| **Kwai** | Profiles, posts |
|
|
479
|
-
| **Telegram** | Public channel profiles, channel post feeds, single post lookup |
|
|
481
|
+
| **Telegram** | Public channel profiles, channel post feeds, single post lookup, post comments (newest 100, then 50 a page), channel discovery |
|
|
480
482
|
| **Truth Social** | Profiles, posts |
|
|
481
483
|
| **Wayfair** | Product search, product details by SKU, reviews |
|
|
482
484
|
| **eBay** | Listing search incl. sold/completed with realised prices, listing details |
|
|
@@ -496,9 +498,29 @@ Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make t
|
|
|
496
498
|
| **Weibo** | Accounts, an account's posts, posts, comments and replies, post search back through time, account search, hot-search list |
|
|
497
499
|
| **Goodreads** | Books by id/URL/ISBN, reader reviews (free labels), editions, review comments, search, authors and their books, quotes, series, Listopia lists |
|
|
498
500
|
| **Airbnb** | Listing search for a place and stay, listing cards, guest reviews (free labels), availability calendars |
|
|
499
|
-
| **Booking.com** | Property search for a destination and stay, property cards, guest reviews (free labels) |
|
|
500
|
-
| **Bing** | Web results, domain rank up to 200 deep, videos, search suggestions |
|
|
501
|
+
| **Booking.com** | Property search for a destination and stay, property cards, rooms and rates for a stay, guest reviews (free labels) |
|
|
502
|
+
| **Bing** | Web results, domain rank up to 200 deep, images, videos, Shopping search and product offers, search suggestions |
|
|
501
503
|
| **DuckDuckGo** | Web results, domain rank up to 200 deep, news, videos, images, instant answers, suggestions |
|
|
504
|
+
| **Zillow** | Listing search, a home with price and tax history (agent, parcel, open houses, schools, floor plans), region and address lookup |
|
|
505
|
+
| **Redfin** | Listing search to your `limit` with photos, a home with price and tax history (opt-in `include=details`) |
|
|
506
|
+
| **Realtor.com** | Homes for sale or rent from any search link, a home's full card |
|
|
507
|
+
| **Apartments.com** | Rental search, a building with its units |
|
|
508
|
+
| **Homes.com** | A home's full card by link |
|
|
509
|
+
| **Apple Maps** | Place search in a map box or around a point, up to 50 places by id |
|
|
510
|
+
| **Yahoo** | Web results |
|
|
511
|
+
| **Yandex** | Web results and Images |
|
|
512
|
+
| **Baidu** | Web results up to the 750th |
|
|
513
|
+
| **Wikipedia** | Article search, an article as plain text |
|
|
514
|
+
| **Stack Overflow** | Question search, a question, its answers and comments |
|
|
515
|
+
| **npm** | Package search, a package version |
|
|
516
|
+
| **PyPI** | A project release |
|
|
517
|
+
| **Steam** | Store search, an app by id |
|
|
518
|
+
| **SoundCloud** | A track by link |
|
|
519
|
+
| **IKEA** | Product search |
|
|
520
|
+
| **Kroger** | Product search |
|
|
521
|
+
| **Sprouts** | Product search, a product by link |
|
|
522
|
+
| **Best Buy** | A product by link |
|
|
523
|
+
| **idealo** | Italy price comparison — product search, a product with every shop offer |
|
|
502
524
|
|
|
503
525
|
`socialcrawl_find` with no task lists every platform with its live endpoint count.
|
|
504
526
|
|
package/dist/app.d.ts
CHANGED
|
@@ -27,9 +27,9 @@ export interface AppConfig {
|
|
|
27
27
|
*/
|
|
28
28
|
trustProxy?: number | boolean;
|
|
29
29
|
/**
|
|
30
|
-
* OAuth 2.1 resource-server mode
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* OAuth 2.1 resource-server mode. Omitted → read from env (on when
|
|
31
|
+
* SOCIALCRAWL_OAUTH_KEY_LOOKUP_SECRET is set, see oauth/config.ts);
|
|
32
|
+
* `null` → off. The key header keeps working when it is on.
|
|
33
33
|
*/
|
|
34
34
|
oauth?: OAuthResourceServerConfig | null;
|
|
35
35
|
}
|
package/dist/app.js
CHANGED
|
@@ -84,7 +84,11 @@ export function buildApp(config) {
|
|
|
84
84
|
app.post("/mcp", ...mcpGate, async (req, res) => {
|
|
85
85
|
// Stateless: fresh server + transport per request, key bound via closure.
|
|
86
86
|
const resolvedKey = res.locals[RESOLVED_API_KEY];
|
|
87
|
-
|
|
87
|
+
// The caller's own x-client-tag labels its charges (API-210); client.ts
|
|
88
|
+
// drops one that breaks the API's rule. Never read from process env here.
|
|
89
|
+
const tagHeader = req.headers["x-client-tag"];
|
|
90
|
+
const clientTag = typeof tagHeader === "string" ? tagHeader : undefined;
|
|
91
|
+
const ctx = { apiKey: resolvedKey ?? extractApiKey(req.headers), baseUrl, ...(clientTag ? { clientTag } : {}) };
|
|
88
92
|
const server = createServer(ctx);
|
|
89
93
|
const transport = new StreamableHTTPServerTransport({
|
|
90
94
|
sessionIdGenerator: undefined,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `x-client-tag` (UPGRADE-LOG API-210): an optional label stored on every
|
|
3
|
+
* charge a request writes, so spend can be read per tag
|
|
4
|
+
* (`GET /v1/credits/usage?group_by=tag`, `GET /v1/credits/transactions?tag=`).
|
|
5
|
+
*
|
|
6
|
+
* The rule is the API's own (social-api `credits/client-tag.ts`): trimmed,
|
|
7
|
+
* 1-64 characters of letters, digits, `.`, `_`, `:` or `-`. The API ignores a
|
|
8
|
+
* tag that breaks it (answering `X-Client-Tag-Ignored: invalid`); this server
|
|
9
|
+
* does not send one at all, so a typo in config never reaches the wire.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CLIENT_TAG_RE: RegExp;
|
|
12
|
+
/** The tag to send, or undefined for a blank or invalid one. */
|
|
13
|
+
export declare function clientTagOf(raw: string | undefined | null): string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `x-client-tag` (UPGRADE-LOG API-210): an optional label stored on every
|
|
3
|
+
* charge a request writes, so spend can be read per tag
|
|
4
|
+
* (`GET /v1/credits/usage?group_by=tag`, `GET /v1/credits/transactions?tag=`).
|
|
5
|
+
*
|
|
6
|
+
* The rule is the API's own (social-api `credits/client-tag.ts`): trimmed,
|
|
7
|
+
* 1-64 characters of letters, digits, `.`, `_`, `:` or `-`. The API ignores a
|
|
8
|
+
* tag that breaks it (answering `X-Client-Tag-Ignored: invalid`); this server
|
|
9
|
+
* does not send one at all, so a typo in config never reaches the wire.
|
|
10
|
+
*/
|
|
11
|
+
export const CLIENT_TAG_RE = /^[A-Za-z0-9._:-]{1,64}$/;
|
|
12
|
+
/** The tag to send, or undefined for a blank or invalid one. */
|
|
13
|
+
export function clientTagOf(raw) {
|
|
14
|
+
const tag = raw?.trim();
|
|
15
|
+
return tag && CLIENT_TAG_RE.test(tag) ? tag : undefined;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=client-tag.js.map
|
package/dist/client.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { TIMEOUT_MS, CHARACTER_LIMIT, SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
2
|
+
import { clientTagOf } from "./client-tag.js";
|
|
2
3
|
import { assembleSse, describeChunk, readSse } from "./sse.js";
|
|
3
4
|
/**
|
|
4
5
|
* Sent on every call so the API can tell MCP traffic from other clients in its
|
|
5
6
|
* usage analytics (it is otherwise counted as plain `node`).
|
|
6
7
|
*/
|
|
7
|
-
function clientHeaders() {
|
|
8
|
-
|
|
8
|
+
function clientHeaders(ctx) {
|
|
9
|
+
const tag = clientTagOf(ctx.clientTag);
|
|
10
|
+
return { "User-Agent": `${SERVER_NAME}/${SERVER_VERSION}`, ...(tag ? { "x-client-tag": tag } : {}) };
|
|
9
11
|
}
|
|
10
12
|
/** `Retry-After` as whole seconds (delta-seconds or an HTTP date), capped at an hour. */
|
|
11
13
|
export function parseRetryAfter(value, now = Date.now()) {
|
|
@@ -76,7 +78,7 @@ export async function makeRequest(ctx, options) {
|
|
|
76
78
|
const controller = new AbortController();
|
|
77
79
|
const timeoutId = setTimeout(() => controller.abort(), options.timeoutMs ?? TIMEOUT_MS);
|
|
78
80
|
const state = { events: [] };
|
|
79
|
-
const headers = { ...clientHeaders(), "x-api-key": ctx.apiKey };
|
|
81
|
+
const headers = { ...clientHeaders(ctx), "x-api-key": ctx.apiKey };
|
|
80
82
|
if (options.stream)
|
|
81
83
|
headers.Accept = "text/event-stream";
|
|
82
84
|
if (options.idempotencyKey) {
|
|
@@ -136,7 +138,7 @@ export async function apiRequest(ctx, options) {
|
|
|
136
138
|
const controller = new AbortController();
|
|
137
139
|
const timeoutId = setTimeout(() => controller.abort(), options.timeoutMs ?? TIMEOUT_MS);
|
|
138
140
|
const state = { events: [] };
|
|
139
|
-
const headers = clientHeaders();
|
|
141
|
+
const headers = clientHeaders(ctx);
|
|
140
142
|
if (ctx.apiKey)
|
|
141
143
|
headers["x-api-key"] = ctx.apiKey;
|
|
142
144
|
if (options.stream)
|
package/dist/constants.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const TIMEOUT_MS = 60000;
|
|
|
9
9
|
export declare const INLINE_MAX_ROWS = 200;
|
|
10
10
|
export declare const INLINE_MAX_BYTES = 60000;
|
|
11
11
|
export declare const SERVER_NAME = "socialcrawl-mcp";
|
|
12
|
-
export declare const SERVER_VERSION = "2.
|
|
12
|
+
export declare const SERVER_VERSION = "2.3.0";
|
|
13
13
|
/**
|
|
14
14
|
* Inside a normalised `socialcrawl_request` params object: the names of the
|
|
15
15
|
* endpoint params that arrived as top-level arguments and were moved into
|
package/dist/constants.js
CHANGED
|
@@ -13,7 +13,7 @@ export const INLINE_MAX_BYTES = 60_000;
|
|
|
13
13
|
// (CREDIT_LADDER) alongside the cache TTLs, so a ladder change cannot leave a
|
|
14
14
|
// stale copy behind. Import it from there.
|
|
15
15
|
export const SERVER_NAME = "socialcrawl-mcp";
|
|
16
|
-
export const SERVER_VERSION = "2.
|
|
16
|
+
export const SERVER_VERSION = "2.3.0";
|
|
17
17
|
/**
|
|
18
18
|
* Inside a normalised `socialcrawl_request` params object: the names of the
|
|
19
19
|
* endpoint params that arrived as top-level arguments and were moved into
|
package/dist/context.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export interface ApiContext {
|
|
|
10
10
|
* the `confirm: true` round trip.
|
|
11
11
|
*/
|
|
12
12
|
confirm?: (message: string) => Promise<"accepted" | "declined" | "unsupported">;
|
|
13
|
+
/**
|
|
14
|
+
* Sent as `x-client-tag` on every API call, so this server's charges can be
|
|
15
|
+
* read per tag. stdio: `SOCIALCRAWL_CLIENT_TAG`; HTTP: the caller's own
|
|
16
|
+
* `x-client-tag` header. Invalid values are never sent (client-tag.ts).
|
|
17
|
+
*/
|
|
18
|
+
clientTag?: string;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* Build the context for the stdio entrypoint from process env.
|
package/dist/context.js
CHANGED
|
@@ -10,6 +10,7 @@ export function contextFromEnv() {
|
|
|
10
10
|
apiKey: process.env.SOCIALCRAWL_API_KEY ?? "",
|
|
11
11
|
// Normalize away trailing slashes so URL building never yields `//v1/...`.
|
|
12
12
|
baseUrl: (process.env.SOCIALCRAWL_BASE_URL ?? DEFAULT_BASE_URL).replace(/\/+$/, ""),
|
|
13
|
+
...(process.env.SOCIALCRAWL_CLIENT_TAG ? { clientTag: process.env.SOCIALCRAWL_CLIENT_TAG } : {}),
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=context.js.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* {routes,resume,more,schedule-routes}.ts, platforms/review-history/
|
|
7
7
|
* {http,engine}.ts, events/{feed,routes}.ts, webhooks/{http,limits}.ts.
|
|
8
8
|
*/
|
|
9
|
-
export declare const DISCOVER_RUNS_DOC = "# SocialCrawl API \u2014 Discover runs, schedules and review history\n\nWork that keeps running after the call that started it. Start it with `socialcrawl_request`; read, export, steer and stop it with `socialcrawl_manage` (areas `discover` and `review_history`). Every read here is free; only the searches a run goes on to make are billed.\n\n## Discover runs (`/v1/prism/discover/runs`)\n\nStart a run with `socialcrawl_request` on `prism/discover` (`max_credits` is required; `async` runs it in the background). Manage it with `socialcrawl_manage` `area: \"discover\"`; `id` is the run id (`run_\u2026`, `data.run.run_id`).\n\n| Action | Route | Cost |\n|--------|-------|------|\n| `run_list` | `GET /runs` (status, kind, created_after, cursor, page_size \u2264100; `id` = a schedule id lists that schedule's runs) | 0 |\n| `run_get` | `GET /runs/{run_id}` | 0 |\n| `run_export` | `GET /runs/{run_id}/results.jsonl` | 0 |\n| `run_legs` | `GET /runs/{run_id}/legs` (page_size \u2264500) | 0 |\n| `run_cancel` | `DELETE /runs/{run_id}` | 0 \u2014 rows kept, resume continues |\n| `run_resume` | `POST /runs/{run_id}/resume` `{ max_credits?, retry_failed? }` | 0 itself; continued searches bill as they run |\n| `run_more` | `POST /runs/{run_id}/more` `{ new_searches?, feedback?, max_credits?, pages? }` | each new search bills at its lane price |\n\n- **Long-poll:** `run_get` with `wait_s` (0-25) answers early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.\n- **Filters** (run_get and run_export): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and `tags` sent as `tag.<key>=<value>`. Any parameter the route does not take is a free 400. A cursor is signed with the filters it was issued for: send the SAME filters with it.\n- **run_export** streams every matching row; the last line is `{\"complete\":true}` or `{\"next_cursor\":\"\u2026\"}` (stopped after about 45 s; send it back with the same filters).\n- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER `max_credits`. Searches already paid for are never paid twice.\n- **run_more** works on completed runs only: `pages` 1-10, `feedback.accept`/`feedback.reject` up to 100 ids each (`accept` needs `new_searches: true`). Read only the new rows with `changes_since` = `data.more.since_version`. `data.more.nothing_more` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.\n- **No dry_run** on any run or schedule route (resume and more refuse any query parameter).\n- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).\n\n## Discover schedules (`/v1/prism/discover/schedules`)\n\nCreated by `prism/discover` with a `schedule` field. All free; each scheduled run bills like a run within `max_credits_per_run` and `max_credits_per_month`. `id` is the schedule id (`dsch_\u2026`).\n\n`schedule_list` (status active | paused | stopped, cursor, page_size \u2264100), `schedule_get` (its recent runs, this month's spend, next fire), `schedule_pause`, `schedule_resume` (`{ max_credits_per_run?, max_credits_per_month? }`, null clears the month cap), `schedule_delete` (runs keep their rows). `run_list` with the schedule id lists one schedule's runs.\n\n## Review history (`/v1/{platform}/reviews/history/{job_id}`)\n\nStart with `socialcrawl_request` on
|
|
9
|
+
export declare const DISCOVER_RUNS_DOC = "# SocialCrawl API \u2014 Discover runs, schedules and review history\n\nWork that keeps running after the call that started it. Start it with `socialcrawl_request`; read, export, steer and stop it with `socialcrawl_manage` (areas `discover` and `review_history`). Every read here is free; only the searches a run goes on to make are billed.\n\n## Discover runs (`/v1/prism/discover/runs`)\n\nStart a run with `socialcrawl_request` on `prism/discover` (`max_credits` is required; `async` runs it in the background). Manage it with `socialcrawl_manage` `area: \"discover\"`; `id` is the run id (`run_\u2026`, `data.run.run_id`). Runs created since 14/11/2026 are kept 30 days by default (was 7); `retention_days` is 1 to 30.\n\n| Action | Route | Cost |\n|--------|-------|------|\n| `run_list` | `GET /runs` (status, kind, created_after, cursor, page_size \u2264100; `id` = a schedule id lists that schedule's runs) | 0 |\n| `run_get` | `GET /runs/{run_id}` | 0 |\n| `run_export` | `GET /runs/{run_id}/results.jsonl` | 0 |\n| `run_legs` | `GET /runs/{run_id}/legs` (page_size \u2264500) | 0 |\n| `run_cancel` | `DELETE /runs/{run_id}` | 0 \u2014 rows kept, resume continues |\n| `run_resume` | `POST /runs/{run_id}/resume` `{ max_credits?, retry_failed? }` | 0 itself; continued searches bill as they run |\n| `run_more` | `POST /runs/{run_id}/more` `{ new_searches?, feedback?, max_credits?, pages? }` | each new search bills at its lane price |\n\n- **Long-poll:** `run_get` with `wait_s` (0-25) answers early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.\n- **Filters** (run_get and run_export): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and `tags` sent as `tag.<key>=<value>`. Any parameter the route does not take is a free 400. A cursor is signed with the filters it was issued for: send the SAME filters with it.\n- **run_export** streams every matching row; the last line is `{\"complete\":true}` or `{\"next_cursor\":\"\u2026\"}` (stopped after about 45 s; send it back with the same filters).\n- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER `max_credits`. Searches already paid for are never paid twice.\n- **run_more** works on completed runs only: `pages` 1-10, `feedback.accept`/`feedback.reject` up to 100 ids each (`accept` needs `new_searches: true`). Read only the new rows with `changes_since` = `data.more.since_version`. `data.more.nothing_more` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.\n- **No dry_run** on any run or schedule route (resume and more refuse any query parameter).\n- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).\n\n## Discover schedules (`/v1/prism/discover/schedules`)\n\nCreated by `prism/discover` with a `schedule` field. All free; each scheduled run bills like a run within `max_credits_per_run` and `max_credits_per_month`. `id` is the schedule id (`dsch_\u2026`).\n\n`schedule_list` (status active | paused | stopped, cursor, page_size \u2264100), `schedule_get` (its recent runs, this month's spend, next fire), `schedule_pause`, `schedule_resume` (`{ max_credits_per_run?, max_credits_per_month? }`, null clears the month cap), `schedule_delete` (runs keep their rows). `run_list` with the schedule id lists one schedule's runs.\n\n## Stored lists (`/v1/prism/discover/inputs`)\n\nMake one with `socialcrawl_request` on `POST prism/discover/inputs` (`{ kind: \"authors\", authors: [...] }` up to 10,000 handles, or `{ kind: \"exclude\", exclude: [...] }` up to 50,000 entries); the answer's `author_list_id` / `exclude_list_id` (`din_\u2026`) goes into a discover call. Then, free: `input_list` (every live list with `item_count` and `expires_at`, plus `live` of `limit` 500 per account), `input_append` (`id` + `{ exclude: [...] }`, 1 to 50,000 entries; duplicates skipped, the expiry moves to 31 days; past 50,000 in all it is a free 400 `exclude_list_full`), `input_delete`. An unknown, expired or foreign id, or an author list sent to append, is a 404 `input_not_found`. Lists live 30 days.\n\n## Review history (`/v1/{platform}/reviews/history/{job_id}`)\n\nStart a job with `socialcrawl_request` on the POST for the platform \u2014 it holds the price and answers 202 with `job_id` (`job_\u2026`):\n\n| Start (POST) | Poll with `platform` | Price |\n|---|---|---|\n| `trustpilot/reviews/history` | `trustpilot` (default) | holds `depth` + 5 |\n| `tripadvisor/reviews/history` | `tripadvisor` | holds `depth` |\n| `google/business/reviews/history` (exactly one of `place_id` or `cid`, `depth` 1-10,000) | `google` | 5 per started 100 reviews collected; none collected is refunded in full |\n| `yelp/business/reviews/history` | `yelp` | 1 per started 4 pages (held at 52 a language; `languages=all` holds 154); honours `Idempotency-Key` |\n\nPoll with `socialcrawl_manage` `area: \"review_history\"`, `action: \"get\"`, `id` = the job id, free. Trustpilot, Tripadvisor and Google: status queued \u2192 running \u2192 polling \u2192 succeeded | failed; once settled each page carries `data.items` and `data.job` (`credits_hold`, the settled `credits_charged`, `expires_at`); page with `offset` and `limit` (1-100) until a page is shorter than `limit`. Yelp: rows are readable while the job runs, each page carries `data.job` (`pages_read`, `reviews_collected`, per-language progress), `total` and `next_offset` (null on the last page). Jobs live 7 days.\n\n## Bulk review history (`POST /v1/prism/reviews/bulk`)\n\nOne background job over up to 20,000 businesses or apps: `platform` (`yelp`, `tripadvisor`, `app_store`, `google_play`), `items`, optional `since` / `until`, `languages` (not Tripadvisor or App Store), `max_reviews_per_item`, `format` (`jsonl` | `csv`), `include` (`business`, `business_full` on Yelp, `none`), `country` (App Store, Google Play), `webhook_url` (https; the 202 shows its `webhook_secret` once) and `refresh_of` (an earlier job of this key: reuses its items and starts from the day it settled). Start it with `socialcrawl_request`. It bills 1 credit per started 4 pages over the whole job, reserved 25 credits at a time; a business that cannot be read costs nothing. When the next block cannot be held the job pauses as `paused_insufficient_credits` and resumes after a top-up (webhook events `reviews_bulk.paused`, `resumed`, `completed`, signed `x-socialcrawl-signature`). `Idempotency-Key` replays the job at 0 credits.\n\nThen, free: `action: \"bulk_get\"` (progress, each item's `status` pending | walking | waiting | done | unavailable, and signed links to the combined file, the manifest and each item's file, valid 1 hour; page items with `offset`/`limit`) and `action: \"bulk_cancel\"` (keeps and bills what was read; the job can still read `running` until it settles as `cancelled`). There is no list route: keep the job id.\n\n## follow\n\nAnswers carry ready next-step URLs in `data.next.*`. `socialcrawl_manage` `area: \"discover\"`, `action: \"follow\"`, `input: { url }` GETs one only when it is on the configured SocialCrawl API AND one of the free read routes above (batch jobs, discover runs and schedules, review history, the events feed, webhook endpoints). `status_url`, `results_url`, `changes_url` and `poll_url` are free reads. `continue_url` STARTS a billable continuation and is never followed (call `socialcrawl_request` after checking `continue_estimate`); `resume_url`/`more_url` are POSTs: use `run_resume`/`run_more`.\n";
|
|
10
10
|
export declare const EVENTS_DOC = "# SocialCrawl API \u2014 Account events feed and webhook endpoints\n\nThe account event log records what happens to this key's background work: discover runs (`discover.completed`, `discover.partial`, `discover.paused`, `discover.failed`, `discover.progress`, `discover.accounts_ready`, `discover.new_rows`, `discover.new_accounts`, `discover.new_items`), schedules (`discover.run_skipped`, `discover.run_failed`) and webhook endpoint health (`endpoint.disabled`). Pull it with the feed or have it pushed to a webhook endpoint. Use `socialcrawl_manage` `area: \"events\"`. Everything here costs **0 credits**, and no route here takes `dry_run`.\n\n## Feed (`GET /v1/events`)\n\n- **Your own cursor:** `cursor` = `oldest` (start of the 30-day retention), `now` (only new events), an event id (`evt_\u2026`) or `pagination.next_cursor` exactly as returned. Save `next_cursor` after each page.\n- **Named consumer:** `id` = a consumer name (a-z, 0-9, _ and -, up to 64). The server keeps its position; `start` (now | oldest) sets where a new consumer begins; its `types`/`subject_ids` filters bind at first use. A read commits nothing: process the page, then `ack` its `pagination.next_cursor` (`POST /v1/events/consumers/{name}/ack`, same `id`, `input: { cursor }`). Until you ack, the read returns the same page.\n- Not both `cursor` and a consumer (a free 400).\n- **Filters:** `types` (up to 50 types or patterns: `discover.completed`, `discover.*`, `*`) and `subject_ids` (up to 100 run_\u2026 or dsch_\u2026 ids). `limit` 1-500 (default 100).\n- **Long-poll:** `wait_s` (0-25) holds an empty read until an event arrives. At most 5 long-polls per key; a sixth answers at once.\n- **410 CURSOR_EXPIRED:** the position is older than the 30-day retention, so events were missed. Restart from `oldest` (a consumer restarts there on its next read and says `restarted_from` once) and tell the user which window was missed.\n- `data.next.poll_url` is a free read: `area: \"discover\"` action `follow` can GET it.\n\n## Webhook endpoints (`/v1/webhook-endpoints`)\n\nAt most **20 per API key**; an endpoint answers only to the key that created it. `id` is the endpoint id (`we_\u2026`, `data.endpoint.id`).\n\n| Action | Route |\n|--------|-------|\n| `endpoint_create` | `POST /` `{ url, types?, description?, subject_ids? }` (201) |\n| `endpoint_list` | `GET /` (limit \u2264100, cursor, status) |\n| `endpoint_get` | `GET /{id}` |\n| `endpoint_update` | `PATCH /{id}` (url, types, description, subject_ids, status enabled/disabled) |\n| `endpoint_delete` | `DELETE /{id}` |\n| `endpoint_rotate_secret` | `POST /{id}/rotate-secret` |\n| `endpoint_test` | `POST /{id}/test` `{ type? }` |\n| `endpoint_attempts` | `GET /{id}/attempts` (limit \u2264100, cursor) |\n\n- **The secret is shown ONCE.** `endpoint_create` and `endpoint_rotate_secret` return a `whsec_` secret in `data.secret`; store it immediately. Both send an Idempotency-Key (generated when you omit it, and echoed): a replay never creates a second endpoint and never shows the secret again. If it is lost, rotate with a NEW key.\n- **Rotation:** for 24 hours every delivery is signed with both the old and the new secret, so deploy the new one before then.\n- **URL rules:** a public HTTPS receiver. Private hosts and chat-app incoming webhooks are refused (400 invalid_webhook_url).\n- **Types** default to `[\"*\"]`. `endpoint_test` sends one signed sample of a subscribed type; the receiver has 15 s to answer 2xx. Answering 410 to a real delivery disables the endpoint.\n- **Retries:** a failing delivery gets 8 attempts in all, backing off over roughly 41 hours; `endpoint_attempts` shows the log. Setting `status: \"enabled\"` on a disabled endpoint resumes its parked deliveries at once.\n- **Links are full URLs.** An event's `links` (`run`, `results`, `changes`) start with the API's https origin; pass any of them to action `follow` (areas `discover`, `search_runs`, `creator_runs`).\n";
|
|
11
11
|
/**
|
|
12
12
|
* Universal search runs, lists and watches (UPGRADE-LOG API-073, API-077,
|
|
@@ -15,4 +15,4 @@ export declare const EVENTS_DOC = "# SocialCrawl API \u2014 Account events feed
|
|
|
15
15
|
* meta-search/{list-http,list-start,list-actions,list-more,list-followups,
|
|
16
16
|
* list-watch,list-watch-routes,stored-runs}.ts and prism/creators/follow.ts.
|
|
17
17
|
*/
|
|
18
|
-
export declare const SEARCH_RUNS_DOC = "# SocialCrawl API \u2014 Universal search runs, lists, watches and creator runs\n\n`GET /v1/search/everywhere` answers one search in the call (20 credits, flat). Everything that keeps working after the call \u2014 a list of searches, a scheduled watch, the next page, follow-up reads \u2014 is a **run**, read and steered with `socialcrawl_manage` area `search_runs`. Every read is free.\n\n## Start one (socialcrawl_request, `POST /v1/search/everywhere`)\n\nThe JSON body takes every search field of the GET (`query` or `keywords`, `context`, `platforms`, `exclude_platforms`, `period`/`since`/`until`, `languages`, `country`, `depth`, `label`, \u2026) plus exactly one of:\n\n- **`queries`** \u2014 up to 100 search strings (\u2264512 chars each). One background run; each search is a job that reserves its own **20 credits**.\n- **`groups`** \u2014 1-100 `{id, query | keywords, context?, platforms?, exclude_platforms?, period?, since?, until?, tags?}`. A group's rows keep their own order; one de-duplication runs across the list, and a row several groups found lists them in `also_in_groups`.\n- **`schedule`** \u2014 `{every: 1h|6h|12h|1d|7d|30d, max_credits_per_run, max_credits_per_month?, name, start_at?}` turns the search (or list) into a **watch**: each fire returns only rows that watch never delivered (the first fire marks its rows `baseline: true`).\n\n**Price:** 20 credits per search plus any extras' ceilings (`comments.*`, `authors.*`). A list needs `max_credits` at or above that estimate; nothing is held at submit, each search charges as it runs, and the run **pauses** at `max_credits`, the key budget or the balance with `data.next.resume_url` \u2014 nothing is paid twice. A watch needs `max_credits_per_run` at least one fire's estimate; each fire bills like the list (no surcharge, no refund when nothing is new). `dry_run: true` answers the plan and estimate for free \u2014 on a watch, the price of a fire (`credits_per_fire`) and of 30 days (`credits_per_30_days`). The answer is **202** with `data.run` and `data.next.status_url` (a watch adds `data.watch`). `Idempotency-Key` replays the first answer; the same request sent again while its run is live returns that run (`run.deduplicated`).\n\n## Runs (area `search_runs`)\n\n| Action | Route | Cost |\n|---|---|---|\n| `run_list` | `GET /v1/search/everywhere/runs` \u2014 status, created_after, cursor, page_size 1-100; a watch id as `id` lists its fires | 0 |\n| `run_get` | `GET \u2026/runs/{run_id}` \u2014 `wait_s` 0-25 long-polls; format evidence\\|compact\\|text, fields, sort relevance\\|recent\\|engagement, max_per_platform, platform, group, state kept\\|dropped\\|all, changes_since, cursor, page_size | 0 |\n| `run_export` | `GET \u2026/runs/{run_id}/results.jsonl` \u2014 the same filters, no paging; ends with `{\"complete\":true,\"changes_url\":\u2026}` | 0 |\n| `run_legs` | `GET \u2026/runs/{run_id}/legs` \u2014 every search with its outcome and credits | 0 |\n| `run_cancel` | `DELETE \u2026/runs/{run_id}` \u2014 a list only (409 `run_not_a_list` on a one-off) | 0 |\n| `run_resume` | `POST \u2026/runs/{run_id}/resume` \u2014 `max_credits` (higher, if it paused at its cap), `retry_failed` | 0 + the searches it runs |\n| `run_more` | `POST \u2026/runs/{run_id}/more` \u2014 the next page of every search that has one; `max_credits` is the run's new total cap | **20 credits per search** with another page; `nothing_more` is free; dry_run quotes it |\n| `run_include` | `POST \u2026/runs/{run_id}/include` \u2014 `include` comments\\|authors\\|body, `ids` (1-200 rows), `comments.per_post` 5-50, `comments.replies`, `authors.top` 1-100, `max_credits` | metered per read, capped by max_credits (default: the quote); dry_run answers `estimate.credits {min, expected, max}` |\n\n`run_more` and `run_include` take `Idempotency-Key` and `dry_run`. Read only what a step added with `run_get` + `changes_since`, or follow `data.next.changes_url` \u2014 the page that serves a run's last row names it.\n\n## Watches (area `search_runs`)\n\n`watch_list` (status active\\|paused\\|stopped), `watch_get` (with its 10 latest fires), `watch_delete` \u2014 all free on `/v1/search/everywhere/watches`. `watch_pause` / `watch_resume` (new `max_credits_per_run` / `max_credits_per_month`) use the discover schedule routes a watch is built on. A watch view carries `caps`, `spend.month`, `next_fire_at`, `last_fire {run_id, new_rows, results_url}`.\n\n## Creator runs (area `creator_runs`)\n\n`prism/creators` (GET or POST, socialcrawl_request) works toward `limit` until it has the creators, runs dry or reaches `max_credits`, and says which (`stopped_because`, `short_reason`). Its run is read like a search run on `/v1/prism/creators/runs` (`run_list`, `run_get` with country / account_kind / platform / sort / order filters, `run_export`, `run_legs`, `run_cancel`, `run_resume`, `run_more`) \u2014 reads free.\n\n`run_save` (`POST \u2026/runs/{run_id}/save`, `keys` optional, Idempotency-Key) stores the creators as author lists \u2014 **free**, kept 30 days,
|
|
18
|
+
export declare const SEARCH_RUNS_DOC = "# SocialCrawl API \u2014 Universal search runs, lists, watches and creator runs\n\n`GET /v1/search/everywhere` answers one search in the call (20 credits, flat). Everything that keeps working after the call \u2014 a list of searches, a scheduled watch, the next page, follow-up reads \u2014 is a **run**, read and steered with `socialcrawl_manage` area `search_runs`. Every read is free.\n\n## Start one (socialcrawl_request, `POST /v1/search/everywhere`)\n\nThe JSON body takes every search field of the GET (`query` or `keywords`, `context`, `platforms`, `exclude_platforms`, `period`/`since`/`until`, `languages`, `country`, `depth`, `label`, \u2026) plus exactly one of:\n\n- **`queries`** \u2014 up to 100 search strings (\u2264512 chars each). One background run; each search is a job that reserves its own **20 credits**.\n- **`groups`** \u2014 1-100 `{id, query | keywords, context?, platforms?, exclude_platforms?, period?, since?, until?, tags?}`. A group's rows keep their own order; one de-duplication runs across the list, and a row several groups found lists them in `also_in_groups`.\n- **`schedule`** \u2014 `{every: 1h|6h|12h|1d|7d|30d, max_credits_per_run, max_credits_per_month?, name, start_at?}` turns the search (or list) into a **watch**: each fire returns only rows that watch never delivered (the first fire marks its rows `baseline: true`).\n\n**Price:** 20 credits per search plus any extras' ceilings (`comments.*`, `authors.*`). A list needs `max_credits` at or above that estimate; nothing is held at submit, each search charges as it runs, and the run **pauses** at `max_credits`, the key budget or the balance with `data.next.resume_url` \u2014 nothing is paid twice. A watch needs `max_credits_per_run` at least one fire's estimate; each fire bills like the list (no surcharge, no refund when nothing is new). `dry_run: true` answers the plan and estimate for free \u2014 on a watch, the price of a fire (`credits_per_fire`) and of 30 days (`credits_per_30_days`). The answer is **202** with `data.run` and `data.next.status_url` (a watch adds `data.watch`). `Idempotency-Key` replays the first answer; the same request sent again while its run is live returns that run (`run.deduplicated`).\n\n## Runs (area `search_runs`)\n\nUniversal-search runs created since 14/11/2026 are kept 30 days by default (was 7); `retention_days` is 1 to 30.\n\n| Action | Route | Cost |\n|---|---|---|\n| `run_list` | `GET /v1/search/everywhere/runs` \u2014 status, created_after, cursor, page_size 1-100; a watch id as `id` lists its fires | 0 |\n| `run_get` | `GET \u2026/runs/{run_id}` \u2014 `wait_s` 0-25 long-polls; format evidence\\|compact\\|text, fields, sort relevance\\|recent\\|engagement, max_per_platform, platform, group, state kept\\|dropped\\|all, changes_since, cursor, page_size | 0 |\n| `run_export` | `GET \u2026/runs/{run_id}/results.jsonl` \u2014 the same filters, no paging; ends with `{\"complete\":true,\"changes_url\":\u2026}` | 0 |\n| `run_legs` | `GET \u2026/runs/{run_id}/legs` \u2014 every search with its outcome and credits | 0 |\n| `run_cancel` | `DELETE \u2026/runs/{run_id}` \u2014 a list only (409 `run_not_a_list` on a one-off) | 0 |\n| `run_resume` | `POST \u2026/runs/{run_id}/resume` \u2014 `max_credits` (higher, if it paused at its cap), `retry_failed` | 0 + the searches it runs |\n| `run_more` | `POST \u2026/runs/{run_id}/more` \u2014 the next page of every search that has one; `max_credits` is the run's new total cap | **20 credits per search** with another page; `nothing_more` is free; dry_run quotes it |\n| `run_include` | `POST \u2026/runs/{run_id}/include` \u2014 `include` comments\\|authors\\|body, `ids` (1-200 rows), `comments.per_post` 5-50, `comments.replies`, `authors.top` 1-100, `max_credits` | metered per read, capped by max_credits (default: the quote); dry_run answers `estimate.credits {min, expected, max}` |\n\n`run_more` and `run_include` take `Idempotency-Key` and `dry_run`. Read only what a step added with `run_get` + `changes_since`, or follow `data.next.changes_url` \u2014 the page that serves a run's last row names it.\n\n## Watches (area `search_runs`)\n\n`watch_list` (status active\\|paused\\|stopped), `watch_get` (with its 10 latest fires), `watch_delete` \u2014 all free on `/v1/search/everywhere/watches`. `watch_pause` / `watch_resume` (new `max_credits_per_run` / `max_credits_per_month`) use the discover schedule routes a watch is built on. A watch view carries `caps`, `spend.month`, `next_fire_at`, `last_fire {run_id, new_rows, results_url}`.\n\n## Creator runs (area `creator_runs`)\n\n`prism/creators` (GET or POST, socialcrawl_request) works toward `limit` until it has the creators, runs dry or reaches `max_credits`, and says which (`stopped_because`, `short_reason`). Its run is read like a search run on `/v1/prism/creators/runs` (`run_list`, `run_get` with country / account_kind / platform / sort / order filters, `run_export`, `run_legs`, `run_cancel`, `run_resume`, `run_more`) \u2014 reads free.\n\n`run_save` (`POST \u2026/runs/{run_id}/save`, `keys` optional, Idempotency-Key) stores the creators as author lists \u2014 **free**, kept 30 days, counted in the 500 live stored lists per account (see Stored lists in the `discover-runs` topic), 10,000 handles each \u2014 and answers `data.next.follow`: a ready `POST prism/discover` schedule body (daily, event `discover.new_rows`) that watches those creators for new posts. It costs what its runs cost, with no premium.\n\n## follow\n\nAny `data.next.*` read URL (status_url, results_url, legs_url, changes_url, a watch's links) goes to action `follow` \u2014 absolute or relative, on the configured API only. POST links are refused with the action to use: more_url \u2192 `run_more`, include_url \u2192 `run_include`, resume_url \u2192 `run_resume`, a creator save \u2192 `run_save`.\n";
|