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

stonex-mcp

v0.1.1

Published

Typed TypeScript client for the StoneX Client (`torchapi`) REST API, plus an MCP server that exposes those endpoints as tools.

Readme

stonex-mcp

Typed TypeScript client for the StoneX Client (torchapi) REST API, plus an MCP server that exposes those endpoints as tools.

Auth is not automated (no Okta/MFA in this project). You log into StoneX Client in a browser, export a cookies.txt file, and pass the path to that file on the CLI.

Requirements

  • Bun 1.1+ (for local development / prepare build)
  • Node.js 18+ (to run the published bin bundle)

Install

bun install

Auth: cookies.txt

  1. Install a browser extension that exports Netscape cookies.txt (e.g. Get cookies.txt LOCALLY).
  2. Log into https://client.stonex.com/client/.
  3. Export cookies for client.stonex.com to a file (e.g. client.stonex.com_cookies.txt).
  4. Pass that path to the server:
stonex-mcp --cookies /path/to/client.stonex.com_cookies.txt

The server reads session cookies from that file and calls GET https://client.stonex.com/client/token only when it needs a Bearer JWT.

Token cache

Derived access tokens are cached on disk so repeated MCP tool calls do not mint a new token every time:

| OS | Path | |----|------| | Windows | %LOCALAPPDATA%\stonex-mcp\access-token.json | | macOS | ~/Library/Caches/stonex-mcp/access-token.json | | Linux | ${XDG_CACHE_HOME:-~/.cache}/stonex-mcp/access-token.json |

When the cached JWT is missing or near expiry, a new token is requested using the cookies file and written back to the cache. If refresh starts failing with 401, re-export cookies after logging into StoneX Client again.

Treat the cookies file and cached token like passwords. Do not commit them.

Run the MCP server

bun start -- --cookies /path/to/client.stonex.com_cookies.txt
# or after build:
node dist/stonex-mcp.js --cookies /path/to/client.stonex.com_cookies.txt

Cursor / Claude Desktop config

{
  "mcpServers": {
    "stonex": {
      "command": "npx",
      "args": [
        "-y",
        "stonex-mcp",
        "--cookies",
        "C:/Users/YOU/Downloads/client.stonex.com_cookies.txt"
      ]
    }
  }
}

npx runs the built Node bundle (dist/stonex-mcp.js, produced by bun run build / prepare). Local equivalent: "command": "bun", "args": ["run", "/path/to/stonex-mcp/src/cli.ts", "--cookies", "/path/to/cookies.txt"].

Typed client

import { StoneXClient } from "./src/client/index.ts";
import { sessionCookieFromCookiesTxtFile } from "./src/auth/cookiesTxt.ts";
import { resolveAuth } from "./src/auth/resolveAuth.ts";
import { writeTokenCache } from "./src/auth/tokenCache.ts";

const { accessToken, sessionCookie } = await resolveAuth(
  "/path/to/client.stonex.com_cookies.txt",
);

const client = new StoneXClient({
  accessToken,
  sessionCookie,
  onAccessToken: (token) => writeTokenCache(token),
});

const accounts = await client.getAccounts();
const summary = await client.getAccountSummary({
  accountNumber: accounts[0]!.acctNo,
});

Or build a cookie header yourself with sessionCookieFromCookiesTxtFile(...).

Endpoints mirror the StoneX Client SPA (https://vulcan.stonex.com/torchapi): accounts, balances, summary, positions, activity, performance, projected income, documents, and related user/account metadata.

Security note

Local capture files (stonex-fetch.js, stonex-har.json, stonex-urls.txt) and fixtures/ can contain live secrets and account data. They are gitignored. Rotate credentials if those files were shared.