@general-liquidity/sharpebench-mcp 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/server.js +26 -1
  2. package/package.json +2 -2
package/dist/server.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * Every tool is read-only and deterministic (the kernel has no I/O), so the
8
8
  * server is safe to expose without sandboxing.
9
9
  */
10
+ import { createRequire } from "node:module";
10
11
  import { fileURLToPath } from "node:url";
11
12
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
12
13
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -22,9 +23,21 @@ function run(fn) {
22
23
  return { content: [{ type: "text", text: `error: ${message}` }], isError: true };
23
24
  }
24
25
  }
26
+ // The server's version is the package's version, read from package.json at
27
+ // load time so a release bump (cargo-release rewrites npm/mcp/package.json from
28
+ // the workspace version) is the single source of truth and nothing here drifts.
29
+ const { version: PACKAGE_VERSION } = createRequire(import.meta.url)("../package.json");
30
+ function kernelRegimeCompare() {
31
+ const fn = sb.regimeCompare;
32
+ if (typeof fn !== "function") {
33
+ throw new Error("regime_compare is not exported by this build of @general-liquidity/sharpebench; " +
34
+ "use `sharpebench regime <a.csv> <b.csv> <regimes.csv>` from the CLI");
35
+ }
36
+ return fn;
37
+ }
25
38
  /** Build the SharpeBench MCP server with all kernel tools registered. */
26
39
  export function createServer() {
27
- const server = new McpServer({ name: "sharpebench", version: "0.0.3" });
40
+ const server = new McpServer({ name: "sharpebench", version: PACKAGE_VERSION });
28
41
  server.tool("score", "Rank a field of agent submissions on the luck-robust composite (deflated Sharpe + pass^k + process discipline). Raw return is reported but is never the rank key. Returns ranked CompositeScore[].", { submissions: z.array(z.any()), config: z.any().optional() }, async ({ submissions, config }) => run(() => sb.score(submissions, config)));
29
42
  server.tool("score_agent", "Score a single submission → one CompositeScore (deflated Sharpe, pass^k verdict, process score, rolling worst-case Sharpe).", { submission: z.any(), config: z.any().optional() }, async ({ submission, config }) => run(() => sb.scoreAgent(submission, config)));
30
43
  server.tool("self_audit", "Fire the known gaming attacks at the scorer and report whether each is demoted (the benchmark's anti-gaming proof). No input.", async () => run(() => sb.selfAudit()));
@@ -53,6 +66,18 @@ export function createServer() {
53
66
  borderline,
54
67
  srBenchmark: sr_benchmark,
55
68
  })));
69
+ server.tool("regime_compare", "Compare two strategies' per-period returns WITHIN each market regime rather than pooled: per regime, the zero/no-trade mass vs the continuous part (ZAGA split), mean/sd/median, sign share, moment-matched gamma on magnitudes, a two-sample KS statistic, and whether the pooled mean gap hides a sign reversal. Regime labels are an input (one per period); nothing is inferred and no GAMLSS is fitted.", {
70
+ returns_a: z.array(z.number()),
71
+ returns_b: z.array(z.number()),
72
+ regimes: z.array(z.string()),
73
+ zero_tol: z.number().optional(),
74
+ min_periods: z.number().optional(),
75
+ tie_tol: z.number().optional(),
76
+ }, async ({ returns_a, returns_b, regimes, zero_tol, min_periods, tie_tol }) => run(() => kernelRegimeCompare()(returns_a, returns_b, regimes, {
77
+ zeroTol: zero_tol,
78
+ minPeriods: min_periods,
79
+ tieTol: tie_tol,
80
+ })));
56
81
  return server;
57
82
  }
58
83
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@general-liquidity/sharpebench-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server exposing the SharpeBench luck-robust scoring kernel as agent-callable tools (deflated Sharpe, pass^k, process discipline, briefing audit, options Greeks).",
5
5
  "keywords": [
6
6
  "mcp",
@@ -30,7 +30,7 @@
30
30
  "prepublishOnly": "tsc"
31
31
  },
32
32
  "dependencies": {
33
- "@general-liquidity/sharpebench": "^0.1.0",
33
+ "@general-liquidity/sharpebench": "^0.2.0",
34
34
  "@modelcontextprotocol/sdk": "^1.0.0",
35
35
  "zod": "^4.0.0"
36
36
  },