MCP, artifacts, and signed webhooks
Install the local stdio MCP server, retrieve private artifacts, and verify terminal job webhooks.
- DataSea MCP
- stdio
- webhook signature
The MCP tools are subject to the Web Context scopes, credit costs, target policy, and job states. The local stdio server runs on your machine with a scoped API key.
Install the local MCP server
Requires Node.js 20 or later. Install the versioned package from DataSea Developer Docs into a directory you control.
local_dir="$HOME/.local/share/datasea-mcp"
mkdir -p "$local_dir"
npm install --prefix "$local_dir" https://developers.datasea.io/downloads/datasea-mcp-server-0.1.0.tgz
"$local_dir/node_modules/.bin/datasea-mcp" --versionMCP client configuration
Add this to your MCP client configuration (for example Claude Desktop’s claude_desktop_config.json or Cursor’s mcp.json). Replace the command with the absolute path to your installed binary. Give the key only the scopes your client needs, for example web:scrape, web:jobs:read, and web:usage:read for a Scrape and doctor check.
{
"mcpServers": {
"datasea": {
"command": "/absolute/path/to/local-dir/node_modules/.bin/datasea-mcp",
"env": { "DATASEA_API_KEY": "dsea_your_key" }
}
}
}Remote MCP availability
The package also supports a self-hosted Streamable HTTP service with datasea-mcp --http as part of a configured DataSea deployment. It requires a public resource URL, an OAuth issuer, and a compatible DataSea gateway. Use the remote URL supplied by your deployment operator. On DataSea production, use local stdio or REST until DataSea publishes a hosted remote endpoint.
Tools
datasea_search,datasea_scrape,datasea_map,datasea_crawlsubmit jobs and spend credits.datasea_get_job,datasea_get_job_pages,datasea_cancel_job,datasea_get_usageread or cancel jobs and usage.datasea_doctoris non-billable: it checks that the API is reachable and that the configured key is accepted, usingGET /v1/usage(needsweb:usage:read).
Private artifacts and retention
Artifact descriptors contain authenticated /v1/artifacts/{artifactId} URLs, MIME type, size, SHA-256 checksum, and expiry. Storage is private and S3-compatible in production. Downloads re-check tenant ownership; expired/deleted objects return 410. Default retention is exposed by GET /v1/product and can vary by plan or approved override.
Verify a webhook signature
Pass the request headers (lower-case names, as in Node.js) and the exact raw bytes as a Buffer before any JSON parsing.
import crypto from "node:crypto";
export function verifyDataSeaWebhook(headers, rawBody, secret = process.env.DATASEA_WEBHOOK_SECRET) {
const timestamp = headers["datasea-webhook-timestamp"];
const signature = headers["datasea-webhook-signature"];
if (!secret || !Buffer.isBuffer(rawBody) || typeof timestamp !== "string" || !/^\d+$/.test(timestamp)) return false;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
if (typeof signature !== "string" || !/^v1=[a-f0-9]{64}$/.test(signature)) return false;
const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest();
return crypto.timingSafeEqual(expected, Buffer.from(signature.slice(3), "hex"));
}Delivery rules
- Register public HTTPS endpoints with
POST /v1/webhooks(webhooks:write), then pass the returnedidaswebhookIdwhen you start a Crawl. Webhooks are available for Crawl jobs. - URL/DNS/private-address policy is re-applied on every redirect and delivery.
- Verify
DataSea-Webhook-Timestamp(Unix seconds) is within your replay window, then verifyDataSea-Webhook-Signature: v1=<hex>, an HMAC-SHA256 oftimestamp + "." + rawBodywith your signing secret. - The body is
{"id", "type", "createdAt", "data": {"deliveryId", "jobId", "state"}}; fetch the job for results. Deduplicate byDataSea-Webhook-Id. Return any 2xx status only after durable acceptance. - DataSea retries with bounded backoff and abandons after six attempts; endpoints disable after sustained failures. The signing secret (
dsea_whsec_...) is returned once, in the create response.