wickedapi-mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WickedAPI
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,67 @@
1
+ # WickedAPI MCP Server
2
+
3
+ MCP server for [WickedAPI](https://api.wickedapi.com) — an agent-ready trading & market-data API covering crypto/stock prices, OHLCV, technical indicators (ATR, Fair Value Gaps, ICT liquidity levels), perp funding/OI, order books, Kalshi prediction markets, DeFi TVL, volatility, a verified macro calendar, an earnings calendar, and an AI momentum score.
4
+
5
+ Tools are generated automatically from the live [`openapi.json`](https://api.wickedapi.com/openapi.json), so the tool list always matches what's actually deployed.
6
+
7
+ ## No signup required
8
+
9
+ Every tool call hits a real `/v1/*` endpoint that's gated by [x402](https://x402.org) (HTTP-native pay-per-call, USDC on Base) with an API-key fallback:
10
+
11
+ - **Zero config** — calls without credentials still work; you'll get back the real `402` payment challenge (price, network, `payTo`) as the tool result.
12
+ - **Autonomous pay-per-call** — set `WICKEDAPI_PAYER_PRIVATE_KEY` to a funded Base-mainnet wallet's private key, and every call auto-pays ~$0.001 in USDC and returns real data. No account, no subscription.
13
+ - **Partner API key** — set `WICKEDAPI_API_KEY` for free, rate-limited access if you have one.
14
+
15
+ ## Install
16
+
17
+ ```json
18
+ {
19
+ "mcpServers": {
20
+ "wickedapi": {
21
+ "command": "npx",
22
+ "args": ["-y", "wickedapi-mcp"],
23
+ "env": {
24
+ "WICKEDAPI_API_KEY": "your-key-here"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Or for autonomous pay-per-call instead of a key:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "wickedapi": {
37
+ "command": "npx",
38
+ "args": ["-y", "wickedapi-mcp"],
39
+ "env": {
40
+ "WICKEDAPI_PAYER_PRIVATE_KEY": "0xyour-base-wallet-private-key"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Environment variables
48
+
49
+ | Var | Required | Notes |
50
+ | --- | --- | --- |
51
+ | `WICKEDAPI_API_KEY` | no | Free, rate-limited access if you have a partner key. |
52
+ | `WICKEDAPI_PAYER_PRIVATE_KEY` | no | Base-mainnet wallet private key. If set, every call auto-pays the x402 challenge in USDC — no key needed. |
53
+ | `WICKEDAPI_BASE_URL` | no | Override the API base (default `https://api.wickedapi.com`). |
54
+
55
+ If neither `WICKEDAPI_API_KEY` nor `WICKEDAPI_PAYER_PRIVATE_KEY` is set, calls still succeed at the protocol level — you'll get the real `402` challenge back as the tool result instead of data.
56
+
57
+ ## Local development
58
+
59
+ ```bash
60
+ npm install
61
+ npm run build
62
+ node dist/index.js
63
+ ```
64
+
65
+ ## What this is not
66
+
67
+ This server doesn't reimplement any data logic — it's a thin, auto-generated bridge from MCP tool calls to the live WickedAPI HTTP endpoints. All the actual market data, indicators, and scoring live in the API itself.
package/dist/index.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+ const BASE_URL = (process.env.WICKEDAPI_BASE_URL || "https://api.wickedapi.com").replace(/\/$/, "");
6
+ const API_KEY = process.env.WICKEDAPI_API_KEY;
7
+ const PAYER_KEY = process.env.WICKEDAPI_PAYER_PRIVATE_KEY;
8
+ // If a funded Base-mainnet wallet key is provided, every call auto-pays the
9
+ // x402 402 challenge in USDC — no API key or signup needed at all. Loaded
10
+ // lazily so a plain API-key setup never has to pull in viem/x402-fetch.
11
+ async function buildFetcher() {
12
+ if (!PAYER_KEY)
13
+ return fetch;
14
+ const [{ createWalletClient, http }, { privateKeyToAccount }, { base }, { wrapFetchWithPayment }] = await Promise.all([
15
+ import("viem"),
16
+ import("viem/accounts"),
17
+ import("viem/chains"),
18
+ import("x402-fetch"),
19
+ ]);
20
+ const account = privateKeyToAccount(PAYER_KEY);
21
+ const wallet = createWalletClient({ account, chain: base, transport: http() });
22
+ console.error(`[wickedapi-mcp] x402 auto-pay enabled — wallet ${account.address}`);
23
+ // x402-fetch's Signer type expects a client extended with viem's public
24
+ // actions; the proven pattern in scripts/x402-bot-test.mjs passes a plain
25
+ // wallet client the same way — cast rather than pull in publicActions.
26
+ return wrapFetchWithPayment(fetch, wallet);
27
+ }
28
+ function toolNameFromPath(path) {
29
+ return path.replace(/^\/v1\//, "").replace(/-/g, "_");
30
+ }
31
+ function zodForParam(p) {
32
+ const type = p.schema?.type;
33
+ const base = type === "number" ? z.coerce.number() : type === "boolean" ? z.coerce.boolean() : z.string();
34
+ const described = p.description ? base.describe(p.description) : base;
35
+ return p.required ? described : described.optional();
36
+ }
37
+ async function main() {
38
+ const specRes = await fetch(`${BASE_URL}/openapi.json`);
39
+ if (!specRes.ok) {
40
+ throw new Error(`Failed to load ${BASE_URL}/openapi.json: HTTP ${specRes.status}`);
41
+ }
42
+ const doc = (await specRes.json());
43
+ const doFetch = await buildFetcher();
44
+ const server = new McpServer({ name: "wickedapi", version: "0.1.0" });
45
+ let registered = 0;
46
+ for (const [path, methods] of Object.entries(doc.paths)) {
47
+ const op = methods.get;
48
+ if (!op || !path.startsWith("/v1/") || path === "/v1/status")
49
+ continue;
50
+ const shape = {};
51
+ for (const p of op.parameters ?? []) {
52
+ if (p.in !== "query")
53
+ continue;
54
+ shape[p.name] = zodForParam(p);
55
+ }
56
+ server.registerTool(toolNameFromPath(path), {
57
+ description: [op.summary, op.description].filter(Boolean).join(" — ").slice(0, 1000),
58
+ inputSchema: shape,
59
+ }, async (args) => {
60
+ const url = new URL(BASE_URL + path);
61
+ for (const [k, v] of Object.entries(args ?? {})) {
62
+ if (v !== undefined && v !== null)
63
+ url.searchParams.set(k, String(v));
64
+ }
65
+ const headers = {};
66
+ if (API_KEY)
67
+ headers["x-api-key"] = API_KEY;
68
+ const r = await doFetch(url.toString(), { headers });
69
+ const text = await r.text();
70
+ let body;
71
+ try {
72
+ body = JSON.parse(text);
73
+ }
74
+ catch {
75
+ body = text;
76
+ }
77
+ return {
78
+ isError: !r.ok,
79
+ content: [{ type: "text", text: JSON.stringify(body, null, 2) }],
80
+ };
81
+ });
82
+ registered++;
83
+ }
84
+ const transport = new StdioServerTransport();
85
+ await server.connect(transport);
86
+ console.error(`[wickedapi-mcp] ready — ${registered} tools loaded from ${BASE_URL}/openapi.json`);
87
+ }
88
+ main().catch((err) => {
89
+ console.error("[wickedapi-mcp] fatal:", err);
90
+ process.exit(1);
91
+ });
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "wickedapi-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for WickedAPI — agent-ready trading & market-data API (crypto/stock prices, indicators, prediction markets, DeFi, macro, AI momentum score). No signup required: pay per call in USDC via x402, or use a partner API key.",
5
+ "type": "module",
6
+ "bin": {
7
+ "wickedapi-mcp": "dist/index.js"
8
+ },
9
+ "main": "dist/index.js",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "engines": {
14
+ "node": ">=20"
15
+ },
16
+ "license": "MIT",
17
+ "homepage": "https://api.wickedapi.com",
18
+ "bugs": {
19
+ "url": "https://api.wickedapi.com"
20
+ },
21
+ "author": "WickedAPI",
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.json",
24
+ "start": "node dist/index.js",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "keywords": [
28
+ "mcp",
29
+ "model-context-protocol",
30
+ "trading",
31
+ "crypto",
32
+ "stocks",
33
+ "market-data",
34
+ "x402",
35
+ "agent"
36
+ ],
37
+ "dependencies": {
38
+ "@modelcontextprotocol/sdk": "^1.29.0",
39
+ "viem": "^2.55.2",
40
+ "x402-fetch": "^1.2.0",
41
+ "zod": "^4.4.3"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^22.20.1",
45
+ "typescript": "^5.9.3"
46
+ }
47
+ }