Real Monte Carlo simulation of a compound event/conditional probability. Paid via x402.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Remote MCP server (Cloudflare Workers) with one tool that estimates a compound event or conditional probability by actually running a Monte Carlo simulation:
simulate_monte_carlo β declare named random variables (uniform, normal, bernoulli, binomial, poisson, exponential, discrete), an event boolean expression over those names (e.g. "a > 0.5 && b == 1"), and an optional condition expression to get a conditional probability P(event | condition) via rejection sampling. Real random sampling and real counting β not a model guess about what the probability should be.No database, no persistent state: each call builds a fresh McpServer (see createServer() in src/index.ts) and is self-contained. The PRNG is seedable (mulberry32): pass the seed returned in a previous response to reproduce the exact same result.
evalevent/condition are arbitrary caller-supplied strings. Running them through eval/Function would mean executing untrusted code inside the Worker. Instead, src/tools/monteCarlo.ts includes a small tokenizer + recursive-descent parser + AST interpreter that only understands numbers, declared variable names, arithmetic (+ - * /), comparisons (< <= > >= == !=), boolean logic (&& || !), parentheses, and a three-function whitelist (min, max, abs). There is no code execution path β the interpreter can't do anything beyond evaluate that narrow grammar.
Charges per call via x402 β real USDC payment on Base mainnet, against the Coinbase Developer Platform (CDP) facilitator. The payment travels inside the MCP JSON-RPC itself (_meta), not as an HTTP header; see src/payments.ts.
| Tool | Price |
|---|---|
simulate_monte_carlo | $0.03 USDC |
An unpaid tools/call returns isError: true with the accepts (network, amount, payTo) the client needs to pay and retry β not an unexplained exception.
Set from the start, not bolted on after: max 10 variables, 100β100,000 trials (default 10,000), 500-character expressions, binomial n β€ 1,000, poisson lambda β€ 1,000, and a discrete-outcome cap of 20. On top of the individual caps, a combined sampling-budget check (trials Γ sum(per-variable cost) β€ 5,000,000) rejects combinations that would be individually within limits but jointly too expensive β e.g. 100,000 trials against a binomial(n=1000) variable.
β οΈ Note on wrangler dev: the real Cloudflare Workers runtime (workerd) requires macOS 13.5+. If your Mac has an older version, wrangler dev (and npm run dev) will fail. This project includes a plain-Node shim that runs the exact same fetch() handler without needing workerd.
wrangler dev fails because of the macOS versionStarts at http://localhost:8787/mcp, reading CDP credentials from ~/.mcp-tools-factory-credentials.env (shared across all tools in this factory).
Responses come as Server-Sent Events (event: message + data: {...}); the data: line is the usual JSON-RPC response.
Deployed at https://simulate-monte-carlo.encodari.workers.dev/mcp (Cloudflare Workers). Published on the official MCP registry, Smithery, mcp.so, and with an open PR to awesome-mcp-servers.
eip155:84532) during development, change NETWORK in src/payments.ts.src/payments.ts).No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/simulate-monte-carlo)<a href="https://allmcps.com/mcp/simulate-monte-carlo"><img src="https://allmcps.com/api/badge/simulate-monte-carlo?style=directory" alt="Simulate Monte Carlo on AllMCPs" /></a>