Random Number

by zazencodes

320 downloads
Not rated
GitHub

About

Provides LLMs with essential random generation abilities, built entirely on Python's standard library.

Details

Author
zazencodes
Downloads
320
Categories
Developer Tools, Community, Other

- Generate random integers with random_int
- Generate random floats with random_float
- Choose items from a list (optional weights)
- Return a new shuffled list
- Generate cryptographically secure hex tokens
- Generate cryptographically secure integers

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Random Number
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

random_int

Generate a random integer between low and high (inclusive). Args: low: Lower bound (inclusive) high: Upper bound (inclusive) Returns: Random integer between low and high

random_float

Generate a random float between low and high. Args: low: Lower bound (default 0.0) high: Upper bound (default 1.0) Returns: Random float between low and high

random_choices

Choose k items from population with replacement, optionally weighted. Args: population: List of items to choose from k: Number of items to choose (default 1) weights: Optional weights for each item (default None for equal weights) Returns: List of k chosen items

random_shuffle

Return a new list with items in random order. Args: items: List of items to shuffle Returns: New list with items in random order

random_sample

Choose k unique items from population without replacement. Args: population: List of items to choose from k: Number of items to choose Returns: List of k unique chosen items

secure_token_hex

Generate a secure random hex token. Args: nbytes: Number of random bytes to generate (default 32) Returns: Hex string containing 2*nbytes characters

secure_random_int

Generate a secure random integer below upper_bound. Args: upper_bound: Upper bound (exclusive) Returns: Random integer in range [0, upper_bound)

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "random number": {
            "random-number": {
                "command": "uvx",
                "args": [
                    "random-number-mcp"
                ]
            }
        }
    }
}

McpServers

{
    "random-number": {
        "command": "uvx",
        "args": [
            "random-number-mcp"
        ]
    }
}

Essential random number generation utilities from the Python standard library, including pseudorandom and cryptographically secure operations for integers, floats, weighted selections, list shuffling, and secure token generation.

Looking for the agent skill version?random-number-skillsimplements the same random number generation strategy as an agent skill instead of an MCP server.

https://github.com/user-attachments/assets/303a441a-2b10-47e3-b2a5-c8b51840e362

Add this to your Claude Desktop configuration file:

macOS:~/Library/Application Support/Claude/claude_desktop_config.json
Windows:%APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "random-number": { "command": "uvx", "args": ["random-number-mcp"] } } }

Generate a random integer between low and high (inclusive).

- low(int): Lower bound (inclusive)
- high(int): Upper bound (inclusive)

{ "name": "random_int", "arguments": { "low": 1, "high": 100 } }

Generate a random float between low and high.

- low(float, optional): Lower bound (default: 0.0)
- high(float, optional): Upper bound (default: 1.0)

{ "name": "random_float", "arguments": { "low": 0.5, "high": 2.5 } }

Choose k items from a population with replacement, optionally weighted.

- population(list): List of items to choose from
- k(int, optional): Number of items to choose (default: 1)
- weights(list, optional): Weights for each item (default: equal weights)

{ "name": "random_choices", "arguments": { "population": ["red", "blue", "green", "yellow"], "k": 2, "weights": [0.4, 0.3, 0.2, 0.1] } }

Return a new list with items in random order.

{ "name": "random_shuffle", "arguments": { "items": [1, 2, 3, 4, 5] } }

Choose k unique items from population without replacement.

- population(list): List of items to choose from
- k(int): Number of items to choose

{ "name": "random_sample", "arguments": { "population": ["a", "b", "c", "d", "e"], "k": 2 } }

Generate a cryptographically secure random hex token.

- nbytes(int, optional): Number of random bytes (default: 32)

{ "name": "secure_token_hex", "arguments": { "nbytes": 16 } }

Generate a cryptographically secure random integer below upper_bound.

- upper_bound(int): Upper bound (exclusive)

{ "name": "secure_random_int", "arguments": { "upper_bound": 1000 } }

This package provides both standard pseudorandom functions (suitable for simulations, games, etc.) and cryptographically secure functions (suitable for tokens, keys, etc.):

- Standard functions(random_int,random_float,random_choices,random_shuffle): Use Python'srandommodule - fast but not cryptographically secure
- Secure functions(secure_token_hex,secure_random_int): Use Python'ssecretsmodule - slower but cryptographically secure

# Clone the repository git clone https://github.com/example/random-number-mcp cd random-number-mcp # Install dependencies uv sync --dev # Run tests uv run pytest # Run linting uv run ruff check --fix uv run ruff format # Type checking uv run mypy src/
{ "mcpServers": { "random-number-dev": { "command": "uv", "args": [ "--directory", "<path_to_your_repo>/random-number-mcp", "run", "random-number-mcp" ] } } }

Note:Replace<path_to_your_repo>/random-number-mcpwith the absolute path to your cloned repository.

# Build package uv build # Test installation uv run --with dist/*.whl random-number-mcp

- Increment theversionnumber inpyproject.toml,src/random_number_mcp/__init__.py, andserver.json.

-

Add a new entry inCHANGELOG.mdfor the release.

- Draft notes with coding agent usinggit diffcontext.

Update the @CHANGELOG.md for the latest release. List all significant changes, bug fixes, and new features. Here's the git diff: [GIT_DIFF]

Commit along with any other pending changes.

- Draft a new release on the GitHub UI.

- Tag release using UI.

For exploring and/or developing this server, use the MCP Inspector npm utility:

# Install MCP Inspector npm install -g @modelcontextprotocol/inspector # Run local development server with the inspector npx @modelcontextprotocol/inspector uv run random-number-mcp # Run PyPI production server with the inspector npx @modelcontextprotocol/inspector uvx random-number-mcp

mcp-name: io.github.zazencodes/random-number-mcp

MIT License - seeLICENSEfile for details.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

A Model Context Protocol (MCP) server that enables AI assistants to integrate with Prometheus Alertmanager

A comprehensive MCP server for tooling interactions(40+) and resource accessibility(60+) plus many useful prompts to interact with Algorand Blockchain.

An MCP server that provides control over Android devices through ADB. Offers device screenshot capture, UI layout analysis, package management, and ADB command execution capabilities.

A Binary Ninja plugin, MCP server, and bridge that seamlessly integrates Binary Ninja with your favorite MCP client.

integration that connects BloodHound with AI through MCP, allowing security professionals to analyze Active Directory attack paths using natural language queries instead of Cypher.

A specialized MCP gateway for LLM enhancement prompts and jailbreaks with dynamic schema adaptation. Provides prompts for different LLMs using an enum-based approach.

Obtains latest dependency details for Clojure libraries.

A Model Context Protocol (MCP) server for CODESYS V3 programming environments.

Analyze large codebases and document collections using high-context models via OpenRouter, OpenAI, or Google AI -- very useful, e.g., with Claude Code

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.