SuperAPIAI Directory

random-number-mcp

github.com · AI developer platforms

random-number-mcp is an MCP server for large language models (LLMs) that provides random number generation capabilities and is built entirely on the Python standard library. It supports generating random integers, random floats, weighted or unweighted sampling with replacement, list shuffling, sampling without replacement, and cryptographically secure hexadecimal tokens and secure random integers based on the secrets module. The project also distinguishes between ordinary pseudorandom functions and cryptographically secure functions; the former are suitable for scenarios such as simulation and games, while the latter are suitable for security scenarios such as tokens and keys. Users can connect to this server through the Claude Desktop configuration file, or use the uv package manager or MCP Inspector for development and debugging.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS

About this tool

random-number-mcp is a production-ready MCP server designed to provide LLMs with basic random generation capabilities. The project is built entirely on the Python standard library and does not depend on third-party runtime libraries.

In terms of purpose, this server encapsulates common random number operations as MCP tools, so that LLMs can directly call them when they need random integers, random floats, random sampling, shuffling, or secure tokens, instead of making up random results themselves.

Main capabilities include: random_int generates a random integer between low and high (inclusive); random_float generates a random float between low and high, with low defaulting to 0.0 and high defaulting to 1.0; random_choices selects k elements from population with replacement, with optional weights to specify weights, and k defaults to 1; random_shuffle returns a new list with the elements randomly ordered; random_sample selects k unique elements from population without replacement; secure_token_hex uses the secrets module to generate a cryptographically secure random hexadecimal token, with nbytes defaulting to 32; secure_random_int generates a cryptographically secure random integer less than upper_bound (exclusive).

In terms of security, the project clearly distinguishes two types of functions: random_int, random_float, random_choices, and random_shuffle use Python's random module, which is fast but not cryptographically secure, and are suitable for scenarios such as simulation and games; secure_token_hex and secure_random_int use the secrets module, which is slower but cryptographically secure, and are suitable for scenarios such as tokens and keys.

In terms of usage, this server can be added to the Claude Desktop configuration file: the macOS path is ~/Library/Application Support/Claude/claude_desktop_config.json, and the Windows path is %APPDATA%/Claude/claude_desktop_config.json. During configuration, <path_to_your_repo>/random-number-mcp should be replaced with the absolute path of the cloned repository. The project also mentions that the uv package manager can be used and provides information about MCP Client Config. For development and debugging, the MCP Inspector npm tool can be used. The MCP name is io.github.zazencodes/random-number-mcp.

Applicable scenarios include simulation and game logic that require reproducible or non-secure randomness, as well as token generation that requires cryptographically secure random values. In terms of limitations, the materials do not provide details such as performance benchmarks, concurrency capabilities, or deployment environment requirements; ordinary random functions should not be used for security-sensitive purposes. The project uses the MIT license.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools