@predge/whale-data-mcp 0.1.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/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/config.js +37 -0
- package/dist/config.js.map +1 -0
- package/dist/dev-list-tools.js +39 -0
- package/dist/dev-list-tools.js.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/pay.js +100 -0
- package/dist/pay.js.map +1 -0
- package/dist/server.js +113 -0
- package/dist/server.js.map +1 -0
- package/package.json +63 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Predge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# @predge/whale-data-mcp
|
|
2
|
+
|
|
3
|
+
MCP server that exposes the **Predge Whale Data** x402 API (Polymarket whale
|
|
4
|
+
trades + smart-money signals) as tools. Payment is handled **under the hood**:
|
|
5
|
+
each paid tool call signs a USDC micropayment via an x402 client — the agent
|
|
6
|
+
just calls the tool and gets data back. You supply a funded buyer key.
|
|
7
|
+
|
|
8
|
+
> **Defaults to Base mainnet** (the live Predge API is mainnet-only). Paid tools
|
|
9
|
+
> spend **real USDC** — typically $0.005–$0.03/call, hard-capped at
|
|
10
|
+
> `MAX_PRICE_USD` ($0.05 by default) *before* any money moves. Use a dedicated,
|
|
11
|
+
> low-balance buyer wallet.
|
|
12
|
+
|
|
13
|
+
## Install (one command)
|
|
14
|
+
|
|
15
|
+
**Claude Code:**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add predge-whale-data \
|
|
19
|
+
-e BUYER_PRIVATE_KEY=0xYOUR_FUNDED_BASE_MAINNET_KEY \
|
|
20
|
+
-e X402_NETWORK=base \
|
|
21
|
+
-- npx -y @predge/whale-data-mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Claude Desktop / Cursor / any MCP client** — add to the client's MCP config:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"mcpServers": {
|
|
29
|
+
"predge-whale-data": {
|
|
30
|
+
"command": "npx",
|
|
31
|
+
"args": ["-y", "@predge/whale-data-mcp"],
|
|
32
|
+
"env": {
|
|
33
|
+
"BUYER_PRIVATE_KEY": "0xYOUR_FUNDED_BASE_MAINNET_KEY",
|
|
34
|
+
"X402_NETWORK": "base"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
That's it — the agent gets **8 tools** (7 paid routes + 1 free discovery tool).
|
|
42
|
+
No API keys, no account; the buyer key pays USDC per call on Base. Fund it with a
|
|
43
|
+
few dollars of USDC (the facilitator pays gas, so no ETH needed).
|
|
44
|
+
|
|
45
|
+
## Tools
|
|
46
|
+
|
|
47
|
+
| Tool | Price | Returns |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `predge_list_endpoints` | **free** | API description + every endpoint with its price/schema (call first) |
|
|
50
|
+
| `predge_whales_latest` | ~$0.005 | Latest whale trades ≥$10k (15-min delay). Param: `limit` (1-100) |
|
|
51
|
+
| `predge_whale_market` | ~$0.01 | 7-day whale activity for one market. Param: `condition_id` |
|
|
52
|
+
| `predge_signals_daily` | ~$0.02 | 24h digest: top markets, net flow, largest bets |
|
|
53
|
+
| `predge_wallets_leaderboard` | ~$0.01 | Wallets by realized win rate. Params: `window` (7d\|30d), `limit` |
|
|
54
|
+
| `predge_wallet_profile` | ~$0.01 | Wallet score, win rates, categories, last 20 trades. Param: `address` |
|
|
55
|
+
| `predge_markets_movers` | ~$0.005 | Largest YES-price moves. Param: `window` (1h\|6h\|24h) |
|
|
56
|
+
| `predge_signals_consensus` | ~$0.03 | Smart-money (score>70) net flow + direction per market |
|
|
57
|
+
|
|
58
|
+
Every paid result includes a note with the on-chain settle tx.
|
|
59
|
+
|
|
60
|
+
## Config (env)
|
|
61
|
+
|
|
62
|
+
| Var | Default | Notes |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| `BUYER_PRIVATE_KEY` | — | **Required for paid tools.** Funded buyer key. The free `predge_list_endpoints` tool works without it. |
|
|
65
|
+
| `X402_NETWORK` | `base` | `base` = mainnet (real USDC). `base-sepolia` only works against a testnet deployment (see `PREDGE_BASE_URL`). |
|
|
66
|
+
| `PREDGE_BASE_URL` | prod API | `https://x402-api-production-266e.up.railway.app`. Override to point at another deployment (e.g. a testnet instance). |
|
|
67
|
+
| `MAX_PRICE_USD` | `0.05` | Any call priced above this is refused **before** paying. |
|
|
68
|
+
| `PREDGE_MCP_USER_AGENT` | `predge-whale-data-mcp/0.1.1` | Sent on every request (lets the API attribute MCP traffic). |
|
|
69
|
+
|
|
70
|
+
### Testnet
|
|
71
|
+
|
|
72
|
+
To exercise the payment path without real money, point `PREDGE_BASE_URL` at a
|
|
73
|
+
Base-Sepolia deployment of the API and set `X402_NETWORK=base-sepolia`; fund the
|
|
74
|
+
buyer from [faucet.circle.com](https://faucet.circle.com). (The public prod API
|
|
75
|
+
is mainnet-only, so testnet needs your own deployment.)
|
|
76
|
+
|
|
77
|
+
## Safety
|
|
78
|
+
|
|
79
|
+
- **Price cap** — `MAX_PRICE_USD` is enforced in the payment selector, so an
|
|
80
|
+
over-cap call is refused before any money moves (no wasted request).
|
|
81
|
+
- **Network guard** — the client only pays a requirement on the configured
|
|
82
|
+
network; it won't accidentally settle a mainnet requirement while in testnet
|
|
83
|
+
mode (or vice-versa).
|
|
84
|
+
- **No key handling beyond env** — the server reads `BUYER_PRIVATE_KEY` from env,
|
|
85
|
+
never logs it, and never sends it anywhere but the local signer. Use a
|
|
86
|
+
dedicated low-balance wallet and keep the key out of version control.
|
|
87
|
+
|
|
88
|
+
## Run from source
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git clone https://github.com/predgeAI/whale-data-mcp.git
|
|
92
|
+
cd whale-data-mcp && npm install && npm run build
|
|
93
|
+
# then point your MCP client's "command" at node with args ["/abs/path/whale-data-mcp/dist/index.js"]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Verify locally
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run inspect # list tools (no payment)
|
|
100
|
+
node dist/dev-list-tools.js predge_list_endpoints # free call against prod
|
|
101
|
+
# paid call (spends real USDC on mainnet):
|
|
102
|
+
BUYER_PRIVATE_KEY=0x… X402_NETWORK=base node dist/dev-list-tools.js predge_whales_latest '{"limit":2}'
|
|
103
|
+
```
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const NETWORK_ALIASES = {
|
|
2
|
+
"base-sepolia": "eip155:84532",
|
|
3
|
+
base: "eip155:8453",
|
|
4
|
+
};
|
|
5
|
+
function caip2(raw) {
|
|
6
|
+
const v = raw.trim().toLowerCase();
|
|
7
|
+
if (v.startsWith("eip155:"))
|
|
8
|
+
return v;
|
|
9
|
+
const m = NETWORK_ALIASES[v];
|
|
10
|
+
if (!m)
|
|
11
|
+
throw new Error(`Unsupported X402_NETWORK "${raw}" (use base-sepolia | base | eip155:<id>)`);
|
|
12
|
+
return m;
|
|
13
|
+
}
|
|
14
|
+
function numEnv(name, def) {
|
|
15
|
+
const raw = process.env[name]?.trim();
|
|
16
|
+
if (!raw)
|
|
17
|
+
return def;
|
|
18
|
+
const n = Number(raw);
|
|
19
|
+
if (!Number.isFinite(n) || n <= 0)
|
|
20
|
+
throw new Error(`${name} must be a positive number, got "${raw}"`);
|
|
21
|
+
return n;
|
|
22
|
+
}
|
|
23
|
+
export const config = {
|
|
24
|
+
baseUrl: (process.env.PREDGE_BASE_URL ?? "https://x402-api-production-266e.up.railway.app").replace(/\/+$/, ""),
|
|
25
|
+
// Optional so the server + free discovery tool work without a key; paid
|
|
26
|
+
// tools fail clearly if it's unset.
|
|
27
|
+
buyerKey: process.env.BUYER_PRIVATE_KEY,
|
|
28
|
+
// Default to Base MAINNET: the live Predge API is mainnet-only, so a
|
|
29
|
+
// one-command install must default here or every paid tool would fail the
|
|
30
|
+
// network guard. Override X402_NETWORK=base-sepolia only against a testnet
|
|
31
|
+
// deployment. The MAX_PRICE_USD cap (below) bounds spend either way.
|
|
32
|
+
network: caip2(process.env.X402_NETWORK ?? "base"),
|
|
33
|
+
maxPriceUsd: numEnv("MAX_PRICE_USD", 0.05),
|
|
34
|
+
userAgent: process.env.PREDGE_MCP_USER_AGENT ?? "predge-whale-data-mcp/0.1.1",
|
|
35
|
+
};
|
|
36
|
+
export const IS_TESTNET = config.network !== "eip155:8453";
|
|
37
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
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AE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,MAAM,CAAC;IAClD,WAAW,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,6BAA6B;CACrE,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,KAAK,aAAa,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local verification harness (not part of the shipped server). Wires the
|
|
3
|
+
* server to an in-memory client, lists tools, and — if a path arg is given —
|
|
4
|
+
* calls one tool with JSON args:
|
|
5
|
+
*
|
|
6
|
+
* npm run inspect # just list tools
|
|
7
|
+
* tsx src/dev-list-tools.ts predge_list_endpoints # free call
|
|
8
|
+
* tsx src/dev-list-tools.ts predge_whales_latest '{"limit":2}' # PAID
|
|
9
|
+
*/
|
|
10
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
11
|
+
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
12
|
+
import { buildServer } from "./server.js";
|
|
13
|
+
async function main() {
|
|
14
|
+
const server = buildServer();
|
|
15
|
+
const [clientT, serverT] = InMemoryTransport.createLinkedPair();
|
|
16
|
+
await server.connect(serverT);
|
|
17
|
+
const client = new Client({ name: "dev-inspect", version: "0" });
|
|
18
|
+
await client.connect(clientT);
|
|
19
|
+
const { tools } = await client.listTools();
|
|
20
|
+
console.log(`tools (${tools.length}):`);
|
|
21
|
+
for (const t of tools)
|
|
22
|
+
console.log(` - ${t.name}: ${t.title ?? ""}`);
|
|
23
|
+
const toolName = process.argv[2];
|
|
24
|
+
if (toolName) {
|
|
25
|
+
const args = process.argv[3] ? JSON.parse(process.argv[3]) : {};
|
|
26
|
+
console.log(`\ncalling ${toolName}(${JSON.stringify(args)}) …`);
|
|
27
|
+
const res = await client.callTool({ name: toolName, arguments: args });
|
|
28
|
+
const first = res.content[0];
|
|
29
|
+
console.log(`isError: ${res.isError ?? false}`);
|
|
30
|
+
console.log((first?.text ?? "").slice(0, 1500));
|
|
31
|
+
}
|
|
32
|
+
await client.close();
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
main().catch((e) => {
|
|
36
|
+
console.error(e);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=dev-list-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-list-tools.js","sourceRoot":"","sources":["../src/dev-list-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,CAAC;IAChE,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9B,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;IACxC,KAAK,MAAM,CAAC,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;IAEtE,MAA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
* "mcpServers": {
|
|
7
|
+
* "predge-whale-data": {
|
|
8
|
+
* "command": "npx",
|
|
9
|
+
* "args": ["-y", "@predge/whale-data-mcp"],
|
|
10
|
+
* "env": { "BUYER_PRIVATE_KEY": "0x…", "X402_NETWORK": "base-sepolia" }
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
16
|
+
import { buildServer } from "./server.js";
|
|
17
|
+
async function main() {
|
|
18
|
+
const server = buildServer();
|
|
19
|
+
const transport = new StdioServerTransport();
|
|
20
|
+
await server.connect(transport);
|
|
21
|
+
// stderr is safe for logs on stdio (stdout is the MCP channel).
|
|
22
|
+
console.error("predge-whale-data MCP server ready (stdio)");
|
|
23
|
+
}
|
|
24
|
+
main().catch((e) => {
|
|
25
|
+
console.error("fatal:", e);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,gEAAgE;IAChE,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAC9D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/pay.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* x402-paying HTTP layer for the MCP tools. One shared client signs EIP-3009
|
|
3
|
+
* payments with the operator's BUYER_PRIVATE_KEY; the facilitator settles
|
|
4
|
+
* on-chain (no ETH needed). Two guards live in the payment selector so they
|
|
5
|
+
* fire BEFORE any money moves and cost no extra request:
|
|
6
|
+
* - price cap (MAX_PRICE_USD) — refuse calls priced above the cap
|
|
7
|
+
* - network — only pay on the configured network (won't accidentally
|
|
8
|
+
* pay a mainnet requirement while in testnet mode)
|
|
9
|
+
*
|
|
10
|
+
* Every request carries a recognizable User-Agent so MCP-originated calls
|
|
11
|
+
* are attributable in the API's discovery-funnel analytics.
|
|
12
|
+
*/
|
|
13
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
14
|
+
import { wrapFetchWithPayment, x402Client, decodePaymentResponseHeader } from "@x402/fetch";
|
|
15
|
+
import { ExactEvmScheme } from "@x402/evm/exact/client";
|
|
16
|
+
import { config } from "./config.js";
|
|
17
|
+
export class PaymentError extends Error {
|
|
18
|
+
}
|
|
19
|
+
function amountUsd(r) {
|
|
20
|
+
const a = r.amount ?? r.maxAmountRequired;
|
|
21
|
+
if (!a)
|
|
22
|
+
return null;
|
|
23
|
+
try {
|
|
24
|
+
return Number(BigInt(a)) / 1e6; // USDC 6-decimals
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
let cachedFetch = null;
|
|
31
|
+
function payingFetch() {
|
|
32
|
+
if (cachedFetch)
|
|
33
|
+
return cachedFetch;
|
|
34
|
+
if (!config.buyerKey) {
|
|
35
|
+
const funding = config.network === "eip155:8453"
|
|
36
|
+
? "a funded Base MAINNET buyer wallet (real USDC; the facilitator pays gas, no ETH needed)"
|
|
37
|
+
: "a funded Base Sepolia buyer wallet (testnet USDC from https://faucet.circle.com)";
|
|
38
|
+
throw new PaymentError(`BUYER_PRIVATE_KEY is not set. Paid tools need ${funding}. Set it in the MCP server env. ` +
|
|
39
|
+
"The free tool predge_list_endpoints works without a key.");
|
|
40
|
+
}
|
|
41
|
+
const signer = privateKeyToAccount(config.buyerKey);
|
|
42
|
+
const client = new x402Client((_v, reqs) => {
|
|
43
|
+
const onNet = reqs.filter((r) => (r.scheme ?? "exact") === "exact" && r.network === config.network);
|
|
44
|
+
if (onNet.length === 0) {
|
|
45
|
+
throw new PaymentError(`no payment option on ${config.network}; server offered ${reqs.map((r) => r.network).join(", ") || "none"}`);
|
|
46
|
+
}
|
|
47
|
+
// Cheapest matching requirement.
|
|
48
|
+
const chosen = onNet.reduce((a, b) => ((amountUsd(a) ?? Infinity) <= (amountUsd(b) ?? Infinity) ? a : b));
|
|
49
|
+
const price = amountUsd(chosen);
|
|
50
|
+
if (price !== null && price > config.maxPriceUsd) {
|
|
51
|
+
throw new PaymentError(`price $${price.toFixed(3)} exceeds MAX_PRICE_USD $${config.maxPriceUsd.toFixed(3)} — refusing to pay`);
|
|
52
|
+
}
|
|
53
|
+
return chosen;
|
|
54
|
+
});
|
|
55
|
+
client.register("eip155:*", new ExactEvmScheme(signer));
|
|
56
|
+
cachedFetch = wrapFetchWithPayment(fetch, client);
|
|
57
|
+
return cachedFetch;
|
|
58
|
+
}
|
|
59
|
+
/** GET a paid route, paying under the hood. Returns parsed JSON + settle info. */
|
|
60
|
+
export async function payGet(path) {
|
|
61
|
+
const f = payingFetch();
|
|
62
|
+
const res = await f(`${config.baseUrl}${path}`, {
|
|
63
|
+
method: "GET",
|
|
64
|
+
headers: { "user-agent": config.userAgent },
|
|
65
|
+
});
|
|
66
|
+
if (res.status >= 400) {
|
|
67
|
+
const body = await res.text().catch(() => "");
|
|
68
|
+
throw new PaymentError(`upstream ${res.status}: ${body.slice(0, 300)}`);
|
|
69
|
+
}
|
|
70
|
+
const data = await res.json();
|
|
71
|
+
let paid = null;
|
|
72
|
+
const hdr = res.headers.get("payment-response") ?? res.headers.get("x-payment-response");
|
|
73
|
+
if (hdr) {
|
|
74
|
+
try {
|
|
75
|
+
const settle = decodePaymentResponseHeader(hdr);
|
|
76
|
+
paid = {
|
|
77
|
+
price_usd: null,
|
|
78
|
+
settle_tx: settle.transaction ?? null,
|
|
79
|
+
network: settle.network ?? null,
|
|
80
|
+
payer: settle.payer ?? null,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
/* leave paid null */
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { data, paid };
|
|
88
|
+
}
|
|
89
|
+
/** GET a FREE route (no payment) — used by the discovery tool. */
|
|
90
|
+
export async function freeGet(path) {
|
|
91
|
+
const res = await fetch(`${config.baseUrl}${path}`, {
|
|
92
|
+
method: "GET",
|
|
93
|
+
headers: { "user-agent": config.userAgent },
|
|
94
|
+
signal: AbortSignal.timeout(15_000),
|
|
95
|
+
});
|
|
96
|
+
if (!res.ok)
|
|
97
|
+
throw new Error(`upstream ${res.status}`);
|
|
98
|
+
return res.json();
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=pay.js.map
|
package/dist/pay.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay.js","sourceRoot":"","sources":["../src/pay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,YAAa,SAAQ,KAAK;CAAG;AAU1C,SAAS,SAAS,CAAC,CAAc;IAC/B,MAAM,CAAC,GAAG,CAA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G,CAAC,MAAM,EAAE,CAAC,CAAC;IACvD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Predge Whale Data MCP server. Exposes the 7 paid x402 routes as tools
|
|
3
|
+
* (payment handled under the hood by pay.ts) plus one free discovery tool.
|
|
4
|
+
* Transport-agnostic: index.ts wires it to stdio.
|
|
5
|
+
*/
|
|
6
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { config, IS_TESTNET } from "./config.js";
|
|
9
|
+
import { payGet, freeGet, PaymentError } from "./pay.js";
|
|
10
|
+
function ok(data, paid) {
|
|
11
|
+
const note = paid
|
|
12
|
+
? `\n\n_paid via x402: tx ${paid.settle_tx ?? "?"} on ${paid.network ?? config.network}_`
|
|
13
|
+
: "";
|
|
14
|
+
const json = JSON.stringify(data, null, 2);
|
|
15
|
+
return {
|
|
16
|
+
content: [{ type: "text", text: (json.length > 12_000 ? json.slice(0, 12_000) + "\n… (truncated)" : json) + note }],
|
|
17
|
+
structuredContent: { data, paid },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function fail(e) {
|
|
21
|
+
const msg = e instanceof PaymentError ? e.message : e instanceof Error ? e.message : String(e);
|
|
22
|
+
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
23
|
+
}
|
|
24
|
+
async function paid(path) {
|
|
25
|
+
try {
|
|
26
|
+
const { data, paid } = await payGet(path);
|
|
27
|
+
return ok(data, paid);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
return fail(e);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const CONDITION_ID = z
|
|
34
|
+
.string()
|
|
35
|
+
.regex(/^[0-9a-zA-Z_:.-]{1,255}$/, "Polymarket conditionId (0x-hex) or platform market id");
|
|
36
|
+
const ADDRESS = z.string().regex(/^0x[0-9a-fA-F]{40}$/, "0x-prefixed 40-hex EVM address");
|
|
37
|
+
export function buildServer() {
|
|
38
|
+
const server = new McpServer({ name: "predge-whale-data", version: "0.1.0" }, {
|
|
39
|
+
instructions: "Polymarket whale trades and smart-money signals from Predge, sold per call over x402. " +
|
|
40
|
+
`Tools pay USDC automatically on ${IS_TESTNET ? "Base Sepolia testnet" : "Base mainnet"} from the ` +
|
|
41
|
+
"configured buyer key (max $" + config.maxPriceUsd.toFixed(3) + "/call). Data is delayed 15 minutes. " +
|
|
42
|
+
"Call predge_list_endpoints first (free) to see prices and schemas.",
|
|
43
|
+
});
|
|
44
|
+
// --- free discovery -----------------------------------------------------
|
|
45
|
+
server.registerTool("predge_list_endpoints", {
|
|
46
|
+
title: "List Predge endpoints & prices (free)",
|
|
47
|
+
description: "Free. Returns the Predge API description, network, payTo, and every endpoint with its price " +
|
|
48
|
+
"and what it returns. Call this first to see what's available before paying.",
|
|
49
|
+
inputSchema: {},
|
|
50
|
+
}, async () => {
|
|
51
|
+
try {
|
|
52
|
+
return ok(await freeGet("/"), null);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
return fail(e);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
// --- paid tools (one per route) -----------------------------------------
|
|
59
|
+
server.registerTool("predge_whales_latest", {
|
|
60
|
+
title: "Latest whale trades",
|
|
61
|
+
description: "PAID (~$0.005). Latest Polymarket whale trades ≥$10k notional (15-min delay): market, side, size, " +
|
|
62
|
+
"price, wallet address + Predge wallet score. Param: limit (1-100, default 50).",
|
|
63
|
+
inputSchema: { limit: z.number().int().min(1).max(100).optional() },
|
|
64
|
+
}, async ({ limit }) => paid(`/v1/whales/latest${limit ? `?limit=${limit}` : ""}`));
|
|
65
|
+
server.registerTool("predge_whale_market", {
|
|
66
|
+
title: "Whale activity for one market",
|
|
67
|
+
description: "PAID (~$0.01). 7-day whale activity + aggregates (volume, YES/NO split, net flow, unique wallets) " +
|
|
68
|
+
"for one Polymarket market. Param: condition_id.",
|
|
69
|
+
inputSchema: { condition_id: CONDITION_ID },
|
|
70
|
+
}, async ({ condition_id }) => paid(`/v1/whales/market/${encodeURIComponent(condition_id)}`));
|
|
71
|
+
server.registerTool("predge_signals_daily", {
|
|
72
|
+
title: "24h whale digest",
|
|
73
|
+
description: "PAID (~$0.02). 24h digest: top markets by whale volume, net flow, largest single bets, totals.",
|
|
74
|
+
inputSchema: {},
|
|
75
|
+
}, async () => paid("/v1/signals/daily"));
|
|
76
|
+
server.registerTool("predge_wallets_leaderboard", {
|
|
77
|
+
title: "Wallet win-rate leaderboard",
|
|
78
|
+
description: "PAID (~$0.01). Top wallets by realized win rate over resolved markets. " +
|
|
79
|
+
"Params: window (7d|30d, default 30d), limit (1-100, default 50).",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
window: z.enum(["7d", "30d"]).optional(),
|
|
82
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
83
|
+
},
|
|
84
|
+
}, async ({ window, limit }) => {
|
|
85
|
+
const q = new URLSearchParams();
|
|
86
|
+
if (window)
|
|
87
|
+
q.set("window", window);
|
|
88
|
+
if (limit)
|
|
89
|
+
q.set("limit", String(limit));
|
|
90
|
+
const qs = q.toString();
|
|
91
|
+
return paid(`/v1/wallets/leaderboard${qs ? `?${qs}` : ""}`);
|
|
92
|
+
});
|
|
93
|
+
server.registerTool("predge_wallet_profile", {
|
|
94
|
+
title: "Wallet profile",
|
|
95
|
+
description: "PAID (~$0.01). One wallet's profile: Predge score, win rates (7d/30d), favorite categories, " +
|
|
96
|
+
"last 20 trades (15-min delay). Param: address (0x…).",
|
|
97
|
+
inputSchema: { address: ADDRESS },
|
|
98
|
+
}, async ({ address }) => paid(`/v1/wallets/${encodeURIComponent(address)}`));
|
|
99
|
+
server.registerTool("predge_markets_movers", {
|
|
100
|
+
title: "Largest price movers",
|
|
101
|
+
description: "PAID (~$0.005). Largest YES-price moves across active markets (from trade prints). " +
|
|
102
|
+
"Param: window (1h|6h|24h, default 6h).",
|
|
103
|
+
inputSchema: { window: z.enum(["1h", "6h", "24h"]).optional() },
|
|
104
|
+
}, async ({ window }) => paid(`/v1/markets/movers${window ? `?window=${window}` : ""}`));
|
|
105
|
+
server.registerTool("predge_signals_consensus", {
|
|
106
|
+
title: "Smart-money consensus (premium)",
|
|
107
|
+
description: "PAID (~$0.03, premium). Per active market with whale activity in 24h: net flow of smart-money " +
|
|
108
|
+
"wallets (score > 70), YES/NO volume, and a direction verdict.",
|
|
109
|
+
inputSchema: {},
|
|
110
|
+
}, async () => paid("/v1/signals/consensus"));
|
|
111
|
+
return server;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAQzD,SAAS,EAAE,CAAC,IAAa,EAAE,IAAa;IACtC,MAAM,IAAI,GAAG,IAAI;QACf,CAAC,CAAC,0BAA2B,IAA+B,CAAC,SAAS,IAAI,GAAG,OAAQ,IAA6B,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,GAAG;QAC/I,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,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,8FAA8F;YAC9F,sDAAsD;QACxD,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;KAClC,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAC1E,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,qFAAqF;YACrF,wCAAwC;QAC1C,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE;KAChE,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACrF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,KAAK,EAAE,iCAAiC;QACxC,WAAW,EACT,gGAAgG;YAChG,+DAA+D;QACjE,WAAW,EAAE,EAAE;KAChB,EACD,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAC1C,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@predge/whale-data-mcp",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "MCP server exposing the Predge Whale Data x402 API (Polymarket whale trades + smart-money signals) as tools. Pays USDC per call under the hood via an x402 client; the operator supplies a funded buyer key.",
|
|
5
|
+
"mcpName": "io.github.predgeai/whale-data-mcp",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"author": "Predge <hello@predge.io>",
|
|
9
|
+
"homepage": "https://github.com/predgeAI/whale-data-mcp#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/predgeAI/whale-data-mcp.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/predgeAI/whale-data-mcp/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mcp",
|
|
19
|
+
"model-context-protocol",
|
|
20
|
+
"x402",
|
|
21
|
+
"polymarket",
|
|
22
|
+
"prediction-markets",
|
|
23
|
+
"whale-tracking",
|
|
24
|
+
"smart-money",
|
|
25
|
+
"agent",
|
|
26
|
+
"usdc",
|
|
27
|
+
"base",
|
|
28
|
+
"predge"
|
|
29
|
+
],
|
|
30
|
+
"bin": {
|
|
31
|
+
"predge-whale-data-mcp": "dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -p tsconfig.json",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
43
|
+
"dev": "tsx src/index.ts",
|
|
44
|
+
"inspect": "tsx src/dev-list-tools.ts",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
52
|
+
"@x402/core": "~2.19.0",
|
|
53
|
+
"@x402/evm": "~2.19.0",
|
|
54
|
+
"@x402/fetch": "~2.19.0",
|
|
55
|
+
"viem": "^2.55.0",
|
|
56
|
+
"zod": "^4.4.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^20.19.43",
|
|
60
|
+
"tsx": "^4.23.1",
|
|
61
|
+
"typescript": "^5.9.3"
|
|
62
|
+
}
|
|
63
|
+
}
|