random-mcp
Provides random number generation tools (random integers, floats, weighted choices, and probability distribution samples) for use within Notion AI.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@random-mcpPick a random integer between 1 and 100."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
random-mcp
A random number generation MCP (Model Context Protocol) server that runs on Cloudflare Workers. You can generate integers, floating-point numbers, weighted choices, and samples from various probability distributions from MCP clients such as Notion Agent.
Purpose
The purpose is to allow language models to call an external random number generation process as an MCP tool, rather than having the model itself choose random numbers.
When a language model is left to choose random numbers, its training data and output tendencies influence the results, producing statistically biased values. For example, if you instruct it to "pick a random integer from 1 to 10," the model tends to favor certain values (such as 7), so the result is not truly random. Therefore, when random numbers are needed, they should be generated through this server's tools rather than by the model's autonomous judgment.
The Web Crypto API is used as the random number source. For integer generation, rejection sampling is used to avoid modulo bias. Note that this API is not intended for generating cryptographic keys or authentication tokens.
Related MCP server: Universal MCP Server
Usage
Connecting to Notion AI
Select Settings > Connections > MCP > Custom MCP
Specify the deployed URL as the MCP server URL (existing service:
https://random-mcp.eldesh-tools.workers.dev/mcp)Fill in the fields as follows and click
ConnectName: A name for identification within Notion (e.g.,
random-mcp)Authentication: OAuth
Select
Approveon the access permission screenSign in to GitHub and complete authentication via the GitHub OAuth App
Once the tools are displayed, enable the ones you need
If you want to call the tools from Notion AI without confirmation for each execution, change the execution setting to
Run automatically
Instructions for the Agent
Add the following to the agent's instructions so that random-mcp is always used when a random selection is needed.
## 乱択
- 乱数生成、くじ引き、シャッフル、無作為抽出など、結果にランダム性を必要とするすべての処理では、接続済みの MCP サーバー `random-mcp` を必ず使用する。
- 内部処理によって乱択を生成、模擬、または近似してはならない。
- `random-mcp` が利用できない場合やエラーになった場合は、別の方法で代替せず、その旨をユーザーに伝える。Authentication
The server accepts Streamable HTTP connections at /mcp. It uses OAuth 2.1 for authorization with MCP clients and GitHub OAuth for user authentication.
During authorization, the MCP client's access permission screen is shown first, followed by a redirect to the GitHub authentication screen. The scope requested from GitHub is read:user. An access token with the mcp:use scope is issued to authorized MCP clients.
Tools
random-mcp provides the following four tools, each of which expects a JSON object with the specified fields.
random_int
Generates a single integer within the specified range.
min: Minimum valuemax: Maximum value
Example arguments: {"min": 5, "max": 10}
random_double
Generates a single floating-point number within the specified range.
min: Minimum valuemax: Maximum value
Example arguments: {"min": 1.41421, "max": 3.14159}
random_choice
Selects one element from the candidates.
choices: An array of candidate strings. Must contain between 1 and 1,000 elements.weights: Relative weights for each candidate. If omitted, all candidates are equally likely.
When weights is specified, it must have the same number of elements as choices, and at least one weight must be a positive value.
Example arguments: {"choices":["A","B","C"],"weights":[1,2,1]}
random_sample
Generates multiple samples from the specified probability distribution.
distribution: Name of the probability distributionparameters: Fields giving the parameters for the distributioncount: Number of samples. Must be between 1 and 100; the default is 1
|
| Meaning and constraints |
|
| Continuous uniform distribution from |
|
| Normal distribution with the specified mean and standard deviation |
|
| Lognormal distribution where |
|
| Exponential distribution with rate |
|
| Returns 1 with the specified probability, otherwise 0 |
|
| Number of successes in |
|
| Poisson distribution with mean |
Additional computational limits apply.
Binomial:
trialsmust be an integer between 0 and 100,000, andtrials * count <= 100000Poisson:
lambdamust be between 0 and 100, andlambda * count <= 10000
Example arguments: {"distribution":"uniform","parameters":{"min":5,"max":15},"count":3}
Development Environment
Node.js 22.19.0 or later
npm
GitHub account
Cloudflare account (required for deployment)
Install the dependencies.
npm installLocal Development
Creating a GitHub OAuth App
Create an OAuth App in GitHub's Developer settings. Since the callback URL differs between local and production environments, create a separate OAuth App for each.
Set the following values for the local development OAuth App.
Homepage URL:
http://localhost:8787Authorization callback URL:
http://localhost:8787/callback
For the production OAuth App, replace http://localhost:8787 with the origin of the deployed Worker. The callback URL for the existing service is https://random-mcp.eldesh-tools.workers.dev/callback.
After creating the app, obtain the Client ID and Client secret. The OAuth scope this application requests from GitHub is read:user.
Environment Variables
Create .dev.vars in the project root.
GITHUB_CLIENT_ID=<GitHub OAuth App の Client ID>
GITHUB_CLIENT_SECRET=<GitHub OAuth App の Client secret>
COOKIE_ENCRYPTION_KEY=<Cookie の暗号化に使用するランダムな値>COOKIE_ENCRYPTION_KEY can be generated, for example, with the following command.
openssl rand -hex 32The temporary OAuth state is stored in the Cloudflare KV namespace specified by the OAUTH_KV binding in wrangler.jsonc. If you deploy to a different Cloudflare account, create a KV namespace and replace the id in wrangler.jsonc with that namespace ID.
Starting the Server
Start the local server.
npm run devThe MCP endpoint is normally available at the following URL.
http://localhost:8787/mcp[!NOTE] Even if Wrangler displays a warning that it cannot access
Request.cf, as long as it finally showsReady on http://localhost:8787and this project does not useRequest.cf, you can continue with verification.
Verification with MCP Inspector
With the local server running, launch the MCP Inspector web UI.
npx --yes @modelcontextprotocol/inspector@latestIn the Inspector, select Streamable HTTP and set the connection URL to http://localhost:8787/mcp. When connecting, the OAuth authorization flow starts in the browser, so allow access and complete GitHub authentication. To check the production environment, change the connection URL to the deployed MCP URL.
After connecting, verify that the tools listed in Tools appear on the Tools screen.
Deploying to Cloudflare Workers
Log in to Cloudflare.
npx wrangler loginRegister the production GitHub OAuth App credentials and the cookie encryption key as Cloudflare Secrets.
npx wrangler secret put GITHUB_CLIENT_ID
npx wrangler secret put GITHUB_CLIENT_SECRET
npx wrangler secret put COOKIE_ENCRYPTION_KEYVerify that the GitHub OAuth App's Authorization callback URL points to /callback on the deployed Worker, and that OAUTH_KV in wrangler.jsonc points to an available KV namespace.
Deploy.
npm run deployThe public URL is typically in the following format.
https://random-mcp.<subdomain>.workers.dev/mcp[!IMPORTANT]
.dev.varsis not automatically reflected in Cloudflare. The production Worker references the values registered in Cloudflare Secrets.
License
Released under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA deployable MCP server on Cloudflare Workers that enables using custom tools with AI models without requiring authentication.
- FlicenseNot gradedqualityDmaintenanceA universal MCP server providing calculator and API calling tools, deployable on Cloudflare Workers.
- FlicenseNot gradedqualityDmaintenanceA remote MCP server with GitHub OAuth deployed on Cloudflare Workers, providing math, GitHub user info, and image generation tools.
- FlicenseNot gradedqualityCmaintenanceA remote MCP server deployed on Cloudflare Workers with OAuth login, enabling tools like math operations to be called via natural language.
Related MCP Connectors
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/eldesh/random-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server