Back to Browse

Dsr Web MCP Server

Developer ToolsModerate5.9MCP RegistryRemote
Free

Server data from the Official MCP Registry

Is a backtest's Sharpe ratio real or luck? Deflated Sharpe Ratio check with green/yellow/red.

About

Is a backtest's Sharpe ratio real or luck? Deflated Sharpe Ratio check with green/yellow/red.

Remote endpoints: streamable-http: https://dsr-web.pages.dev/mcp

Security Report

5.9
Moderate5.9Moderate Risk

This is a client-side Deflated Sharpe Ratio calculator with a stateless MCP endpoint, input validation, rate limiting, and no hardcoded secrets in the reviewed code; the only secret (SHARE_SECRET) is read from the environment. Minor observations include that the share-link feature transmits user return series to the server (clearly disclosed in the UI and not stored or logged), that the MCP endpoint is unauthenticated but rate-limited and only performs computation, and that the rate limiter is in-memory per instance. Permissions match the stated purpose, so the score remains in the good range. Supply chain analysis found 5 known vulnerabilities in dependencies (0 critical, 1 high severity).

7 files analyzed · 9 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Found in Source Code

Found by scanning the linked source code. This listing connects to a hosted endpoint, so none of this runs on your machine: it describes what the server software does where it is hosted.

HTTP Network Access

Connects to external APIs or services over the internet.

env_vars

Applies to the server that hosts this plugin, not to your machine.

How to Connect

Remote Plugin

No local installation needed. Your AI client connects to the remote endpoint directly.

Add this to your MCP configuration to connect:

{
  "mcpServers": {
    "io-github-jagerstromebbe01-dot-dsr-web": {
      "url": "https://dsr-web.pages.dev/mcp"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

Backtest Overfitting Calculator

A free, static, client-side calculator for the Deflated Sharpe Ratio (DSR) — Bailey & López de Prado (2014). All calculations run in the browser; nothing entered into the calculator is ever sent to a server.

What's here

  • src/lib/dsr.ts — the core math (PSR, the deflation benchmark SR*₀, DSR).
  • src/lib/check.ts — pure "backtest check": raw returns + N → DSR and a green/yellow/red verdict (no React, reusable in a future API).
  • src/lib/parseReturns.ts — parsing of pasted text / CSV return series.
  • src/pages/CheckPage.tsx — the backtest-check UI (default page, #check).
  • src/lib/normal.ts — dependency-free standard normal CDF / inverse CDF.
  • src/lib/evaporationCurve.ts — shared chart geometry (used by both the on-page SVG chart and the shareable PNG, so they can't drift apart).
  • src/lib/shareImage.ts — canvas-based PNG export.
  • src/pages/CalculatorPage.tsx — the calculator UI.
  • src/pages/ArticlePage.tsx — "Why your backtest is probably lying".
  • src/lib/dsr.test.ts — Vitest unit tests, including a cross-check against an external Python reference implementation (see below).
  • tools/ — one-off Python scripts: gen_reference_values*.py generate the test fixtures in tools/reference_values*.json, gen_og_image.py generates public/og-image.png (requires Pillow and Windows fonts — only needs rerunning if the share image's design changes). None of these are part of the shipped site.

Running locally

npm install
npm run dev

Opens at http://localhost:5173.

Running tests

npm test

Building

npm run build

Output goes to dist/. It's a fully static site — no server, no database, no build-time secrets.

Regenerating the reference test values (optional)

Only needed if src/lib/dsr.ts changes and you want to re-verify it against the reference implementations. Requires Python 3 with scipy/numpy.

gen_reference_values.py cross-checks this project's "V unknown" mode against an external Deflated Sharpe Ratio implementation — it does not ship or vendor one. Point it at your own local copy (a file defining deflated_sharpe_ratio(observed_sr, n_trials, n_obs, skew=0.0, kurt=3.0) per Bailey & López de Prado (2014)) via an environment variable or a command-line argument:

cd tools

# V-unknown mode: point at your own local reference implementation
REFERENCE_DSR_IMPL=/path/to/deflated_sharpe_ratio.py python gen_reference_values.py
# or: python gen_reference_values.py /path/to/deflated_sharpe_ratio.py

# V-measured mode: independent scipy implementation, no external file needed
python gen_reference_values_v_measured.py

Both scripts only ever write inside tools/ in this repo.

API, share links and badge (Cloudflare Pages Functions)

  • functions/api/check.ts + functions/_lib/checkApi.ts — POST /api/check (reuses runBacktestCheck, 1 MB / 100,000-value limit, 30 requests/min/IP in-memory rate limit, open CORS). Returns are never stored or logged.
  • functions/r.ts, functions/badge.svg.ts, functions/_lib/shareApi.ts — signed result page /r?... and SVG badge /badge.svg?....
  • src/lib/share.ts — HMAC-SHA256 signing of the result summary.
  • Needs ONE secret, SHARE_SECRET, set in the Cloudflare dashboard (never in the repo): Workers & Pages → dsr-web → Settings → Variables and Secrets → Add → type Secret. Without it the API still works but returns shareUrl: null, and every link is shown as "unverified".
  • Local full-stack test: npm run build, create .dev.vars containing SHARE_SECRET=anything-for-local-testing (gitignored), then npx wrangler@4 pages dev dist and open http://localhost:8788.
  • The build prerenders every page to static HTML (scripts/prerender.mjs), so crawlers that don't run JavaScript see the text.

Deploying for free

Option A: Cloudflare Pages

  1. Push this repo to GitHub (or GitLab).
  2. Go to the Cloudflare dashboard → Workers & Pages → Create → Pages → Connect to Git.
  3. Select this repository.
  4. Build settings:
    • Framework preset: Vite
    • Build command: npm run build
    • Build output directory: dist
  5. Click Save and Deploy. Cloudflare gives you a *.pages.dev URL immediately; a custom domain can be attached afterwards under Custom domains.

Option B: GitHub Pages

  1. Push this repo to GitHub.
  2. In vite.config.ts, set base: '/<your-repo-name>/' (only needed if deploying to https://<user>.github.io/<repo-name>/ rather than a custom domain or a root *.github.io repo).
  3. Add a GitHub Actions workflow (.github/workflows/deploy.yml) that runs npm ci && npm run build and publishes dist/ with actions/deploy-pages, or simply build locally and push the dist/ folder to a gh-pages branch using a tool like gh-pages (npm i -D gh-pages, then npx gh-pages -d dist).
  4. Enable Pages in the repo's Settings, pointing at the gh-pages branch (or the Actions workflow, if used).

Adding an email field later (not built yet)

A placeholder exists in the UI copy only — no form, no field, no third-party script. To add a real one later without a custom backend, the simplest options are:

  • Cloudflare Pages Functions (a functions/subscribe.ts file) writing to a KV namespace or forwarding to an email service's API.
  • A third-party form endpoint (e.g. Buttondown, ConvertKit, Formspree) — add the <form action="..."> pointing at their endpoint; no backend code needed on this side, but review their privacy terms first since that reintroduces a third party the current "your numbers never leave your browser" claim doesn't apply to (the email field only, not the calculator itself).

Notes on the math

  • All Sharpe ratios inside the formulas are per period, never annualized. The UI converts for you based on the frequency you pick.
  • Kurtosis is in the non-excess convention (normal distribution = 3). The UI has a toggle if your kurtosis is in the excess (normal = 0) convention instead.
  • V unknown mode (default) approximates V — the variance of the tried strategies' per-period Sharpe ratios — as 1 / (T - 1), the variance of the Sharpe estimator itself evaluated at SR = 0. This implicitly treats "the typical tried strategy" as pure noise; it's a standard, conservative fallback, not a precise measurement.
  • V measured mode lets you supply an actual variance, either directly or computed from a pasted list of the Sharpe ratios of everything you tried.

Reviews

No reviews yet

Be the first to review this server!