mcp-random
Click on "Deploy 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., "@mcp-random flip a coin"
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.
mcp-random
MCP server providing true randomness capabilities to Claude. This server gives Claude access to cryptographically secure random number generation for games, decision-making, sampling, simulations, and any operation requiring genuine randomness.
Why This Exists
Claude doesn't have access to true randomness - when asked to "pick a random number" or "flip a coin," it's actually making deterministic choices based on patterns in the conversation. This MCP server solves that limitation by providing access to cryptographically secure random functions.
Related MCP server: Random-Generator
๐ Installation
Prerequisites
Node.js (v18 or higher)
MCP-compatible client (like Claude Desktop)
Quick Install
# Clone the repository
git clone https://github.com/yourusername/mcp-random.git
cd mcp-random
# Install dependencies
npm install
# Build the TypeScript code
npm run buildConfigure Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"random": {
"command": "node",
"args": ["/absolute/path/to/mcp-random/dist/index.js"]
}
}
}Restart Claude Desktop to load the server.
๐ Available Functions
Basic Random Numbers
random_integer(min, max)
Generate a random integer between min and max (inclusive).
Example: random_integer(1, 10) โ 7random_float(min, max, precision?)
Generate a random floating-point number.
Example: random_float(0, 1, 2) โ 0.42Random Selection
random_choice(options)
Pick one random item from an array.
Example: random_choice(["red", "green", "blue"]) โ "green"random_sample(array, count)
Pick multiple unique items from an array (no repeats).
Example: random_sample([1,2,3,4,5], 3) โ [2,5,1]random_shuffle(array)
Randomly reorder an array.
Example: random_shuffle([1,2,3,4]) โ [3,1,4,2]random_weighted_choice(options, weights)
Pick an option based on weights (higher weight = more likely).
Example: random_weighted_choice(["A", "B", "C"], [1, 2, 1])
โ "B" (twice as likely as A or C)Games & Decisions
flip_coin(count?)
Flip one or more coins.
Example: flip_coin() โ "heads"
Example: flip_coin(3) โ ["heads", "tails", "heads"]roll_dice(sides, count?)
Roll dice with any number of sides.
Example: roll_dice(6) โ 4
Example: roll_dice(20, 2) โ {"rolls": [15, 8], "sum": 23}Security & Identifiers
random_uuid()
Generate a UUID v4.
Example: random_uuid() โ "550e8400-e29b-41d4-a716-446655440000"random_password(length?, options?)
Generate a secure password.
Example: random_password(16) โ "Kj9#mP2$xQ5@nL7!"
Example: random_password(12, {symbols: false}) โ "Kj9mP2xQ5nL7"Options:
uppercase: Include A-Z (default: true)lowercase: Include a-z (default: true)numbers: Include 0-9 (default: true)symbols: Include special characters (default: true)excludeSimilar: Skip confusing characters like 0/O, 1/l (default: false)
random_bytes(count, encoding?)
Generate random bytes for cryptographic use.
Example: random_bytes(16, 'hex') โ "a3f2b8c9d4e5f6789abcdef012345678"Advanced Functions
random_normal(mean?, stddev?)
Generate numbers from a normal distribution (bell curve).
Example: random_normal(100, 15) โ 97.3 (IQ-like distribution)Documentation
help()
Get detailed documentation for all functions.
๐ฏ Use Cases
Decision Making
"Should I do X or Y?" โ flip_coin()
"Pick one of these options for me" โ random_choice([...])
"Help me prioritize these tasks" โ random_shuffle([...])Games
"Roll for initiative" โ roll_dice(20)
"Draw 5 cards from the deck" โ random_sample(deck, 5)
"Shuffle this deck" โ random_shuffle(cards)Creative Writing
"Pick a random character trait" โ random_choice(traits)
"Generate a character name" โ random_weighted_choice(names, popularity)
"Create a random scenario" โ multiple random_choice callsData & Testing
"Generate test data" โ random_integer, random_float
"Sample from this dataset" โ random_sample
"Create a test ID" โ random_uuid
"Generate API keys" โ random_bytesSimulations
"Monte Carlo simulation" โ random_normal
"Probability experiment" โ random_float(0, 1)
"A/B testing" โ random_weighted_choice๐ง Development
# Build TypeScript
npm run build
# Run tests
npm test
# Lint code
npm run lint
# Development mode (build & run)
npm run dev๐ Technical Details
All randomness uses Node.js
cryptomodule (cryptographically secure)No predictable patterns or biases
No state maintained between calls
TypeScript for type safety
Comprehensive error handling
๐ License
MIT License - see LICENSE file for details.
๐ค Contributing
Contributions welcome! Please feel free to submit a Pull Request.
๐ก Fun Facts
Claude requested this tool be built after recognizing its own lack of randomness
The first suggested use case was implementing a tarot card reader
This tool enables Claude to play games fairly, make unbiased choices, and run true simulations
"I don't have a random function. You should have a random function. Now that is a cool MCP server." - Claude
Available Tools
13 toolsflip_coinC
Flip a coin (or multiple coins)
Inputs: count.
helpA
Get comprehensive documentation for all random functions
Inputs: no named parameters.
random_bytesB
Generate random bytes
Inputs: count (required), encoding.
random_choiceA
Randomly select one item from an array of options
Inputs: options (required).
random_floatA
Generate a random floating-point number between min and max
Inputs: max (required), min (required), precision.
random_integerA
Generate a random integer between min and max (inclusive)
Inputs: max (required), min (required).
random_normalA
Generate a random number from a normal distribution
Inputs: mean, stddev.
random_passwordB
Generate a secure random password
Inputs: length, options.
random_sampleA
Randomly select multiple unique items from an array (without replacement)
Inputs: array (required), count (required).
random_shuffleA
Return a shuffled copy of the input array
Inputs: array (required).
random_uuidA
Generate a random UUID v4
Inputs: no named parameters.
random_weighted_choiceA
Select an option based on weighted probabilities
Inputs: options (required), weights (required).
roll_diceC
Roll dice with specified number of sides
Inputs: sides (required), count.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 13 tools
Each tool has a clearly distinct purpose, covering different random distributions, selection methods, and output types. While random_choice, random_sample, and random_weighted_choice all involve selecting from arrays, their behaviors are well-differentiated by descriptions and parameters.
Most tools follow the random_ prefix pattern, but flip_coin, roll_dice, and help deviate. The deviations are intuitive and still readable, but the naming is not fully uniform.
13 tools is well-scoped for a random utility server, covering common categories like number generation, selection, shuffling, bytes, UUIDs, and passwords without unnecessary overlap or bloat.
The tool set is comprehensive for its domain, including uniform and normal distributions, weighted and non-weighted selections, sampling, shuffling, byte generation, passwords, and simple helpers like coin flip and dice roll. No major gaps are evident.
Related MCP Connectors
Hosted X Ads MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Free MCP server for WordPress: Claude and ChatGPT connect with OAuth. No account, cap or API key.
Related MCP Servers
- AlicenseAqualityCmaintenanceProduction-ready MCP server that provides LLMs with essential random generation abilities, including random integers, floats, choices, shuffling, and cryptographically secure tokens.7152 PyPI50MIT
- AlicenseAqualityDmaintenanceAn encrypted and secure random number generation server that complies with the MCP protocol, suitable for AI applications, LLMS, and other systems that require high-quality random numbers.72Apache 2.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that generates random numbers by using national weather data as entropy seeds. It provides a unique way to generate random values through weather API integration within the Model Context Protocol.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceAn MCP server that enables Claude to generate Minecraft structures from natural language descriptions.1MIT