datatoll-mcp 0.0.0-stage → 0.3.1
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 +115 -2
- package/bin/datatoll-mcp.mjs +367 -0
- package/package.json +53 -4
package/README.md
CHANGED
|
@@ -1,3 +1,116 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DataToll Commercial Intelligence · Official MCP Server (`datatoll-mcp`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://registry.modelcontextprotocol.io/v0/servers?search=app.datatoll/commercial-intel)
|
|
4
|
+
[](https://www.npmjs.com/package/datatoll-mcp)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
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
|
+
- **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`**.
|
|
12
|
+
- **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
|
+
---
|
|
15
|
+
|
|
16
|
+
## Available MCP Tools
|
|
17
|
+
|
|
18
|
+
| Tool Name | Data Source | Pricing | Max Items / Call | Validated Key Fields |
|
|
19
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
20
|
+
| `preview_datatoll_sample` | Shopify / Google Ads / ATS | **Free (`$0.00`)** | 3 items | Live sample matching full contract schema (zero auth) |
|
|
21
|
+
| `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
|
+
| `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
|
+
| `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` |
|
|
24
|
+
|
|
25
|
+
> All tools declare MCP `annotations: { "readOnlyHint": true, "destructiveHint": false }` and return both human-readable JSON and typed `structuredContent` matching `outputSchema`.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Quickstart
|
|
30
|
+
|
|
31
|
+
### Option 1: Remote Streamable HTTP (Zero Install — Cursor, Claude Code, VS Code, Windsurf)
|
|
32
|
+
|
|
33
|
+
If your MCP client supports remote Streamable HTTP, connect directly without local packages:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"datatoll": {
|
|
39
|
+
"type": "http",
|
|
40
|
+
"url": "https://datatoll.app/mcp"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Option 2: Stdio Bridge — Free Preview Mode (Claude Desktop & Stdio Clients)
|
|
47
|
+
|
|
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:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"datatoll": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "datatoll-mcp"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Option 3: Autonomous `x402` Auto-Pay Mode (Up to 100 Items / Call)
|
|
62
|
+
|
|
63
|
+
Install globally (so optional `viem` signing support is present) and attach a dedicated low-balance Base Mainnet wallet funded with `$1–$5 USDC` (EIP-3009 signatures are gasless — no ETH required):
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install -g datatoll-mcp
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"datatoll": {
|
|
73
|
+
"command": "datatoll-mcp",
|
|
74
|
+
"env": {
|
|
75
|
+
"DATATOLL_EVM_PRIVATE_KEY": "0xYOUR_DEDICATED_AGENT_WALLET_KEY",
|
|
76
|
+
"DATATOLL_MAX_USDC": "0.01"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Environment Variables & Safety Controls
|
|
86
|
+
|
|
87
|
+
| Variable | Default | Description |
|
|
88
|
+
| :--- | :--- | :--- |
|
|
89
|
+
| `DATATOLL_MCP_URL` | `https://datatoll.app/mcp` | Upstream Streamable HTTP MCP endpoint |
|
|
90
|
+
| `DATATOLL_EVM_PRIVATE_KEY` | *(unset)* | Optional dedicated Base Mainnet private key for gasless EIP-3009 USDC signing. Never transmitted over the network — only bounded `X-PAYMENT` headers are sent |
|
|
91
|
+
| `DATATOLL_MAX_USDC` | `0.01` | Hard client-side per-call ceiling in USDC (`0 < value <= 1.0`). Quotes exceeding this limit are rejected locally before signing |
|
|
92
|
+
|
|
93
|
+
### Verify Locally
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npx -y datatoll-mcp --self-test
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Bulk Exports (No Crypto Wallet Required)
|
|
102
|
+
|
|
103
|
+
Need 1,000+ rows on a recurring schedule or inside n8n / Make / Zapier? Run the same `SchemaGuard`-enforced extractors on Apify Store with a **`$0.00` start fee**:
|
|
104
|
+
|
|
105
|
+
- **Shopify Products, Prices & Inventory (`$0.50 / 1,000 items`)**: [`apify.com/tokenkite/shopify-intel`](https://apify.com/tokenkite/shopify-intel)
|
|
106
|
+
- **Google Ads Transparency Creatives (`$0.90 / 1,000 items`)**: [`apify.com/tokenkite/google-ads-intel`](https://apify.com/tokenkite/google-ads-intel)
|
|
107
|
+
- **Multi-ATS Job Postings Radar (`$1.40 / 1,000 items`)**: [`apify.com/tokenkite/ats-jobs-radar`](https://apify.com/tokenkite/ats-jobs-radar)
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Machine Discovery & Protocol Endpoints
|
|
112
|
+
|
|
113
|
+
- **Gateway & Pricing Docs**: [`https://datatoll.app/`](https://datatoll.app/)
|
|
114
|
+
- **Live Contract Catalog (`JSON`)**: [`https://datatoll.app/v1/catalog`](https://datatoll.app/v1/catalog)
|
|
115
|
+
- **x402 / Bazaar Discovery Manifest**: [`https://datatoll.app/.well-known/x402`](https://datatoll.app/.well-known/x402)
|
|
116
|
+
- **LLM Context (`llms.txt`)**: [`https://datatoll.app/llms.txt`](https://datatoll.app/llms.txt)
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* DataToll MCP Stdio <-> Streamable HTTP Bridge (`datatoll-mcp`)
|
|
4
|
+
*
|
|
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).
|
|
9
|
+
* - Auto-pay x402 mode: set `DATATOLL_EVM_PRIVATE_KEY=0x...` to sign EIP-3009
|
|
10
|
+
* Base Mainnet USDC `TransferWithAuthorization` quotes up to `DATATOLL_MAX_USDC`
|
|
11
|
+
* (default `0.01` USDC per call).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { randomBytes } from 'node:crypto';
|
|
15
|
+
import { createServer } from 'node:http';
|
|
16
|
+
import { createInterface } from 'node:readline';
|
|
17
|
+
|
|
18
|
+
const BASE_MAINNET_USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
|
|
19
|
+
const DEFAULT_MCP_URL = 'https://datatoll.app/mcp';
|
|
20
|
+
const DEFAULT_MAX_USDC = '0.01';
|
|
21
|
+
const PACKAGE_VERSION = '0.3.1';
|
|
22
|
+
|
|
23
|
+
function parseUsdcToAtomic(usdcStr) {
|
|
24
|
+
const num = Number(usdcStr);
|
|
25
|
+
if (!Number.isFinite(num) || num <= 0 || num > 1) {
|
|
26
|
+
throw new Error(`Invalid DATATOLL_MAX_USDC value: ${usdcStr} (expected 0 < value <= 1.0)`);
|
|
27
|
+
}
|
|
28
|
+
return BigInt(Math.round(num * 1_000_000));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function formatGuidanceFrom402(body) {
|
|
32
|
+
const req = Array.isArray(body?.accepts) ? body.accepts[0] : null;
|
|
33
|
+
const amountUsdc = req?.maxAmountRequired
|
|
34
|
+
? (Number(req.maxAmountRequired) / 1_000_000).toFixed(3)
|
|
35
|
+
: '0.005-0.008';
|
|
36
|
+
const resource = req?.resource || 'https://datatoll.app/v1/catalog';
|
|
37
|
+
const slug = resource.split('/').pop() || '';
|
|
38
|
+
const apifyUrl = slug
|
|
39
|
+
? `https://apify.com/tokenkite/${slug}`
|
|
40
|
+
: 'https://apify.com/tokenkite';
|
|
41
|
+
|
|
42
|
+
return JSON.stringify(
|
|
43
|
+
{
|
|
44
|
+
error: 'payment_required',
|
|
45
|
+
charged: false,
|
|
46
|
+
quote_usdc: amountUsdc,
|
|
47
|
+
resource,
|
|
48
|
+
next_steps: {
|
|
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).',
|
|
51
|
+
auto_x402_wallet:
|
|
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
|
+
bulk_apify_store: `For no-wallet bulk exports ($0 start fee), run on Apify Store: ${apifyUrl}`,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
null,
|
|
57
|
+
2,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function signX402Requirement(req, privateKey, maxAtomic) {
|
|
62
|
+
if (!req || req.scheme !== 'exact' || req.network !== 'base') {
|
|
63
|
+
throw new Error(`Unsupported x402 scheme/network: ${req?.scheme}/${req?.network}`);
|
|
64
|
+
}
|
|
65
|
+
if (String(req.asset || '').toLowerCase() !== BASE_MAINNET_USDC.toLowerCase()) {
|
|
66
|
+
throw new Error(`Refusing non-USDC asset: ${req?.asset}`);
|
|
67
|
+
}
|
|
68
|
+
const value = BigInt(String(req.maxAmountRequired || '0'));
|
|
69
|
+
if (value <= 0n || value > maxAtomic) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
`Quote ${value} atomic USDC exceeds safety cap ${maxAtomic} atomic USDC`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
let privateKeyToAccount;
|
|
75
|
+
try {
|
|
76
|
+
({ privateKeyToAccount } = await import('viem/accounts'));
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error(
|
|
79
|
+
'Optional dependency `viem` is required for DATATOLL_EVM_PRIVATE_KEY signing (`npm install -g datatoll-mcp`).',
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const normalizedKey = privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`;
|
|
83
|
+
const account = privateKeyToAccount(normalizedKey);
|
|
84
|
+
const nowSec = BigInt(Math.floor(Date.now() / 1000));
|
|
85
|
+
const validAfter = nowSec - 60n;
|
|
86
|
+
const timeoutSec = BigInt(Math.max(30, Number(req.maxTimeoutSeconds || 60)));
|
|
87
|
+
const validBefore = nowSec + timeoutSec;
|
|
88
|
+
const nonce = `0x${randomBytes(32).toString('hex')}`;
|
|
89
|
+
|
|
90
|
+
const signature = await account.signTypedData({
|
|
91
|
+
domain: {
|
|
92
|
+
name: req.extra?.name || 'USD Coin',
|
|
93
|
+
version: req.extra?.version || '2',
|
|
94
|
+
chainId: 8453,
|
|
95
|
+
verifyingContract: BASE_MAINNET_USDC,
|
|
96
|
+
},
|
|
97
|
+
types: {
|
|
98
|
+
TransferWithAuthorization: [
|
|
99
|
+
{ name: 'from', type: 'address' },
|
|
100
|
+
{ name: 'to', type: 'address' },
|
|
101
|
+
{ name: 'value', type: 'uint256' },
|
|
102
|
+
{ name: 'validAfter', type: 'uint256' },
|
|
103
|
+
{ name: 'validBefore', type: 'uint256' },
|
|
104
|
+
{ name: 'nonce', type: 'bytes32' },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
primaryType: 'TransferWithAuthorization',
|
|
108
|
+
message: {
|
|
109
|
+
from: account.address,
|
|
110
|
+
to: req.payTo,
|
|
111
|
+
value,
|
|
112
|
+
validAfter,
|
|
113
|
+
validBefore,
|
|
114
|
+
nonce,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const payment = {
|
|
119
|
+
x402Version: 1,
|
|
120
|
+
scheme: 'exact',
|
|
121
|
+
network: 'base',
|
|
122
|
+
resource: req.resource,
|
|
123
|
+
payload: {
|
|
124
|
+
signature,
|
|
125
|
+
authorization: {
|
|
126
|
+
from: account.address,
|
|
127
|
+
to: req.payTo,
|
|
128
|
+
value: value.toString(),
|
|
129
|
+
validAfter: validAfter.toString(),
|
|
130
|
+
validBefore: validBefore.toString(),
|
|
131
|
+
nonce,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
return Buffer.from(JSON.stringify(payment), 'utf8').toString('base64');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export async function forwardRpcMessage(msg, options = {}) {
|
|
139
|
+
const endpoint = options.endpoint || process.env.DATATOLL_MCP_URL || DEFAULT_MCP_URL;
|
|
140
|
+
const privateKey = (options.privateKey ?? process.env.DATATOLL_EVM_PRIVATE_KEY ?? '').trim();
|
|
141
|
+
const maxAtomic = parseUsdcToAtomic(
|
|
142
|
+
options.maxUsdc || process.env.DATATOLL_MAX_USDC || DEFAULT_MAX_USDC,
|
|
143
|
+
);
|
|
144
|
+
const signFn = options.signFn || signX402Requirement;
|
|
145
|
+
|
|
146
|
+
const postJson = async (extraHeaders = {}) =>
|
|
147
|
+
fetch(endpoint, {
|
|
148
|
+
method: 'POST',
|
|
149
|
+
headers: {
|
|
150
|
+
'Content-Type': 'application/json',
|
|
151
|
+
Accept: 'application/json',
|
|
152
|
+
...extraHeaders,
|
|
153
|
+
},
|
|
154
|
+
body: JSON.stringify(msg),
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
let resp = await postJson();
|
|
158
|
+
if (resp.status === 202 || !('id' in msg)) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (resp.status === 402) {
|
|
163
|
+
const quoteBody = await resp.json().catch(() => ({}));
|
|
164
|
+
if (!privateKey) {
|
|
165
|
+
return {
|
|
166
|
+
jsonrpc: '2.0',
|
|
167
|
+
id: msg.id,
|
|
168
|
+
result: {
|
|
169
|
+
isError: true,
|
|
170
|
+
content: [{ type: 'text', text: formatGuidanceFrom402(quoteBody) }],
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const req = Array.isArray(quoteBody.accepts) ? quoteBody.accepts[0] : null;
|
|
176
|
+
const paymentHeader = await signFn(req, privateKey, maxAtomic);
|
|
177
|
+
resp = await postJson({ 'X-PAYMENT': paymentHeader });
|
|
178
|
+
} catch (err) {
|
|
179
|
+
return {
|
|
180
|
+
jsonrpc: '2.0',
|
|
181
|
+
id: msg.id,
|
|
182
|
+
result: {
|
|
183
|
+
isError: true,
|
|
184
|
+
content: [
|
|
185
|
+
{
|
|
186
|
+
type: 'text',
|
|
187
|
+
text: JSON.stringify({
|
|
188
|
+
error: 'x402_client_signing_refused',
|
|
189
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
190
|
+
}),
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const data = await resp.json().catch(() => null);
|
|
199
|
+
if (data && typeof data === 'object' && data.jsonrpc === '2.0') {
|
|
200
|
+
return data;
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
jsonrpc: '2.0',
|
|
204
|
+
id: msg.id,
|
|
205
|
+
error: {
|
|
206
|
+
code: -32603,
|
|
207
|
+
message: `Upstream MCP HTTP ${resp.status}`,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
async function runSelfTest() {
|
|
213
|
+
const assert = (cond, label) => {
|
|
214
|
+
if (!cond) throw new Error(`datatoll-mcp self-test failed: ${label}`);
|
|
215
|
+
};
|
|
216
|
+
let calls = 0;
|
|
217
|
+
const server = createServer((req, res) => {
|
|
218
|
+
let raw = '';
|
|
219
|
+
req.on('data', (c) => (raw += c));
|
|
220
|
+
req.on('end', () => {
|
|
221
|
+
calls += 1;
|
|
222
|
+
const msg = JSON.parse(raw);
|
|
223
|
+
if (msg.method === 'ping') {
|
|
224
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
225
|
+
res.end(JSON.stringify({ jsonrpc: '2.0', id: msg.id, result: {} }));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (!req.headers['x-payment']) {
|
|
229
|
+
const amount = msg.params?.arguments?.expensive ? '99000' : '5000';
|
|
230
|
+
res.writeHead(402, { 'Content-Type': 'application/json' });
|
|
231
|
+
res.end(
|
|
232
|
+
JSON.stringify({
|
|
233
|
+
x402Version: 1,
|
|
234
|
+
accepts: [
|
|
235
|
+
{
|
|
236
|
+
scheme: 'exact',
|
|
237
|
+
network: 'base',
|
|
238
|
+
maxAmountRequired: amount,
|
|
239
|
+
resource: 'https://datatoll.app/v1/extract/shopify-intel',
|
|
240
|
+
payTo: '0xAA8cf6a43994E976f1Dbed70D3Bf60371FE93A40',
|
|
241
|
+
asset: BASE_MAINNET_USDC,
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
}),
|
|
245
|
+
);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
249
|
+
res.end(
|
|
250
|
+
JSON.stringify({
|
|
251
|
+
jsonrpc: '2.0',
|
|
252
|
+
id: msg.id,
|
|
253
|
+
result: { isError: false, content: [{ type: 'text', text: '{"ok":true}' }] },
|
|
254
|
+
}),
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
await new Promise((r) => server.listen(0, '127.0.0.1', r));
|
|
260
|
+
const port = server.address().port;
|
|
261
|
+
const endpoint = `http://127.0.0.1:${port}/mcp`;
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
const ping = await forwardRpcMessage({ jsonrpc: '2.0', id: 1, method: 'ping' }, { endpoint });
|
|
265
|
+
assert(ping.result && ping.id === 1, 'ping forwarded');
|
|
266
|
+
|
|
267
|
+
const unpaid = await forwardRpcMessage(
|
|
268
|
+
{ jsonrpc: '2.0', id: 2, method: 'tools/call', params: { name: 'extract_shopify_intel' } },
|
|
269
|
+
{ endpoint, privateKey: '' },
|
|
270
|
+
);
|
|
271
|
+
assert(unpaid.result?.isError === true, 'unpaid 402 translated to CallToolResult');
|
|
272
|
+
assert(
|
|
273
|
+
unpaid.result.content[0].text.includes('preview_datatoll_sample'),
|
|
274
|
+
'guidance points to free preview tool',
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
const capped = await forwardRpcMessage(
|
|
278
|
+
{
|
|
279
|
+
jsonrpc: '2.0',
|
|
280
|
+
id: 3,
|
|
281
|
+
method: 'tools/call',
|
|
282
|
+
params: { name: 'extract_shopify_intel', arguments: { expensive: true } },
|
|
283
|
+
},
|
|
284
|
+
{ endpoint, privateKey: '0x' + '11'.repeat(32), maxUsdc: '0.01' },
|
|
285
|
+
);
|
|
286
|
+
assert(
|
|
287
|
+
capped.result?.isError === true &&
|
|
288
|
+
capped.result.content[0].text.includes('exceeds safety cap'),
|
|
289
|
+
'safety cap blocks quotes above $0.01 USDC',
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
const signed = await forwardRpcMessage(
|
|
293
|
+
{ jsonrpc: '2.0', id: 4, method: 'tools/call', params: { name: 'extract_shopify_intel' } },
|
|
294
|
+
{
|
|
295
|
+
endpoint,
|
|
296
|
+
privateKey: '0x' + '22'.repeat(32),
|
|
297
|
+
signFn: async () => Buffer.from('{"ok":1}').toString('base64'),
|
|
298
|
+
},
|
|
299
|
+
);
|
|
300
|
+
assert(signed.result?.isError === false && calls >= 5, 'paid retry succeeds');
|
|
301
|
+
console.log('DataToll datatoll-mcp.mjs self-test PASS (4/4)');
|
|
302
|
+
} finally {
|
|
303
|
+
server.close();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async function main() {
|
|
308
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
309
|
+
console.log(PACKAGE_VERSION);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
313
|
+
console.log(
|
|
314
|
+
[
|
|
315
|
+
`datatoll-mcp v${PACKAGE_VERSION} — Official MCP stdio bridge for DataToll Commercial Intelligence`,
|
|
316
|
+
'',
|
|
317
|
+
'Usage:',
|
|
318
|
+
' npx -y datatoll-mcp Start MCP JSON-RPC 2.0 stdio bridge -> https://datatoll.app/mcp',
|
|
319
|
+
' npx -y datatoll-mcp --self-test Run offline protocol & x402 safety-cap self-tests',
|
|
320
|
+
' npx -y datatoll-mcp --version Print package version',
|
|
321
|
+
'',
|
|
322
|
+
'Environment Variables:',
|
|
323
|
+
' DATATOLL_MCP_URL Override upstream MCP endpoint (default: https://datatoll.app/mcp)',
|
|
324
|
+
' DATATOLL_EVM_PRIVATE_KEY Optional Base Mainnet key to auto-sign EIP-3009 USDC x402 quotes',
|
|
325
|
+
' DATATOLL_MAX_USDC Local per-call USDC ceiling when auto-signing (default: 0.01)',
|
|
326
|
+
].join('\n'),
|
|
327
|
+
);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (process.argv.includes('--self-test')) {
|
|
331
|
+
await runSelfTest();
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const rl = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
335
|
+
for await (const line of rl) {
|
|
336
|
+
const trimmed = line.trim();
|
|
337
|
+
if (!trimmed) continue;
|
|
338
|
+
let msg;
|
|
339
|
+
try {
|
|
340
|
+
msg = JSON.parse(trimmed);
|
|
341
|
+
} catch {
|
|
342
|
+
process.stdout.write(
|
|
343
|
+
JSON.stringify({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } }) +
|
|
344
|
+
'\n',
|
|
345
|
+
);
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
try {
|
|
349
|
+
const reply = await forwardRpcMessage(msg);
|
|
350
|
+
if (reply !== null) {
|
|
351
|
+
process.stdout.write(JSON.stringify(reply) + '\n');
|
|
352
|
+
}
|
|
353
|
+
} catch (err) {
|
|
354
|
+
if ('id' in msg) {
|
|
355
|
+
process.stdout.write(
|
|
356
|
+
JSON.stringify({
|
|
357
|
+
jsonrpc: '2.0',
|
|
358
|
+
id: msg.id,
|
|
359
|
+
error: { code: -32603, message: err instanceof Error ? err.message : String(err) },
|
|
360
|
+
}) + '\n',
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
await main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datatoll-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"mcpName": "app.datatoll/commercial-intel",
|
|
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
|
+
"author": "TokenKite Labs (https://datatoll.app)",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"bin": {
|
|
10
|
+
"datatoll-mcp": "bin/datatoll-mcp.mjs"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20.0.0"
|
|
18
|
+
},
|
|
19
|
+
"optionalDependencies": {
|
|
20
|
+
"viem": "^2.21.0"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "node ./bin/datatoll-mcp.mjs --self-test"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/ByKite/datatoll-mcp.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/ByKite/datatoll-mcp/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://datatoll.app/",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"mcp",
|
|
35
|
+
"mcp-server",
|
|
36
|
+
"model-context-protocol",
|
|
37
|
+
"claude-desktop",
|
|
38
|
+
"cursor",
|
|
39
|
+
"windsurf",
|
|
40
|
+
"x402",
|
|
41
|
+
"coinbase-x402",
|
|
42
|
+
"base",
|
|
43
|
+
"usdc",
|
|
44
|
+
"google-ads",
|
|
45
|
+
"ad-intelligence",
|
|
46
|
+
"shopify",
|
|
47
|
+
"ecommerce",
|
|
48
|
+
"ats-jobs",
|
|
49
|
+
"greenhouse",
|
|
50
|
+
"ashby",
|
|
51
|
+
"lever",
|
|
52
|
+
"smartrecruiters",
|
|
53
|
+
"commercial-intelligence"
|
|
54
|
+
]
|
|
55
|
+
}
|