npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

stratify-mcp

v0.1.2

Published

JS/TS client and stdio-to-HTTP bridge for the Stratify options-backtesting MCP server

Readme

stratify (npm)

JS/TS client, and npx stratify-mcp stdio bridge, for Stratify — real 1-minute NIFTY options data, honest backtests.

npm install stratify-mcp

Quickstart

import { StratifyClient } from "stratify-mcp";

// One-time: create an account and get a key. The key is shown once -- save it.
const signup = await StratifyClient.signup("[email protected]");
const client = new StratifyClient({ apiKey: signup.api_key });

const result = await client.runBacktest({
  legs: [
    { side: "sell", type: "CE", strike: { delta_near: 0.2 } },
    { side: "sell", type: "PE", strike: { delta_near: 0.2 } },
  ],
  // The reason for the trade, not just the trade.
  entry: { cadence: "weekly", dte: 3, time: "09:30", when: { vix: { gte: 15 } } },
  // Managed while it is open.
  rules: [
    { when: { pnl_pct_of_credit: { gte: 0.6 } }, then: "close" },
    { when: { leg_mark_mult: { gte: 2.0, leg: 0 } },
      then: { roll: { legs: [0], to: { delta_near: 0.2 } } }, max_times: 2 },
  ],
  portfolio: { stop_after_losses: 3, resume_after_days: 30 },
});

console.log(result.summary.total_pnl_rupees, result.summary.max_drawdown_rupees);
console.log(result.summary.ratios);  // sharpe, profit_factor, calmar (only above 30 trades)
console.log(result.honesty);        // out-of-sample split, walk-forward folds, deflated Sharpe
result.trades;                      // Array<Record<string, unknown>>, one entry per trade
result.equity_curve?.rows;          // Array<unknown[]>, columns named in .equity_curve.columns
console.log(result.report_url);     // shareable page with the full chart and every trade

Already have a key?

const client = new StratifyClient({ apiKey: "sk_live_..." });

Requires Node >=18 (uses the platform fetch; no HTTP dependency).

Why a client at all, when it's just JSON-RPC

There's no separate REST endpoint for run_backtest — every tool is reached through one POST /mcp speaking MCP JSON-RPC 2.0. This package exists so you don't hand-roll that envelope: client.runBacktest(...) is a typed async function, and errors come back as JS Error subclasses you can instanceof-check instead of a JSON-RPC error code you have to remember.

Errors

import { AuthenticationError, QuotaExceededError, ToolRefusalError } from "stratify-mcp";

try {
  const result = await client.runBacktest(spec);
} catch (err) {
  if (err instanceof AuthenticationError) { /* bad or revoked key */ }
  else if (err instanceof QuotaExceededError) { /* err.limit, err.retryAfterSeconds */ }
  else if (err instanceof ToolRefusalError) { /* err.message says why the server refused */ }
  else throw err;
}

Methods

| Method | Returns | |---|---| | runBacktest(spec, {lots, detail}) | Promise<BacktestResult> | | getBacktest(backtestId, detail?) | Promise<BacktestResult> | | describeCoverage() | Promise<Record<string, unknown>> | | explainMethodology(topic?) | Promise<Record<string, unknown>> | | listStrategies({order, limit}) | Promise<Record<string, unknown>> — {strategies: [...], bar: {...}, ...} | | search(query) / fetchDocument(id) | Promise<Record<string, unknown>> | | StratifyClient.signup(email) (static) | Promise<SignupResponse> — includes api_key, shown once |

detail: "summary" (aggregates only), "standard" (default — equity curve, breakdowns, first 25 trades), "full" (every stored trade).

fetch is named fetchDocument on the client so it doesn't collide with the global fetch this library uses internally.

npx stratify-mcp — for stdio-only clients

Most current MCP clients (claude.ai, Claude Desktop, Claude Code) speak Streamable HTTP directly — point them at https://stratify-mcp.aeon-labs.site/mcp with your key as a bearer header and skip this section entirely. This proxy exists only for a client that can only run a local stdio server:

{
  "mcpServers": {
    "stratify": {
      "command": "npx",
      "args": ["stratify-mcp-proxy"],
      "env": { "STRATIFY_API_KEY": "sk_live_..." }
    }
  }
}

It is a dumb pipe: one JSON-RPC message per line on stdin, forwarded verbatim to POST /mcp, the response written back as one line on stdout. It does not add features or change behavior versus calling the HTTP endpoint directly.

Development

npm install
npm test     # builds, then runs against a mocked fetch -- no live server or key needed

License

MIT.