onchain-signals-mcp 0.3.0 → 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/dist/mcp.js CHANGED
@@ -15,7 +15,7 @@ import { ExactEvmScheme } from "@x402/evm";
15
15
  import { createPublicClient, http, erc20Abi, formatUnits } from "viem";
16
16
  import { privateKeyToAccount } from "viem/accounts";
17
17
  import { base, baseSepolia } from "viem/chains";
18
- import { TOOLS } from "./tools.js";
18
+ import { TOOLS, READ_ONLY, VERSION } from "./tools.js";
19
19
  import { existsSync } from "node:fs";
20
20
  import { fileURLToPath } from "node:url";
21
21
  // Load the project's .env (kept out of git) so the wallet key needn't live in MCP client configs.
@@ -81,11 +81,11 @@ async function paidCall(tool, path) {
81
81
  return text({ paid: { usd: price, tx, sessionSpentUsd: +spentUsd.toFixed(6) }, data: await res.json() });
82
82
  }
83
83
  // ---- server -------------------------------------------------------------
84
- const server = new McpServer({ name: "onchain-signals", version: "0.2.0" });
84
+ const server = new McpServer({ name: "onchain-signals", title: "Onchain Signals", version: VERSION });
85
85
  for (const [name, t] of Object.entries(TOOLS)) {
86
- server.registerTool(name, { title: t.title, description: `${t.description} Paid: ~${t.price} per call (x402, USDC).`, inputSchema: t.input }, async (a) => paidCall(name, t.path(a)));
86
+ server.registerTool(name, { title: t.title, description: `${t.description} Paid: ~${t.price} per call (x402, USDC).`, inputSchema: t.input, annotations: { title: t.title, ...READ_ONLY } }, async (a) => paidCall(name, t.path(a)));
87
87
  }
88
- server.registerTool("list_services", { title: "List services and prices", description: "Free. Lists what the onchain-signals API sells and current prices.", inputSchema: {} }, async () => {
88
+ server.registerTool("list_services", { title: "List services and prices", description: "Free. Lists what the onchain-signals API sells and current prices.", inputSchema: {}, annotations: { title: "List services and prices", ...READ_ONLY } }, async () => {
89
89
  try {
90
90
  return text(await (await fetch(new URL("/.well-known/x402", API_URL))).json());
91
91
  }
@@ -93,7 +93,7 @@ server.registerTool("list_services", { title: "List services and prices", descri
93
93
  return fail(`Cannot reach onchain-signals API at ${API_URL}.`);
94
94
  }
95
95
  });
96
- server.registerTool("wallet_status", { title: "Wallet & spend status", description: "Free. Payer wallet address, USDC balance, spend this session and remaining budget.", inputSchema: {} }, async () => {
96
+ server.registerTool("wallet_status", { title: "Wallet & spend status", description: "Free. Payer wallet address, USDC balance, spend this session and remaining budget.", inputSchema: {}, annotations: { title: "Wallet & spend status", ...READ_ONLY } }, async () => {
97
97
  let balance = null;
98
98
  if (account && lastOffer) {
99
99
  const pc = createPublicClient({ chain: CHAINS[lastOffer.network], transport: http() });
@@ -3,7 +3,7 @@
3
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
5
5
  import { createPaymentWrapper } from "@x402/mcp";
6
- import { TOOLS } from "./tools.js";
6
+ import { TOOLS, READ_ONLY, VERSION } from "./tools.js";
7
7
  const text = (v) => ({ content: [{ type: "text", text: JSON.stringify(v, null, 2) }] });
8
8
  export function remoteMcp(o) {
9
9
  // Payment wrappers need the facilitator's supported kinds, so build them once, on first use.
@@ -23,10 +23,10 @@ export function remoteMcp(o) {
23
23
  }));
24
24
  return async (req) => {
25
25
  const paid = await getWrappers();
26
- const server = new McpServer({ name: "onchain-signals", version: "0.2.0" });
26
+ const server = new McpServer({ name: "onchain-signals", title: "Onchain Signals", version: VERSION });
27
27
  for (const name of Object.keys(TOOLS)) {
28
28
  const t = TOOLS[name];
29
- server.registerTool(name, { title: t.title, description: `${t.description} Paid: ${t.price} per call (x402, USDC).`, inputSchema: t.input },
29
+ server.registerTool(name, { title: t.title, description: `${t.description} Paid: ${t.price} per call (x402, USDC).`, inputSchema: t.input, annotations: { title: t.title, ...READ_ONLY } },
30
30
  // A thrown error becomes isError, and the payment wrapper does not settle failed calls.
31
31
  paid[name](async (args) => {
32
32
  try {
@@ -37,7 +37,7 @@ export function remoteMcp(o) {
37
37
  }
38
38
  }));
39
39
  }
40
- server.registerTool("list_services", { title: "List services and prices", description: "Free. What onchain-signals sells and current prices.", inputSchema: {} }, async () => text(o.catalog()));
40
+ server.registerTool("list_services", { title: "List services and prices", description: "Free. What onchain-signals sells and current prices.", inputSchema: {}, annotations: { title: "List services and prices", ...READ_ONLY } }, async () => text(o.catalog()));
41
41
  const transport = new WebStandardStreamableHTTPServerTransport({ sessionIdGenerator: undefined, enableJsonResponse: true });
42
42
  await server.connect(transport);
43
43
  return transport.handleRequest(req);
package/dist/tools.js CHANGED
@@ -3,19 +3,22 @@ import { z } from "zod";
3
3
  import * as pm from "./polymarket.js";
4
4
  const qs = (o) => new URLSearchParams(Object.entries(o).filter(([, v]) => v != null).map(([k, v]) => [k, String(v)])).toString();
5
5
  const moversInput = {
6
- window: z.enum(["1d", "1w"]).default("1d").describe("Lookback window"),
7
- limit: z.number().int().min(1).max(50).default(20),
8
- minVolume: z.number().min(0).default(10000).describe("Minimum 24h volume in USD"),
6
+ window: z.enum(["1d", "1w"]).default("1d").describe("Lookback window for the price change: '1d' (24 hours) or '1w' (7 days)"),
7
+ limit: z.number().int().min(1).max(50).default(20).describe("How many markets to return (1-50)"),
8
+ minVolume: z.number().min(0).default(10000).describe("Skip markets with less than this 24h trading volume, in USD"),
9
9
  };
10
10
  const whalesInput = {
11
- min: z.number().min(100).default(10000).describe("Minimum trade size in USD"),
11
+ min: z.number().min(100).default(10000).describe("Only count trades of at least this size, in USD"),
12
12
  limit: z.number().int().min(1).max(500).default(200).describe("How many recent large trades to scan"),
13
13
  };
14
14
  const marketInput = {
15
15
  slug: z.string().min(1).describe("Market slug or polymarket.com URL, e.g. 'new-nvidia-ceo-named-by-december-31-2026'"),
16
- min: z.number().min(100).default(5000).describe("Whale threshold in USD"),
16
+ min: z.number().min(100).default(5000).describe("Trades of at least this size (USD) count as whale trades in the flow analysis"),
17
17
  };
18
18
  const toSlug = (s) => s.replace(/^.*\/market\//, "").replace(/[?#].*$/, "");
19
+ export const VERSION = "0.3.1"; // keep in sync with package.json and server.json (checked by tests)
20
+ /** MCP tool annotations: every tool only reads public market data. */
21
+ export const READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true };
19
22
  const tool = (t) => t;
20
23
  export const TOOLS = {
21
24
  get_market_movers: tool({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onchain-signals-mcp",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Pay-per-call Polymarket intelligence for AI agents: MCP server + x402 (USDC) API",
5
5
  "scripts": {
6
6
  "dev": "tsx watch --env-file-if-exists=.env src/server.ts",
@@ -57,5 +57,13 @@
57
57
  "engines": {
58
58
  "node": ">=22.5"
59
59
  },
60
- "mcpName": "io.github.glibey/onchain-signals"
60
+ "mcpName": "io.github.glibey/onchain-signals",
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/glibey/onchain-signals.git"
64
+ },
65
+ "homepage": "https://github.com/glibey/onchain-signals#readme",
66
+ "bugs": {
67
+ "url": "https://github.com/glibey/onchain-signals/issues"
68
+ }
61
69
  }