Simulate Monte Carlo logo

Simulate Monte Carlo

Runs paid Monte Carlo simulations for compound and conditional probabilities with declared distributions and boolean expressions.

Install Simulate Monte Carlo

Pick your client, then add it in one click or paste the config.

SSE (Remote)
Server URL
http://localhost:8787/mcp

Remote servers are added in the app, not the config file: Customize → Connectors → Add custom connector, then paste this URL.

Overview

The simulate-monte-carlo MCP server estimates compound and conditional probabilities by running actual random trials. Its single tool accepts named variables, supported probability distributions, an event expression, and optionally a condition for rejection-sampling estimates of P(event | condition). Results can be reproduced by reusing the returned seed. Reach for it when you need a bounded, self-contained probability estimate rather than a model-generated guess, while accounting for its $0.03 USDC Base mainnet charge.

Use cases

  • Estimate a compound event across multiple random variables
  • Calculate a conditional probability with rejection sampling
  • Reproduce a simulation using a returned seed
  • Model weighted discrete outcomes such as dice
  • Compare probability estimates under bounded trial counts

Key features

  • Monte Carlo estimates for compound events
  • Conditional probability via rejection sampling
  • Seven supported probability distributions
  • Seeded, reproducible pseudorandom sampling
  • Restricted expression interpreter
  • x402 billing on Base mainnet

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

5/5 checks healthy over the last 35d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
Last commit2mo agoMost recent push to the default branch.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Simulate Monte Carlo works

What simulate-monte-carlo does

The simulate-monte-carlo MCP server exposes one MCP tool, simulate_monte_carlo, for estimating probabilities through repeated random sampling. A request declares named random variables and assigns each one a distribution. Supported distributions are uniform, normal, Bernoulli, binomial, Poisson, exponential, and discrete weighted outcomes.

The tool evaluates an event expression for every trial and reports the observed probability. Supplying a second boolean expression turns the calculation into a conditional estimate: trials are retained when the condition is true, and the event is then measured within that subset. For example, separate die variables can be used to estimate the probability that their sum exceeds a threshold when the first die has a particular value.

How it works

The simulate-monte-carlo MCP server samples each variable, evaluates the event, and counts matching trials. It uses a seedable mulberry32 pseudorandom generator. A response includes a seed that can be passed to a later request to reproduce the same result exactly.

Expressions are processed by a restricted tokenizer, parser, and interpreter rather than JavaScript evaluation. The supported grammar includes numeric literals, declared variable names, arithmetic operators, comparisons, boolean operators, parentheses, and min, max, and abs. This prevents caller-provided expressions from becoming executable code.

Each call is isolated. The server does not use a database or retain simulation state between requests. It creates a fresh MCP server for each call, apart from billing configuration that may be cached in memory by the Worker isolate.

Setup and configuration

The hosted endpoint is https://simulate-monte-carlo.encodari.workers.dev/mcp. Calls use MCP over the Cloudflare Workers HTTP handler and responses are delivered as Server-Sent Events containing JSON-RPC messages.

For local development, install dependencies with npm install, run tests with npm test, and start the Worker with npm run dev. The real Wrangler runtime requires macOS 13.5 or newer; Linux and Windows are also supported according to the project instructions. On older macOS versions, npm run dev:node runs the same fetch() handler through a plain Node shim at http://localhost:8787/mcp.

The local Node mode reads Coinbase Developer Platform credentials from ~/.mcp-tools-factory-credentials.env. The hosted service charges $0.03 USDC for each simulation through x402 on Base mainnet. Payment information travels in MCP JSON-RPC metadata. An unpaid call returns an MCP error containing the accepted network, amount, and recipient details so a client can pay and retry.

Tools and capabilities

The simulate_monte_carlo tool supports:

  • Up to 10 declared variables.
  • Between 100 and 100,000 trials, with 10,000 as the default.
  • Expressions up to 500 characters.
  • Binomial distributions with n up to 1,000.
  • Poisson distributions with lambda up to 1,000.
  • Discrete distributions with at most 20 outcomes.
  • A combined sampling-budget check to limit expensive variable and trial combinations.

The simulate-monte-carlo MCP server is suitable for quick estimates involving several random variables, including conditional events that are awkward to calculate directly.

Limitations and notes

This tool estimates probabilities; it does not provide exact analytical results. Its confidence interval uses the normal, or Wald, approximation, which can be inaccurate when the estimated probability is near zero or one. Treat those intervals as quick estimates rather than high-stakes statistical guarantees.

There is no persistent result store or database. Requests that exceed the variable, expression, distribution, trial, or combined sampling limits are rejected. The production billing configuration uses real USDC on Base mainnet, while development can be changed to Base Sepolia by modifying the network setting in src/payments.ts.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Simulate Monte Carlo

simulate-monte-carlo is an MCP server that connects AI clients to a Monte Carlo probability simulator through the `simulate_monte_carlo` tool. It samples declared variables from supported distributions, evaluates event and optional condition expressions, and estimates compound or conditional probabilities. Calls cost $0.03 USDC on Base mainnet.

Install it locally by cloning the repository, running `npm install`, and starting either `npm run dev` for Wrangler or `npm run dev:node` for the Node shim. The hosted endpoint is also available at `https://simulate-monte-carlo.encodari.workers.dev/mcp`.

Provide an `event` expression and a `condition` expression to `simulate_monte_carlo`. The server uses rejection sampling to estimate the event probability among trials where the condition is true, producing an estimate of P(event | condition).

Pass the seed returned by a previous response in a later request. The server uses a seedable `mulberry32` pseudorandom generator, so the same simulation inputs and seed reproduce the exact result.

Yes, Cursor can connect when configured for the server's MCP endpoint. The project exposes a standard MCP HTTP handler at the hosted URL and does not document a Cursor-specific setup requirement.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewSimulate Monte Carlo AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/simulate-monte-carlo?style=directory)](https://allmcps.com/mcp/simulate-monte-carlo)
HTML Embed
<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>