MCP server · Cloudflare Workers

Reliable randomness for AI agents.

Move random decisions out of the language model. random-mcp generates integer and real-valued distributions, weighted choices, and repeated samples using the Web Crypto API.

A small, focused toolset

Three tools cover common randomization tasks. Every tool supports batched results through the count field.

Integer distributions

random_int

Generate integers from uniform, Bernoulli, binomial, or Poisson distributions.

uniformbernoullibinomialpoisson

Real-valued distributions

random_double

Generate floating-point values from uniform, normal, lognormal, or exponential distributions.

uniformnormallognormalexponential

Selection

random_choice

Select one or more strings, with optional weights and sampling with or without replacement.

weightedbatchreplacement

Language models predict. They do not draw lots.

A model may favor familiar-looking values when asked to choose randomly. This server performs the random operation outside the model so agents can rely on an explicit, auditable tool call.

Unbiased integer generation

Integer generation uses rejection sampling to prevent modulo bias, so no value becomes more likely merely because the source range does not divide evenly.

Distributions for each task

Choose uniform, Bernoulli, binomial, or Poisson distributions for integers, and uniform, normal, lognormal, or exponential distributions for real values.

Add it to an MCP client

Add a custom MCP server

Open your client's MCP connection settings and choose a custom Streamable HTTP server.

Enter the endpoint

Use the MCP endpoint shown above and select OAuth as the authentication method.

Approve and sign in

Approve the requested access, complete GitHub sign-in, and enable the tools you want to use.