datatoll-mcp 0.3.1 → 0.3.2

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 CHANGED
@@ -1,14 +1,15 @@
1
1
  # DataToll Commercial Intelligence · Official MCP Server (`datatoll-mcp`)
2
2
 
3
3
  [![MCP Registry](https://img.shields.io/badge/MCP_Registry-app.datatoll%2Fcommercial--intel-0f766e)](https://registry.modelcontextprotocol.io/v0/servers?search=app.datatoll/commercial-intel)
4
+ [![Glama MCP Score](https://glama.ai/mcp/connectors/app.datatoll/commercial-intel/badges/score.svg)](https://glama.ai/mcp/connectors/app.datatoll/commercial-intel)
4
5
  [![npm version](https://img.shields.io/npm/v/datatoll-mcp?color=2563eb)](https://www.npmjs.com/package/datatoll-mcp)
5
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-339933)](https://nodejs.org/)
6
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-slate)](https://opensource.org/licenses/MIT)
7
8
 
8
9
  Contract-validated commercial intelligence tools for AI agents and MCP clients: query live public **Google Ads Transparency creatives**, **4-in-1 ATS job boards (Ashby, Greenhouse, Lever & SmartRecruiters)**, and **Shopify product catalogs, variants & stock** in seconds — without managing headless browsers or proxy pools.
9
10
 
10
- - **Zero-Config Free Live Preview (`$0.00`)**: Run `npx -y datatoll-mcp` with **no API key and no crypto wallet** to call `preview_datatoll_sample` (returns up to 3 real-time, `SchemaGuard`-validated items per query).
11
- - **Zero-Dirty-Billing Guarantee**: Every request executes a strict one-way pipeline (`Verify -> Extract -> SchemaGuard Validate -> Persist -> Settle -> Deliver`). Empty results, upstream anti-bot blocks, and layout drift cost **`$0.00`**.
11
+ - **Free live preview**: Run `npx -y datatoll-mcp` without a wallet or API key. Call any `extract_*` tool with its usual selectors to get up to 5 live, `SchemaGuard`-validated items for free.
12
+ - **Billing**: Paid requests follow `Verify -> Extract -> SchemaGuard Validate -> Persist -> Settle -> Deliver`. Empty results, upstream anti-bot blocks, and layout drift cost **`$0.00`**.
12
13
  - **Optional Base Mainnet `x402` Auto-Signing**: Configure a dedicated Base USDC key (`DATATOLL_EVM_PRIVATE_KEY`) to sign gasless EIP-3009 `TransferWithAuthorization` quotes locally (`$0.005–$0.008 USDC/call`, up to 100 items), protected by a hard client-side per-call cap (`DATATOLL_MAX_USDC`, default `$0.01`).
13
14
 
14
15
  ---
@@ -17,7 +18,7 @@ Contract-validated commercial intelligence tools for AI agents and MCP clients:
17
18
 
18
19
  | Tool Name | Data Source | Pricing | Max Items / Call | Validated Key Fields |
19
20
  | :--- | :--- | :--- | :--- | :--- |
20
- | `preview_datatoll_sample` | Shopify / Google Ads / ATS | **Free (`$0.00`)** | 3 items | Live sample matching full contract schema (zero auth) |
21
+ | `preview_datatoll_sample` | Shopify / Google Ads / ATS | **Free (`$0.00`)** | 5 items | Live sample matching full contract schema (zero auth) |
21
22
  | `extract_shopify_intel` | Public Shopify Storefronts | **`$0.005 USDC`** (`x402`) | 100 products | `product_id`, `title`, `price_min`, `discount_pct`, `in_stock`, `variant_count`, `product_url` |
22
23
  | `extract_google_ads_intel` | Google Ads Transparency RPC | **`$0.006 USDC`** (`x402`) | 100 creatives | `creative_id`, `advertiser_name`, `ad_format`, `days_active`, `first_shown`, `last_shown`, `transparency_url` |
23
24
  | `extract_ats_jobs_radar` | Ashby, Greenhouse, Lever, SmartRecruiters | **`$0.008 USDC`** (`x402`) | 100 postings | `job_id`, `ats_provider`, `company_slug`, `title`, `department`, `location`, `is_remote`, `salary_summary`, `job_url` |
@@ -30,22 +31,24 @@ Contract-validated commercial intelligence tools for AI agents and MCP clients:
30
31
 
31
32
  ### Option 1: Remote Streamable HTTP (Zero Install — Cursor, Claude Code, VS Code, Windsurf)
32
33
 
33
- If your MCP client supports remote Streamable HTTP, connect directly without local packages:
34
+ If your MCP client supports remote Streamable HTTP, connect to `/mcp/free` for automatic previews on unsigned `extract_*` calls:
34
35
 
35
36
  ```json
36
37
  {
37
38
  "mcpServers": {
38
39
  "datatoll": {
39
40
  "type": "http",
40
- "url": "https://datatoll.app/mcp"
41
+ "url": "https://datatoll.app/mcp/free"
41
42
  }
42
43
  }
43
44
  }
44
45
  ```
45
46
 
47
+ The standard `https://datatoll.app/mcp` endpoint returns an HTTP 402 quote for unsigned `extract_*` calls. Both endpoints accept x402 authorizations for full batches.
48
+
46
49
  ### Option 2: Stdio Bridge — Free Preview Mode (Claude Desktop & Stdio Clients)
47
50
 
48
- Works immediately with zero environment variables. Unpaid `402` responses on full `extract_*` tools are cleanly translated into structured JSON-RPC tool guidance instead of transport errors:
51
+ No environment variables are required. When an `extract_*` call receives an HTTP 402 quote, the bridge calls `preview_datatoll_sample` with the same selectors and returns up to 5 live items. Both preview modes share the same daily quota. When it runs out, the tool returns `preview_rate_limit_exceeded` with links for paid access.
49
52
 
50
53
  ```json
51
54
  {
@@ -3,14 +3,14 @@
3
3
  * DataToll MCP Stdio <-> Streamable HTTP Bridge (`datatoll-mcp`)
4
4
  *
5
5
  * - Zero-config mode: forwards JSON-RPC 2.0 over stdio to https://datatoll.app/mcp
6
- * (use `preview_datatoll_sample` for free 3-item live previews; translates unpaid
7
- * HTTP 402 responses on `extract_*` into actionable JSON-RPC tool results instead
8
- * of crashing desktop MCP clients).
6
+ * and retries unpaid `extract_*` calls with `preview_datatoll_sample` for up to
7
+ * 5 free, validated items.
9
8
  * - Auto-pay x402 mode: set `DATATOLL_EVM_PRIVATE_KEY=0x...` to sign EIP-3009
10
9
  * Base Mainnet USDC `TransferWithAuthorization` quotes up to `DATATOLL_MAX_USDC`
11
10
  * (default `0.01` USDC per call).
12
11
  */
13
12
 
13
+ import { deepStrictEqual } from 'node:assert';
14
14
  import { randomBytes } from 'node:crypto';
15
15
  import { createServer } from 'node:http';
16
16
  import { createInterface } from 'node:readline';
@@ -18,7 +18,7 @@ import { createInterface } from 'node:readline';
18
18
  const BASE_MAINNET_USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
19
19
  const DEFAULT_MCP_URL = 'https://datatoll.app/mcp';
20
20
  const DEFAULT_MAX_USDC = '0.01';
21
- const PACKAGE_VERSION = '0.3.1';
21
+ const PACKAGE_VERSION = '0.3.2';
22
22
 
23
23
  function parseUsdcToAtomic(usdcStr) {
24
24
  const num = Number(usdcStr);
@@ -47,7 +47,7 @@ function formatGuidanceFrom402(body) {
47
47
  resource,
48
48
  next_steps: {
49
49
  free_preview:
50
- 'Call `preview_datatoll_sample` right now for a free live preview (up to 3 validated items, $0 cost, no wallet needed).',
50
+ 'Call `preview_datatoll_sample` right now for a free live preview (up to 5 validated items, $0 cost, no wallet needed).',
51
51
  auto_x402_wallet:
52
52
  'Set env `DATATOLL_EVM_PRIVATE_KEY` (Base Mainnet wallet funded with $1 USDC) in your MCP server config to auto-sign single calls up to 100 items.',
53
53
  bulk_apify_store: `For no-wallet bulk exports ($0 start fee), run on Apify Store: ${apifyUrl}`,
@@ -143,7 +143,7 @@ export async function forwardRpcMessage(msg, options = {}) {
143
143
  );
144
144
  const signFn = options.signFn || signX402Requirement;
145
145
 
146
- const postJson = async (extraHeaders = {}) =>
146
+ const postJson = async (message, extraHeaders = {}) =>
147
147
  fetch(endpoint, {
148
148
  method: 'POST',
149
149
  headers: {
@@ -151,10 +151,10 @@ export async function forwardRpcMessage(msg, options = {}) {
151
151
  Accept: 'application/json',
152
152
  ...extraHeaders,
153
153
  },
154
- body: JSON.stringify(msg),
154
+ body: JSON.stringify(message),
155
155
  });
156
156
 
157
- let resp = await postJson();
157
+ let resp = await postJson(msg);
158
158
  if (resp.status === 202 || !('id' in msg)) {
159
159
  return null;
160
160
  }
@@ -162,6 +162,28 @@ export async function forwardRpcMessage(msg, options = {}) {
162
162
  if (resp.status === 402) {
163
163
  const quoteBody = await resp.json().catch(() => ({}));
164
164
  if (!privateKey) {
165
+ const { name, arguments: args } = msg.params ?? {};
166
+ if (msg.method === 'tools/call' && typeof name === 'string' && name.startsWith('extract_')
167
+ && args && typeof args === 'object' && !Array.isArray(args)) {
168
+ const previewArgs = {
169
+ source: name.slice('extract_'.length),
170
+ domain: args.domain ?? args.store_domain,
171
+ advertiser_id: args.advertiser_id,
172
+ provider: args.provider,
173
+ company: args.company ?? args.company_slug,
174
+ keyword: args.keyword,
175
+ remote_only: args.remote_only,
176
+ collection: args.collection ?? args.collection_handle,
177
+ };
178
+ const previewResp = await postJson({
179
+ jsonrpc: '2.0',
180
+ id: msg.id,
181
+ method: 'tools/call',
182
+ params: { name: 'preview_datatoll_sample', arguments: previewArgs },
183
+ }).catch(() => null);
184
+ const previewData = await previewResp?.json().catch(() => null);
185
+ if (previewResp?.status === 200 && previewData?.jsonrpc === '2.0') return previewData;
186
+ }
165
187
  return {
166
188
  jsonrpc: '2.0',
167
189
  id: msg.id,
@@ -174,7 +196,7 @@ export async function forwardRpcMessage(msg, options = {}) {
174
196
  try {
175
197
  const req = Array.isArray(quoteBody.accepts) ? quoteBody.accepts[0] : null;
176
198
  const paymentHeader = await signFn(req, privateKey, maxAtomic);
177
- resp = await postJson({ 'X-PAYMENT': paymentHeader });
199
+ resp = await postJson(msg, { 'X-PAYMENT': paymentHeader });
178
200
  } catch (err) {
179
201
  return {
180
202
  jsonrpc: '2.0',
@@ -213,18 +235,29 @@ async function runSelfTest() {
213
235
  const assert = (cond, label) => {
214
236
  if (!cond) throw new Error(`datatoll-mcp self-test failed: ${label}`);
215
237
  };
216
- let calls = 0;
238
+ const calls = [];
239
+ const sample = { preview: true, charged: false, items: [{ product_id: 'sample' }] };
217
240
  const server = createServer((req, res) => {
218
241
  let raw = '';
219
242
  req.on('data', (c) => (raw += c));
220
243
  req.on('end', () => {
221
- calls += 1;
222
244
  const msg = JSON.parse(raw);
245
+ calls.push(msg);
223
246
  if (msg.method === 'ping') {
224
247
  res.writeHead(200, { 'Content-Type': 'application/json' });
225
248
  res.end(JSON.stringify({ jsonrpc: '2.0', id: msg.id, result: {} }));
226
249
  return;
227
250
  }
251
+ if (msg.params?.name === 'preview_datatoll_sample') {
252
+ res.writeHead(200, { 'Content-Type': 'application/json' });
253
+ res.end(JSON.stringify({
254
+ jsonrpc: '2.0', id: msg.id, result: {
255
+ isError: false, structuredContent: sample,
256
+ content: [{ type: 'text', text: JSON.stringify(sample) }],
257
+ },
258
+ }));
259
+ return;
260
+ }
228
261
  if (!req.headers['x-payment']) {
229
262
  const amount = msg.params?.arguments?.expensive ? '99000' : '5000';
230
263
  res.writeHead(402, { 'Content-Type': 'application/json' });
@@ -264,6 +297,22 @@ async function runSelfTest() {
264
297
  const ping = await forwardRpcMessage({ jsonrpc: '2.0', id: 1, method: 'ping' }, { endpoint });
265
298
  assert(ping.result && ping.id === 1, 'ping forwarded');
266
299
 
300
+ const extract = {
301
+ jsonrpc: '2.0', id: 'preview', method: 'tools/call',
302
+ params: {
303
+ name: 'extract_shopify_intel', arguments: { domain: 'www.beardbrand.com', max_products: 25 },
304
+ },
305
+ };
306
+ const preview = await forwardRpcMessage(extract, { endpoint, privateKey: '' });
307
+ deepStrictEqual(calls.slice(1), [extract, {
308
+ jsonrpc: '2.0', id: extract.id, method: 'tools/call', params: {
309
+ name: 'preview_datatoll_sample',
310
+ arguments: { source: 'shopify_intel', domain: 'www.beardbrand.com' },
311
+ },
312
+ }]);
313
+ assert(preview.id === extract.id && preview.result?.isError === false, 'free preview returned');
314
+ deepStrictEqual(preview.result.structuredContent, sample);
315
+
267
316
  const unpaid = await forwardRpcMessage(
268
317
  { jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: 'extract_shopify_intel' } },
269
318
  { endpoint, privateKey: '' },
@@ -297,8 +346,8 @@ async function runSelfTest() {
297
346
  signFn: async () => Buffer.from('{"ok":1}').toString('base64'),
298
347
  },
299
348
  );
300
- assert(signed.result?.isError === false && calls >= 5, 'paid retry succeeds');
301
- console.log('DataToll datatoll-mcp.mjs self-test PASS (4/4)');
349
+ assert(signed.result?.isError === false && calls.length === 7, 'paid retry succeeds');
350
+ console.log('DataToll datatoll-mcp.mjs self-test PASS (5/5)');
302
351
  } finally {
303
352
  server.close();
304
353
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datatoll-mcp",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "mcpName": "app.datatoll/commercial-intel",
5
5
  "description": "Official MCP stdio & x402 bridge for DataToll Commercial Intelligence — contract-validated Google Ads Transparency, multi-ATS jobs & Shopify pricing/stock with free live previews.",
6
6
  "author": "TokenKite Labs (https://datatoll.app)",