Random Number MCP Server
Essential utilities for generating random numbers from Python's standard library, including pseudorandom and cryptographically secure operations for integers, floating-point numbers, weighted sampling, list shuffling, and secure token generation.
Get this MCP server
Essential utilities for generating random numbers from Python's standard library, including pseudorandom and cryptographically secure operations for integers, floating-point numbers, weighted sampling, list shuffling, and secure token generation.
Installation
UVX
uvx random-number-mcp
Development Setup
git clone https://github.com/example/random-number-mcp
cd random-number-mcp
uv sync --dev
MCP Inspector - Local Development
npx @modelcontextprotocol/inspector uv run random-number-mcp
MCP Inspector - Production
npx @modelcontextprotocol/inspector uvx random-number-mcp
Configuration
Claude Desktop
{
"mcpServers": {
"random-number": {
"command": "uvx",
"args": ["random-number-mcp"]
}
}
}
Development Configuration
{
"mcpServers": {
"random-number-dev": {
"command": "uv",
"args": [
"--directory",
"<path_to_your_repo>/random-number-mcp",
"run",
"random-number-mcp"
]
}
}
}
Available Tools
| Tool | Description |
|---|---|
random_int |
Generate random integers |
random_float |
Generate random floating-point numbers |
random_choices |
Select elements from a list (with optional weights) |
random_shuffle |
Return a new list with shuffled elements |
random_sample |
Select k unique elements from a population |
secure_token_hex |
Generate cryptographically secure hex tokens |
secure_random_int |
Generate cryptographically secure integers |
Features
- Generate pseudorandom numbers for integers and floating-point numbers
- Weighted random selection from lists
- List shuffling and sampling without replacement
- Cryptographically secure token generation
- Cryptographically secure random integers
- Built entirely on Python's standard library (random and secrets modules)
- Suitable for both simulations/games and security-critical applications
Usage Examples
Generate a random integer between 1 and 100
Generate a random floating-point number between 0.5 and 2.5
Select 2 elements from a list with custom weights
Randomly shuffle a list of elements
Select 2 unique elements from a population
Resources
Notes
This package provides both standard pseudorandom functions (fast but not cryptographically secure) and secure functions (slower but cryptographically secure). Requires Python 3.10+ and uses the uv package manager for development.