socialcrawl-mcp 2.3.0 → 2.6.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 +9 -3
- package/dist/app.js +71 -12
- package/dist/chatgpt-text.d.ts +23 -0
- package/dist/chatgpt-text.js +310 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +9 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/context.d.ts +7 -0
- package/dist/cost-guard.d.ts +28 -3
- package/dist/cost-guard.js +69 -6
- package/dist/data/docs-async.d.ts +1 -1
- package/dist/data/docs-async.js +147 -137
- package/dist/data/docs-handwritten.js +968 -947
- package/dist/data/docs.js +5 -1
- package/dist/data/endpoints.js +2050 -941
- 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 +196 -159
- package/dist/data/platforms.js +13 -13
- package/dist/data/recipes.js +1 -1
- package/dist/data/registry-meta.d.ts +9 -9
- package/dist/data/registry-meta.js +9 -9
- package/dist/endpoint-resolve.d.ts +1 -0
- package/dist/endpoint-resolve.js +10 -1
- package/dist/endpoint-surface.d.ts +64 -0
- package/dist/endpoint-surface.js +478 -0
- package/dist/held-surfaces.d.ts +13 -2
- package/dist/held-surfaces.js +16 -3
- package/dist/hydration.js +7 -0
- package/dist/instructions.md +18 -18
- package/dist/listings.d.ts +24 -0
- package/dist/listings.js +55 -0
- package/dist/oauth/config.d.ts +20 -0
- package/dist/oauth/config.js +19 -0
- package/dist/oauth/resource-server.d.ts +12 -2
- package/dist/oauth/resource-server.js +5 -20
- package/dist/oauth/scopes.d.ts +2 -2
- package/dist/oauth/scopes.js +4 -4
- package/dist/param-aliases.d.ts +7 -0
- package/dist/param-aliases.js +15 -0
- package/dist/pricing.js +5 -1
- package/dist/resources/sample-gate.js +34 -1
- package/dist/resources/supplier-tokens.d.ts +1 -1
- package/dist/resources/supplier-tokens.js +2 -0
- package/dist/result.js +8 -0
- package/dist/schemas/async.d.ts +39 -12
- package/dist/schemas/async.js +40 -4
- package/dist/schemas/outputs.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/timeouts.d.ts +24 -1
- package/dist/timeouts.js +32 -0
- package/dist/tools/async-common.d.ts +4 -2
- package/dist/tools/async-common.js +10 -2
- package/dist/tools/discover-runs.d.ts +6 -3
- package/dist/tools/discover-runs.js +126 -7
- package/dist/tools/discover.js +3 -0
- package/dist/tools/list-endpoints.js +5 -3
- package/dist/tools/manage.js +5 -4
- package/dist/tools/pricing.js +41 -10
- package/dist/tools/request.js +10 -2
- package/dist/tools/search-runs.js +27 -3
- package/dist/types.d.ts +9 -1
- package/dist/unit-meters.d.ts +32 -0
- package/dist/unit-meters.js +137 -0
- package/dist/value-prices.d.ts +38 -0
- package/dist/value-prices.js +168 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
### Remote server (hosted — no install)
|
|
25
25
|
|
|
26
|
-
Connect straight to the hosted Streamable HTTP endpoint
|
|
26
|
+
Connect straight to the hosted Streamable HTTP endpoint. There is nothing to install or run.
|
|
27
|
+
|
|
28
|
+
**Sign in instead of a key.** The hosted server supports OAuth sign-in. Add `https://mcp.socialcrawl.dev/mcp` to your client and sign in with your SocialCrawl account. The client gets a key of its own, which you can cap or disconnect under Dashboard → Connected apps. claude.ai, ChatGPT and Perplexity take the URL as a custom connector. The steps for every client are at [socialcrawl.dev/docs/mcp/sign-in](https://www.socialcrawl.dev/docs/mcp/sign-in).
|
|
29
|
+
|
|
30
|
+
**Or send your key in a header**, for agents, scripts and CI:
|
|
27
31
|
|
|
28
32
|
**Claude Code** (works in the CLI *and* Claude Code on the web / cloud sandboxes)
|
|
29
33
|
|
|
@@ -48,7 +52,9 @@ claude mcp add --scope user --transport http socialcrawl https://mcp.socialcrawl
|
|
|
48
52
|
|
|
49
53
|
**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
54
|
|
|
51
|
-
The discovery tools (`socialcrawl_find`, `socialcrawl_endpoint`, `socialcrawl_estimate`) work without a key, so you can explore before signing up.
|
|
55
|
+
The discovery tools (`socialcrawl_find`, `socialcrawl_endpoint`, `socialcrawl_estimate`) work without a key or a sign-in, so you can explore before signing up. The key header and sign-in both work on the hosted server. How the sign-in works (an OAuth 2.1 resource server, on since 27/11/2026) is in `docs/REMOTE-STREAMABLE-HTTP.md` section 10a.
|
|
56
|
+
|
|
57
|
+
**ChatGPT plugin directory.** `https://mcp.socialcrawl.dev/chatgpt` serves the same API as one tool per endpoint (`get_tiktok_profile`, `search_reddit_comments` and so on) with sign-in, because the ChatGPT directory accepts only one tool per operation. Everywhere else, use `/mcp` above: its seven tools find, price and call any endpoint.
|
|
52
58
|
|
|
53
59
|
Prefer running it locally? Every stdio option below works exactly as before.
|
|
54
60
|
|
|
@@ -155,7 +161,7 @@ Restart your AI client after saving the configuration.
|
|
|
155
161
|
|
|
156
162
|
`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.
|
|
157
163
|
|
|
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.
|
|
164
|
+
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. New in 2.5.0: the full text of X Articles (`twitter/article`, and on `twitter/tweet` at no extra cost), the posts that quote a post, LinkedIn resharers and GitHub star history; 14 new endpoints (X trends, an account's replies, whole threads, list and community members, followers and posts; Instagram reposts and hashtag search; TikTok places; Facebook Marketplace category browse; Reddit posts by linked site and account search); new fields on X (link cards among them), Instagram, Reddit, TikTok (caption files), YouTube, LinkedIn and Facebook; new joins priced per use (YouTube video details, X profile details, Reddit activity, community info and media, Instagram counts, Marketplace vehicle details); transcripts with timed segments metered by video length; LinkedIn company lanes by page link; NSFW and AI-label filters on Discover; and exact quotes for every new price, including the `pages` lever on profile/full.
|
|
159
165
|
|
|
160
166
|
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.
|
|
161
167
|
|
package/dist/app.js
CHANGED
|
@@ -4,9 +4,19 @@ import { createHash } from "node:crypto";
|
|
|
4
4
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
5
5
|
import { extractApiKey } from "./auth.js";
|
|
6
6
|
import { createServer } from "./server.js";
|
|
7
|
+
import { createEndpointServer, endpointToolScopes } from "./endpoint-surface.js";
|
|
7
8
|
import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
8
9
|
import { oauthConfigFromEnv } from "./oauth/config.js";
|
|
9
10
|
import { mountProtectedResourceMetadata, oauthGate, RESOLVED_API_KEY } from "./oauth/resource-server.js";
|
|
11
|
+
import { SCOPES_SUPPORTED } from "./oauth/scopes.js";
|
|
12
|
+
import { CHATGPT_SURFACE, isListing, listingSurface } from "./listings.js";
|
|
13
|
+
/**
|
|
14
|
+
* /mcp is the seven-tool server; /chatgpt is the endpoint surface (one tool per
|
|
15
|
+
* endpoint) for the ChatGPT plugin directory. Both share the limiters below.
|
|
16
|
+
*/
|
|
17
|
+
const MCP_PATHS = ["/mcp", "/chatgpt"];
|
|
18
|
+
/** Token shown in the OpenAI platform's "Domain verification" panel for the SocialCrawl plugin. */
|
|
19
|
+
const OPENAI_APPS_CHALLENGE_TOKEN = "Kt1HUZBedz6_KD-TQLluvPVN4hxxHkhW5toy8pq_hq0";
|
|
10
20
|
export function buildApp(config) {
|
|
11
21
|
const oauth = config.oauth === undefined ? oauthConfigFromEnv(process.env) : (config.oauth ?? undefined);
|
|
12
22
|
const app = express();
|
|
@@ -48,6 +58,14 @@ export function buildApp(config) {
|
|
|
48
58
|
});
|
|
49
59
|
if (oauth) {
|
|
50
60
|
mountProtectedResourceMetadata(app, oauth);
|
|
61
|
+
// /chatgpt has its own metadata; the root fallback keeps naming /mcp.
|
|
62
|
+
if (oauth.endpointSurface) {
|
|
63
|
+
mountProtectedResourceMetadata(app, { resource: oauth.endpointSurface.resource, issuer: oauth.issuer }, { root: false });
|
|
64
|
+
}
|
|
65
|
+
// Each store listing names its own address as the resource (sheet A1).
|
|
66
|
+
for (const { resource } of oauth.listings?.values() ?? []) {
|
|
67
|
+
mountProtectedResourceMetadata(app, { resource, issuer: oauth.issuer }, { root: false });
|
|
68
|
+
}
|
|
51
69
|
}
|
|
52
70
|
// The xForwardedForHeader validation would 500 any request carrying an
|
|
53
71
|
// X-Forwarded-For header while `trust proxy` is off. We ignore that header
|
|
@@ -56,7 +74,7 @@ export function buildApp(config) {
|
|
|
56
74
|
// Tier 1 — hard per-IP ceiling for ALL /mcp traffic. Generous enough that no
|
|
57
75
|
// real client hits it; stops garbage-key floods from bypassing limiting.
|
|
58
76
|
const globalLimits = config.globalRateLimit ?? { windowMs: 60_000, limit: 600 };
|
|
59
|
-
app.use(
|
|
77
|
+
app.use(MCP_PATHS, rateLimit({
|
|
60
78
|
windowMs: globalLimits.windowMs,
|
|
61
79
|
limit: globalLimits.limit,
|
|
62
80
|
standardHeaders: true,
|
|
@@ -67,7 +85,7 @@ export function buildApp(config) {
|
|
|
67
85
|
// skips it (valid keys are limited upstream by concurrency + credit billing;
|
|
68
86
|
// invalid keys are caught by the global ceiling above).
|
|
69
87
|
const limits = config.rateLimit ?? { windowMs: 60_000, limit: 60 };
|
|
70
|
-
app.use(
|
|
88
|
+
app.use(MCP_PATHS, rateLimit({
|
|
71
89
|
windowMs: limits.windowMs,
|
|
72
90
|
limit: limits.limit,
|
|
73
91
|
standardHeaders: true,
|
|
@@ -81,15 +99,42 @@ export function buildApp(config) {
|
|
|
81
99
|
// With OAuth on, the gate answers 401/403 or resolves the token's API key
|
|
82
100
|
// into res.locals; without it, the key comes straight from the headers.
|
|
83
101
|
const mcpGate = oauth ? [oauthGate(oauth)] : [];
|
|
84
|
-
|
|
102
|
+
// /chatgpt lists tools anonymously (the directory scans them) but runs none:
|
|
103
|
+
// every tool there needs an account, so any tools/call without one gets the
|
|
104
|
+
// 401 that starts sign-in.
|
|
105
|
+
const chatgptScopes = endpointToolScopes();
|
|
106
|
+
const chatgptGate = oauth?.endpointSurface
|
|
107
|
+
? [
|
|
108
|
+
oauthGate({ ...oauth, resource: oauth.endpointSurface.resource, verifier: oauth.endpointSurface.verifier }, { anonymousTools: new Set(), scopesForTool: (name) => chatgptScopes[name] ?? SCOPES_SUPPORTED }),
|
|
109
|
+
]
|
|
110
|
+
: [];
|
|
111
|
+
// A known listing has its own gate (its own resource and audience); an
|
|
112
|
+
// unknown one is gated exactly like /mcp.
|
|
113
|
+
const listingGates = new Map([...(oauth?.listings ?? [])].map(([slug, l]) => [slug, oauthGate({ ...oauth, resource: l.resource, verifier: l.verifier })]));
|
|
114
|
+
const listingGate = (req, res, next) => {
|
|
115
|
+
const slug = String(req.params.listing);
|
|
116
|
+
const gate = (isListing(slug) ? listingGates.get(slug) : undefined) ?? mcpGate[0];
|
|
117
|
+
if (gate)
|
|
118
|
+
gate(req, res, next);
|
|
119
|
+
else
|
|
120
|
+
next();
|
|
121
|
+
};
|
|
122
|
+
const serve = (build, surfaceOf) => async (req, res) => {
|
|
85
123
|
// Stateless: fresh server + transport per request, key bound via closure.
|
|
86
124
|
const resolvedKey = res.locals[RESOLVED_API_KEY];
|
|
87
125
|
// The caller's own x-client-tag labels its charges (API-210); client.ts
|
|
88
126
|
// drops one that breaks the API's rule. Never read from process env here.
|
|
89
127
|
const tagHeader = req.headers["x-client-tag"];
|
|
90
128
|
const clientTag = typeof tagHeader === "string" ? tagHeader : undefined;
|
|
91
|
-
|
|
92
|
-
const
|
|
129
|
+
// The surface label comes from this app's own route, never from a header.
|
|
130
|
+
const clientSurface = surfaceOf?.(req);
|
|
131
|
+
const ctx = {
|
|
132
|
+
apiKey: resolvedKey ?? extractApiKey(req.headers),
|
|
133
|
+
baseUrl,
|
|
134
|
+
...(clientTag ? { clientTag } : {}),
|
|
135
|
+
...(clientSurface ? { clientSurface } : {}),
|
|
136
|
+
};
|
|
137
|
+
const server = build(ctx);
|
|
93
138
|
const transport = new StreamableHTTPServerTransport({
|
|
94
139
|
sessionIdGenerator: undefined,
|
|
95
140
|
enableJsonResponse: true,
|
|
@@ -115,16 +160,30 @@ export function buildApp(config) {
|
|
|
115
160
|
});
|
|
116
161
|
}
|
|
117
162
|
}
|
|
118
|
-
}
|
|
119
|
-
app.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
163
|
+
};
|
|
164
|
+
app.post("/mcp", ...mcpGate, serve(createServer));
|
|
165
|
+
app.post("/chatgpt", ...chatgptGate, serve(createEndpointServer, () => CHATGPT_SURFACE));
|
|
166
|
+
app.post("/mcp/:listing", listingGate, serve(createServer, (req) => {
|
|
167
|
+
const slug = String(req.params.listing);
|
|
168
|
+
return isListing(slug) ? listingSurface(slug) : undefined;
|
|
169
|
+
}));
|
|
170
|
+
for (const path of [...MCP_PATHS, "/mcp/:listing"]) {
|
|
171
|
+
app.get(path, (_req, res) => {
|
|
172
|
+
res.status(405).set("Allow", "POST").send();
|
|
173
|
+
});
|
|
174
|
+
app.delete(path, (_req, res) => {
|
|
175
|
+
res.status(405).set("Allow", "POST").send();
|
|
176
|
+
});
|
|
177
|
+
}
|
|
125
178
|
app.get("/healthz", (_req, res) => {
|
|
126
179
|
res.json({ status: "ok", name: SERVER_NAME, version: SERVER_VERSION });
|
|
127
180
|
});
|
|
181
|
+
// OpenAI Apps (ChatGPT plugin) domain verification, 27/11/2026. The portal
|
|
182
|
+
// fetches this origin-root URL and expects the token as the whole body. The
|
|
183
|
+
// token is public by design, so it lives here rather than in an env var.
|
|
184
|
+
app.get("/.well-known/openai-apps-challenge", (_req, res) => {
|
|
185
|
+
res.type("text/plain").send(OPENAI_APPS_CHALLENGE_TOKEN);
|
|
186
|
+
});
|
|
128
187
|
// Error handler: malformed JSON / oversized bodies otherwise fall through to
|
|
129
188
|
// Express's default HTML error page — return JSON-RPC errors instead.
|
|
130
189
|
app.use((err, _req, res, next) => {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Written text for /chatgpt tools whose registry wording OpenAI's tool scan
|
|
3
|
+
* refused or would refuse (30/11/2026): a read whose text says it carries on
|
|
4
|
+
* in the background, a comparison with another product, a title that says
|
|
5
|
+
* "every" over a capped call, two prices in one description, telegraphic
|
|
6
|
+
* text with arrows. Only this surface reads it; /mcp and the API docs keep
|
|
7
|
+
* the registry text.
|
|
8
|
+
*
|
|
9
|
+
* Every fact here comes from the endpoint's own registry entry. Paths such as
|
|
10
|
+
* `blog/search` are fine: the surface turns them into tool names. The rules in
|
|
11
|
+
* chatgpt-surface.test.ts hold for every tool, so a new endpoint whose
|
|
12
|
+
* registry text breaks one fails the suite until it has an entry here.
|
|
13
|
+
*/
|
|
14
|
+
export interface ToolText {
|
|
15
|
+
title?: string;
|
|
16
|
+
summary?: string;
|
|
17
|
+
useWhen?: string;
|
|
18
|
+
/** Replaces the cost sentence when the price is not per call. */
|
|
19
|
+
cost?: string;
|
|
20
|
+
/** Argument descriptions to replace; null leaves the argument out. */
|
|
21
|
+
params?: Record<string, string | null>;
|
|
22
|
+
}
|
|
23
|
+
export declare const TOOL_TEXT: Record<string, ToolText>;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
export const TOOL_TEXT = {
|
|
2
|
+
// ── Reads whose text promised background work or stored state ──
|
|
3
|
+
get_prism_discover: {
|
|
4
|
+
summary: "Search many platforms for posts on a topic or brand, keep a date window, judge each row for relevance and return the posts.",
|
|
5
|
+
useWhen: "Use it to collect what people say about a topic or a brand across platforms in one call.",
|
|
6
|
+
params: {
|
|
7
|
+
keywords: "Comma-separated searches, up to 6 in one call. Each runs once on each platform.",
|
|
8
|
+
depth: "quick (at most 3 fast platforms, about 15 s) or standard (the default).",
|
|
9
|
+
pages_per_platform: "Pages per search, 1 (the default) to 3.",
|
|
10
|
+
continue: "The token in data.next.continue_url: fetches the next platform pages of the searches that reported more.",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
get_prism_creators: {
|
|
14
|
+
summary: "Find creators (influencers) who post about a niche on TikTok, Instagram, YouTube, X and LinkedIn, or measure and rank creators you already have.",
|
|
15
|
+
useWhen: "Use it to search for or rank creators in one call.",
|
|
16
|
+
params: {
|
|
17
|
+
limit: "Creators to deliver, up to 100 (default 20).",
|
|
18
|
+
depth: "quick (profile-level creators, no posts read, at most three platforms) or standard (the default, which reads each creator's recent posts).",
|
|
19
|
+
deadline_s: "Seconds this call may wait, 10 to 96 (default 40, quick 15).",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
get_prism_profile_comments: {
|
|
23
|
+
useWhen: "Use it to check an account's own recent posts for new comments, passing a recent since date.",
|
|
24
|
+
},
|
|
25
|
+
get_prism_jobs_by_job_id: {
|
|
26
|
+
useWhen: "Use it to check a background job's progress and read its rows page by page.",
|
|
27
|
+
params: { job_id: "The job id (bj_…) from the job's data.job_id." },
|
|
28
|
+
},
|
|
29
|
+
get_twitter_ai_search: {
|
|
30
|
+
title: "Ask a question about posts on X",
|
|
31
|
+
summary: "Answer an open question about posts on X, using a model that searches X and cites the posts it used.",
|
|
32
|
+
useWhen: "Use it for open questions such as what an account said this week. A thin answer means few posts were found, so confirm with search_twitter_tweets.",
|
|
33
|
+
},
|
|
34
|
+
search_telegram: {
|
|
35
|
+
params: { date_posted: "Only pages the search index dates within this window: last-hour, last-day, last-week, last-month or last-year." },
|
|
36
|
+
},
|
|
37
|
+
search_linkedin_hashtag: { useWhen: "Use it to find posts that carry a hashtag. Keyword search across posts is search/posts." },
|
|
38
|
+
search_linkedin_posts: {
|
|
39
|
+
useWhen: "Use it to find public LinkedIn posts that match a keyword; it reads LinkedIn's own post search at request time, newest first with sort_by=date_posted or by relevance.",
|
|
40
|
+
},
|
|
41
|
+
get_linkedin_company_job_count: { useWhen: "Use it to read a company's current open job count without paging through company/jobs." },
|
|
42
|
+
get_naver_place_reviews: {
|
|
43
|
+
useWhen: "Use it to read recent visitor reviews; send since to keep only reviews from that date on, and read the sentiment labels on each review.",
|
|
44
|
+
},
|
|
45
|
+
get_naver_blog_posts: {
|
|
46
|
+
title: "List a Naver blog's posts, newest first (블로그 글 목록)",
|
|
47
|
+
summary: "List the posts of a Naver blog, newest first, page by page (블로그 글 목록).",
|
|
48
|
+
useWhen: "Use it to read a blog's posts with the cursor. To find posts by keyword, use blog/search.",
|
|
49
|
+
},
|
|
50
|
+
// ── Comparisons with other products or ways of working ──
|
|
51
|
+
get_reddit_profile_comments: {
|
|
52
|
+
summary: "Read a Reddit account's own comments, newest first.",
|
|
53
|
+
useWhen: "Use it when you need the account's actual comment history. It costs 2 credits per comment returned; search/comments with query=author:<name> costs 1 credit a page but returns fewer rows.",
|
|
54
|
+
},
|
|
55
|
+
get_naver_search_trend: {
|
|
56
|
+
useWhen: "Use it to see how Korean search demand for a term changes over time. To compare terms, put them in one call as groups; separate calls are not on the same scale.",
|
|
57
|
+
},
|
|
58
|
+
get_linkedin_profile_posts_archive: {
|
|
59
|
+
title: "A LinkedIn member's post history, 100 per page",
|
|
60
|
+
summary: "Read a LinkedIn member's posts 100 a page, further back than profile/posts goes, with exact publish times and share counts.",
|
|
61
|
+
useWhen: "It costs 5 credits per post returned, so check profile/posts first: it covers up to 100 posts at a lower price.",
|
|
62
|
+
},
|
|
63
|
+
get_douyin_profile: {
|
|
64
|
+
summary: "Get a Douyin creator profile, without its videos.",
|
|
65
|
+
useWhen: "Use it to read a creator's follower count; call it again later to see how the count changes.",
|
|
66
|
+
},
|
|
67
|
+
get_youtube_playlist: { useWhen: "Use it when you have a playlist id; playlist/items returns the same rows." },
|
|
68
|
+
get_youtube_playlist_items: { useWhen: "Use it when you have a playlist id; add include=engagement for counts and durations." },
|
|
69
|
+
get_prism_ai_visibility: {
|
|
70
|
+
title: "Measure a brand's mentions in AI answers",
|
|
71
|
+
summary: "Ask a set of prompts to AI engines several times and report how often each brand appears, with a ranking of the domains the answers cite.",
|
|
72
|
+
useWhen: "Use it to track a brand's visibility in AI answers and see which sites those answers cite.",
|
|
73
|
+
},
|
|
74
|
+
get_prism_korea_gap: {
|
|
75
|
+
summary: "Compare what is said about a brand or topic worldwide with what is said on Naver in Korea, both ways.",
|
|
76
|
+
useWhen: "Use it to see whether a brand's Korean conversation matches its global one.",
|
|
77
|
+
},
|
|
78
|
+
get_prism_audience_overlap: {
|
|
79
|
+
summary: "Measure how much two TikTok creators' commenter audiences overlap, with the shared-fan count and a confidence label.",
|
|
80
|
+
useWhen: "Use it to check for duplicate reach before booking both creators.",
|
|
81
|
+
},
|
|
82
|
+
get_prism_share_of_voice: {
|
|
83
|
+
summary: "Compare 2 to 5 brands by engagement-weighted share of voice, split between web and social, with an emotion breakdown.",
|
|
84
|
+
useWhen: "Use it to compare brands against each other in one call; brand-mentions covers a single keyword.",
|
|
85
|
+
},
|
|
86
|
+
get_prism_review_integrity: {
|
|
87
|
+
summary: "Check a product's or business's reviews across sources for signs of inflated or paid ratings, using fixed statistical rules.",
|
|
88
|
+
useWhen: "Use it when you suspect inflated or paid reviews; product-reviews tells you what buyers said.",
|
|
89
|
+
},
|
|
90
|
+
get_utility_llms: {
|
|
91
|
+
title: "Get an overview of the API for AI agents",
|
|
92
|
+
summary: "Return an overview of the SocialCrawl API for an AI agent to read.",
|
|
93
|
+
useWhen: "Use it when an agent should learn the API in one call.",
|
|
94
|
+
cost: "Costs 0 credits per call.",
|
|
95
|
+
},
|
|
96
|
+
get_youtube_profile_full: {
|
|
97
|
+
useWhen: "Use it when you want the channel and its recent videos together; if the videos cannot be fetched you still get the profile with those metrics empty.",
|
|
98
|
+
},
|
|
99
|
+
get_twitter_profile_full: {
|
|
100
|
+
useWhen: "Use it when you want the profile and recent posts together. The metrics are computed from one fetch of the account's posts, so check _warnings before reading cadence as a true rate.",
|
|
101
|
+
},
|
|
102
|
+
get_facebook_profile_full: {
|
|
103
|
+
useWhen: "Use it when you want the profile and recent posts together; the profile still comes back even if the posts part fails.",
|
|
104
|
+
},
|
|
105
|
+
get_search_multi: {
|
|
106
|
+
useWhen: "Use it to see each platform's own results for one query; for a ranked, summarised answer, use get_search_everywhere.",
|
|
107
|
+
},
|
|
108
|
+
// ── API paths with no tool behind them ──
|
|
109
|
+
create_prism_discover_inputs: {
|
|
110
|
+
useWhen: "Use it when a list of authors to keep, or of posts you hold, is too long for a URL; pass its id to get_prism_discover.",
|
|
111
|
+
},
|
|
112
|
+
run_google_business_reviews_history: {
|
|
113
|
+
useWhen: "Use it when a place has more reviews than the 1,000 one business reviews call returns.",
|
|
114
|
+
params: { depth: "How many reviews to collect, 1 to 10,000. The job's results are read page by page with offset and limit." },
|
|
115
|
+
},
|
|
116
|
+
run_trustpilot_reviews_history: {
|
|
117
|
+
params: { depth: "How many reviews to collect, 1 to 10,000. The job's results are read page by page with offset and limit." },
|
|
118
|
+
},
|
|
119
|
+
// ── Titles that promised every, any or everything ──
|
|
120
|
+
get_google_business_contributor_reviews: {
|
|
121
|
+
title: "Get a Google Maps reviewer's reviews",
|
|
122
|
+
summary: "Get the reviews one Google Maps reviewer has written, up to the limit you set.",
|
|
123
|
+
useWhen: "Use it when a review looks suspicious or influential and you want to see what else that reviewer has posted, or to profile a Local Guide.",
|
|
124
|
+
},
|
|
125
|
+
get_prism_comments: {
|
|
126
|
+
title: "Get a post's comments with replies nested",
|
|
127
|
+
summary: "Get a post's comments with replies nested, paging through them up to the max you set (default 1,000 top-level comments).",
|
|
128
|
+
useWhen: "Use it to collect a comment thread in one request, without paging the platform's own comments tool.",
|
|
129
|
+
},
|
|
130
|
+
get_prism_video_intel: {
|
|
131
|
+
title: "Get a video's details, stats and top comments",
|
|
132
|
+
summary: "Get one video's details, stats and top comments from a YouTube, TikTok, Rumble or Instagram URL, with an optional transcript and commenter sample.",
|
|
133
|
+
useWhen: "Use it to read one video in one call rather than separate detail, comments and transcript calls.",
|
|
134
|
+
},
|
|
135
|
+
get_prism_lookup: {
|
|
136
|
+
title: "Look up a post, video, product or repo URL",
|
|
137
|
+
summary: "Take the URL of one post, video, product or repository and return its details from the matching platform.",
|
|
138
|
+
useWhen: "Use it when you have such a URL and do not know which platform tool fits. Profile, channel and storefront URLs are not accepted.",
|
|
139
|
+
},
|
|
140
|
+
get_search_everywhere: {
|
|
141
|
+
title: "Search a topic across 18 platforms",
|
|
142
|
+
summary: "Search one topic across up to 18 social platforms and return ranked results.",
|
|
143
|
+
useWhen: "Use it when you want a topic's coverage across platforms in one call.",
|
|
144
|
+
cost: "Costs 20 credits per search; each keyword and each language you add is its own search.",
|
|
145
|
+
params: {
|
|
146
|
+
sort: "relevance, recent or engagement.",
|
|
147
|
+
max_per_platform: "1 to 100 rows per platform.",
|
|
148
|
+
deadline_s: "Time limit in seconds, 8 to 96.",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
run_search_everywhere: {
|
|
152
|
+
summary: "Run a list of searches across platforms as one background run, or turn a search into a watch that repeats on a schedule and delivers only new rows.",
|
|
153
|
+
cost: "Costs 20 credits per search; dry_run is free.",
|
|
154
|
+
},
|
|
155
|
+
get_twitter_tweet_thread: { title: "Get an X thread in order from one of its posts" },
|
|
156
|
+
get_linkedin_profile_complete: { title: "LinkedIn profile with experience, education and skills" },
|
|
157
|
+
get_g2_categories: { title: "List G2 category URLs" },
|
|
158
|
+
get_walmart_offers: { title: "Get the sellers offering a Walmart product" },
|
|
159
|
+
get_utility_endpoints: { title: "List the available endpoints" },
|
|
160
|
+
get_utility_endpoint: { title: "How to use one endpoint" },
|
|
161
|
+
get_producthunt_leaderboard: { title: "Product Hunt leaderboard for a period" },
|
|
162
|
+
get_goodreads_book_editions: {
|
|
163
|
+
title: "List editions of a Goodreads book",
|
|
164
|
+
summary: "List the editions of a Goodreads book, up to the limit you set.",
|
|
165
|
+
},
|
|
166
|
+
get_github_repo_dossier: {
|
|
167
|
+
title: "Get a GitHub repository overview",
|
|
168
|
+
summary: "Get an overview of a GitHub repository in one call: its details, README, releases and issues.",
|
|
169
|
+
useWhen: "Use it when a single call should give you enough to summarise a project.",
|
|
170
|
+
},
|
|
171
|
+
get_github_user_profile_velocity: {
|
|
172
|
+
title: "Get a GitHub user's activity summary",
|
|
173
|
+
summary: "Get a summary of how active a GitHub developer is and where they contribute.",
|
|
174
|
+
},
|
|
175
|
+
get_us_congress_trades_ticker_trades: { useWhen: "Use it after stats/tickers to list the filings on that symbol, paged with limit and offset." },
|
|
176
|
+
get_us_congress_trades_stats: { title: "US Congress trades dataset summary", useWhen: "Use it first to see how many trades the dataset holds before paging through them." },
|
|
177
|
+
search_redfin: { useWhen: "Use it to list an area's homes for sale or recent sales; narrow the area when a search reaches its limit." },
|
|
178
|
+
// ── One price and one behaviour per tool ──
|
|
179
|
+
search_instagram_hashtag: {
|
|
180
|
+
title: "Get posts for an Instagram hashtag",
|
|
181
|
+
summary: "Get posts for one Instagram hashtag, ranked top, recent or clips, paged with a cursor.",
|
|
182
|
+
useWhen: "Use it when you already have the hashtag. For keyword or topic discovery, use search/reels.",
|
|
183
|
+
},
|
|
184
|
+
search_instagram_reels: {
|
|
185
|
+
title: "Search Instagram reels by keyword",
|
|
186
|
+
summary: "Search Instagram for reels about a brand, phrase or subject, with view counts.",
|
|
187
|
+
useWhen: "Use it for keyword and topic discovery on Instagram. For a hashtag you already have, use search/hashtag; for share counts, post/stats.",
|
|
188
|
+
},
|
|
189
|
+
get_youtube_channel_about: {
|
|
190
|
+
summary: "Get a YouTube channel's public contact email and country.",
|
|
191
|
+
useWhen: "Use it for outreach when get_youtube_channel returned no email. A first read can take up to 5 minutes.",
|
|
192
|
+
cost: "Costs 25 credits when an address comes back; you are charged only when an address is returned.",
|
|
193
|
+
},
|
|
194
|
+
get_yelp_business_info: {
|
|
195
|
+
title: "Get a Yelp business by its id",
|
|
196
|
+
summary: "Get one Yelp business by its Yelp id (encid).",
|
|
197
|
+
useWhen: "Use it when you already have the business id; to find businesses by term and location, use search_yelp.",
|
|
198
|
+
},
|
|
199
|
+
get_linkedin_profile_all: {
|
|
200
|
+
title: "A LinkedIn member's profile, counts and interests",
|
|
201
|
+
summary: "Get a LinkedIn member's profile, counts, interests and similar profiles in one call.",
|
|
202
|
+
useWhen: "Use it when you want those parts together rather than calling get_linkedin_profile, profile/complete, profile/stats and the interests tools one by one.",
|
|
203
|
+
},
|
|
204
|
+
// ── Text a reader could not follow ──
|
|
205
|
+
get_instagram_media_screen_text: {
|
|
206
|
+
summary: "Read the text shown in an Instagram post's images or video, such as carousel headlines or text on a reel's cover.",
|
|
207
|
+
useWhen: "Use it for text designed into the post itself. The caption comes from get_instagram_post and the spoken words from media/transcript. On a reel it reads the cover unless frames is all.",
|
|
208
|
+
},
|
|
209
|
+
get_tiktok_video_screen_text: {
|
|
210
|
+
summary: "Read the text shown on screen in a TikTok video, such as overlay captions.",
|
|
211
|
+
useWhen: "Use it for text designed into the video itself. The caption comes from get_tiktok_post and the spoken words from post/transcript.",
|
|
212
|
+
},
|
|
213
|
+
get_youtube_transcripts: { summary: "Get transcripts for up to 100 YouTube videos, one row per video id. Failed ids are refunded." },
|
|
214
|
+
get_reddit_omni_search: {
|
|
215
|
+
summary: "Search Reddit for one keyword and return matching threads with their subreddit and top comments.",
|
|
216
|
+
useWhen: "Use it to read what people say about a topic on Reddit in one call. It is slow, and some threads may be only loosely related.",
|
|
217
|
+
},
|
|
218
|
+
get_prism_answers: {
|
|
219
|
+
summary: "Ask one question to Perplexity, Grok and Tavily and return each answer as written, with merged citations and a table of where the answers agree.",
|
|
220
|
+
useWhen: "Use it when you want several AI answers to one question and the sources they cite.",
|
|
221
|
+
},
|
|
222
|
+
get_prism_post_stats: { summary: "Take up to 100 post URLs from different platforms and return each post's current engagement. Failed URLs are refunded." },
|
|
223
|
+
get_prism_profiles: { summary: "Take up to 50 platform and handle pairs and return one profile per row. Failed handles are refunded." },
|
|
224
|
+
get_prism_post_comments: {
|
|
225
|
+
summary: "Take up to 25 post URLs from different platforms and return each post's comments in one call, priced per page like the comment tools.",
|
|
226
|
+
},
|
|
227
|
+
get_prism_demand_signals: {
|
|
228
|
+
title: "Get a consumer demand index for a product",
|
|
229
|
+
summary: "Combine app-review velocity, web mention trend, Reddit velocity and commerce review levels into one demand index for a product.",
|
|
230
|
+
useWhen: "Use it to gauge whether interest in a product is rising.",
|
|
231
|
+
},
|
|
232
|
+
get_prism_crisis_radar: {
|
|
233
|
+
summary: "Check whether a brand's daily mention volume and negative share are unusually high against recent days, and grade the severity if so.",
|
|
234
|
+
useWhen: "Use it to check for a sudden spike in negative chatter; when it triggers, crisis-postmortem gives the full timeline.",
|
|
235
|
+
},
|
|
236
|
+
get_prism_devtool_pulse: {
|
|
237
|
+
summary: "Report on a developer tool from its GitHub repository, Hacker News reaction, Reddit posts and developer-blog mentions, in one call.",
|
|
238
|
+
useWhen: "Use it to judge a developer tool's momentum in one request.",
|
|
239
|
+
},
|
|
240
|
+
get_prism_earned_media: {
|
|
241
|
+
summary: "List news, tech-press and recent web coverage of a brand, with duplicates removed and ranked, and a count by outlet.",
|
|
242
|
+
useWhen: "Use it to track press coverage in one call, and add a competitor to see which outlets covered them.",
|
|
243
|
+
},
|
|
244
|
+
get_prism_truthsocial_pulse: {
|
|
245
|
+
summary: "Get a Truth Social account's profile, recent posts, post details and related news in one call.",
|
|
246
|
+
useWhen: "Use it to follow one Truth Social account in a single request; the platform has no search.",
|
|
247
|
+
},
|
|
248
|
+
get_prism_creator_card: {
|
|
249
|
+
summary: "Return the profiles for one handle on TikTok, Instagram, YouTube, X and more platforms.",
|
|
250
|
+
useWhen: "Use it to look up the same handle on several platforms at once; handle-audit adds scoring and estimates.",
|
|
251
|
+
},
|
|
252
|
+
get_prism_format_lift: {
|
|
253
|
+
summary: "Compare a creator's posts by the kind of opening hook, with each post's result divided by that creator's own median.",
|
|
254
|
+
useWhen: "Use it to see which kind of hook performs best for one creator.",
|
|
255
|
+
},
|
|
256
|
+
get_prism_earliness: {
|
|
257
|
+
summary: "Show when a term first appeared on each platform, and whether that came before it showed in search trends or in ads.",
|
|
258
|
+
useWhen: "Use it to see how early a term surfaced. A different subject that shares the words does not count as a first sighting.",
|
|
259
|
+
},
|
|
260
|
+
get_prism_handle_audit: {
|
|
261
|
+
summary: "Score a handle on several platforms, rank the best matches, and estimate the data volume and credit cost of collecting it.",
|
|
262
|
+
useWhen: "Use it to vet a creator or brand name across platforms in one call.",
|
|
263
|
+
},
|
|
264
|
+
get_prism_apps_lookup: {
|
|
265
|
+
summary: "Find one app on Google Play and the App Store, check that the titles match, and compare ratings and listings across both stores.",
|
|
266
|
+
},
|
|
267
|
+
get_prism_launch_echo: {
|
|
268
|
+
useWhen: "Use it right after a launch to gather the reaction in one call; devtool-pulse covers a tool's ongoing health.",
|
|
269
|
+
},
|
|
270
|
+
get_search_forums: {
|
|
271
|
+
summary: "Search Reddit, Hacker News and Naver 지식iN and 카페 in one call, with top comments included on the leading threads.",
|
|
272
|
+
useWhen: "Use it when you want what people are asking and answering in forums; get_search_everywhere also covers video, code and social posts.",
|
|
273
|
+
},
|
|
274
|
+
get_search_creators: {
|
|
275
|
+
summary: "Find creators on TikTok, Threads and Instagram for a topic, ranked by relevance, followers and verification. Add YouTube, X or Facebook with sources.",
|
|
276
|
+
useWhen: "Use it to find creators about a topic in one call; add country for one Latin American, Spanish or Brazilian market.",
|
|
277
|
+
},
|
|
278
|
+
get_search_news: {
|
|
279
|
+
title: "Search news in several countries",
|
|
280
|
+
summary: "Search news for one query across several countries in one call, from two news indexes, and merge the articles.",
|
|
281
|
+
useWhen: "Use it for news coverage across several countries at once; for one topic across social platforms, use get_search_everywhere.",
|
|
282
|
+
},
|
|
283
|
+
get_polymarket_research: {
|
|
284
|
+
title: "Research Polymarket markets on a topic",
|
|
285
|
+
summary: "Find Polymarket markets on a topic by running several searches and dropping results that are not about it.",
|
|
286
|
+
useWhen: "Use it to get a focused list of markets on a subject.",
|
|
287
|
+
},
|
|
288
|
+
get_pinterest_board: {
|
|
289
|
+
summary: "Get the pins on a Pinterest board from its URL, about 15 pins a page.",
|
|
290
|
+
useWhen: "Use it when you have a board URL; pass the cursor for the next page, and add include=engagement for pin dates at 1 credit a row. user/boards finds a user's boards.",
|
|
291
|
+
},
|
|
292
|
+
get_tiktok_trending: {
|
|
293
|
+
summary: "Get TikTok's trending feed, worldwide by default or for one country with feed=local.",
|
|
294
|
+
useWhen: "Use feed=local for videos mostly from one country. The default feed is largely worldwide whatever region you pass, so filter on post.ext.region.",
|
|
295
|
+
},
|
|
296
|
+
get_instagram_story_download: {
|
|
297
|
+
title: "Get one Instagram story's media",
|
|
298
|
+
summary: "Get the media of one Instagram story.",
|
|
299
|
+
useWhen: "Use it after get_instagram_stories: pass the author's user_id and the story_id it returned.",
|
|
300
|
+
},
|
|
301
|
+
get_finance_news: {
|
|
302
|
+
useWhen: "Use it to find news that may explain a price move. Pass a bare ticker such as AAPL, or quote's AAPL:NASDAQ form; the suffix is ignored. The news is delayed.",
|
|
303
|
+
},
|
|
304
|
+
run_web_sessions_by_session_id_execute: {
|
|
305
|
+
title: "Run code in an open web session",
|
|
306
|
+
summary: "Run a snippet of node, python or bash code in a web session you already opened, to click, type or read the live page.",
|
|
307
|
+
useWhen: "Use it to work a page step by step. With node the value comes back as the result; bash and python return what they print.",
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
//# sourceMappingURL=chatgpt-text.js.map
|
package/dist/client.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ interface LongCallOptions {
|
|
|
15
15
|
timeoutMs?: number;
|
|
16
16
|
/** Send `Accept: text/event-stream`. A stream is assembled whether or not this is set. */
|
|
17
17
|
stream?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Send `Accept: application/json`: an `sse-default` endpoint streams unless
|
|
20
|
+
* the request asks for one JSON envelope. Ignored when `stream` is set.
|
|
21
|
+
*/
|
|
22
|
+
json?: boolean;
|
|
18
23
|
/** Called once per streamed chunk. */
|
|
19
24
|
onProgress?: (tick: ProgressTick) => void;
|
|
20
25
|
/** Filled in with response facts (Retry-After). */
|
package/dist/client.js
CHANGED
|
@@ -7,7 +7,11 @@ import { assembleSse, describeChunk, readSse } from "./sse.js";
|
|
|
7
7
|
*/
|
|
8
8
|
function clientHeaders(ctx) {
|
|
9
9
|
const tag = clientTagOf(ctx.clientTag);
|
|
10
|
-
return {
|
|
10
|
+
return {
|
|
11
|
+
"User-Agent": `${SERVER_NAME}/${SERVER_VERSION}`,
|
|
12
|
+
...(tag ? { "x-client-tag": tag } : {}),
|
|
13
|
+
...(ctx.clientSurface ? { "X-SocialCrawl-Client": ctx.clientSurface } : {}),
|
|
14
|
+
};
|
|
11
15
|
}
|
|
12
16
|
/** `Retry-After` as whole seconds (delta-seconds or an HTTP date), capped at an hour. */
|
|
13
17
|
export function parseRetryAfter(value, now = Date.now()) {
|
|
@@ -81,6 +85,8 @@ export async function makeRequest(ctx, options) {
|
|
|
81
85
|
const headers = { ...clientHeaders(ctx), "x-api-key": ctx.apiKey };
|
|
82
86
|
if (options.stream)
|
|
83
87
|
headers.Accept = "text/event-stream";
|
|
88
|
+
else if (options.json)
|
|
89
|
+
headers.Accept = "application/json";
|
|
84
90
|
if (options.idempotencyKey) {
|
|
85
91
|
headers["Idempotency-Key"] = options.idempotencyKey;
|
|
86
92
|
}
|
|
@@ -143,6 +149,8 @@ export async function apiRequest(ctx, options) {
|
|
|
143
149
|
headers["x-api-key"] = ctx.apiKey;
|
|
144
150
|
if (options.stream)
|
|
145
151
|
headers.Accept = "text/event-stream";
|
|
152
|
+
else if (options.json)
|
|
153
|
+
headers.Accept = "application/json";
|
|
146
154
|
if (options.idempotencyKey) {
|
|
147
155
|
headers["Idempotency-Key"] = options.idempotencyKey;
|
|
148
156
|
}
|
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.6.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.6.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
|
@@ -16,6 +16,13 @@ export interface ApiContext {
|
|
|
16
16
|
* `x-client-tag` header. Invalid values are never sent (client-tag.ts).
|
|
17
17
|
*/
|
|
18
18
|
clientTag?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Sent as `X-SocialCrawl-Client` on every API call: the surface this
|
|
21
|
+
* request came through (`mcp:<listing>` for a store listing address,
|
|
22
|
+
* `mcp:chatgpt` for /chatgpt). Set by the HTTP app only, from its own route,
|
|
23
|
+
* never from a caller's header.
|
|
24
|
+
*/
|
|
25
|
+
clientSurface?: string;
|
|
19
26
|
}
|
|
20
27
|
/**
|
|
21
28
|
* Build the context for the stdio entrypoint from process env.
|
package/dist/cost-guard.d.ts
CHANGED
|
@@ -35,9 +35,21 @@ export interface GuardStop {
|
|
|
35
35
|
structured: Record<string, unknown>;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* The `pages` lever (API-280, API-281): `{platform}/profile/full` and
|
|
39
|
+
* `prism/format-lift` read up to `max` pages in one call, the first at the flat
|
|
40
|
+
* price and each further page at `step` credits (the posts endpoint's own page
|
|
41
|
+
* price), refunding pages not read. The step is the band's spread over the
|
|
42
|
+
* further pages; undefined when the band does not split into whole credits.
|
|
43
|
+
*/
|
|
44
|
+
export declare function pagesLever(e: Endpoint): {
|
|
45
|
+
max: number;
|
|
46
|
+
step: number;
|
|
47
|
+
} | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a metered band is fully explained by the page, its `include=` joins,
|
|
50
|
+
* its metered judgments, its `pages` lever, and the value prices and include
|
|
51
|
+
* add-ons its text states (`value-prices.ts`) — then local arithmetic is exact.
|
|
52
|
+
* Any other meter (per-row `limit`, page walks the rule describes) is not.
|
|
41
53
|
*/
|
|
42
54
|
export declare function bandExplained(e: Endpoint): boolean;
|
|
43
55
|
/** Credits of the band's ceiling that belong to joins this call does not send. */
|
|
@@ -48,6 +60,19 @@ export declare function unaskedJoinCredits(e: Endpoint, include: string | undefi
|
|
|
48
60
|
* the band's ceiling when a param the pricing rule names is present (a
|
|
49
61
|
* plain call stays at the page price). `max_pages` multiplies the lot.
|
|
50
62
|
*/
|
|
63
|
+
/**
|
|
64
|
+
* What the call itself holds before joins, judgments, further pages and add-ons,
|
|
65
|
+
* when its rule meters it on something the params name: a batch priced per
|
|
66
|
+
* handle (prism/profiles), a per-row meter on `limit` (comments/full: ceil(limit
|
|
67
|
+
* / 4), at least 3; the affiliate lanes: limit x 107), or a unit price times
|
|
68
|
+
* the units named (Trends places, Naver segments, find-accounts platforms).
|
|
69
|
+
* `whole` means nothing else adds to it. Undefined: the page price.
|
|
70
|
+
*/
|
|
71
|
+
export declare function meteredBase(endpoint: Endpoint, params: Record<string, unknown>): {
|
|
72
|
+
credits: number;
|
|
73
|
+
basis: string;
|
|
74
|
+
whole?: boolean;
|
|
75
|
+
} | undefined;
|
|
51
76
|
export declare function localQuote(endpoint: Endpoint, params: Record<string, unknown>): number;
|
|
52
77
|
/**
|
|
53
78
|
* `GET /v1/utility/estimate` for one call (API-02): `id`, the params as a JSON
|