Token导航 LogoToken导航TokenDH.com
Random Number MCP logo
开发工具stdio官方级别未说明来源级核验

Random Number MCP

MCP Server

提供伪随机和加密安全的随机数生成功能,包括整数、浮点数、加权选择、列表洗牌和安全令牌生成等。

工具数

7

提示词数

0

GitHub Stars

50

资源数

0
PythonClaude开发工具Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

zazencodes

提供方

zazencodes

最后核验

2026/5/17 20:19

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run pytest

详细介绍

随机数MCP

Python标准库中的基本随机数生成实用程序,包括用于整数、浮点数、加权选择、列表洗牌和安全令牌生成的伪随机和加密安全操作。

演示视频

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

工具

工具用途Python函数
random_int生成随机整数random.randint()
random_float生成随机浮点数random.uniform()
random_choices从列表中选择项目(可选权重)random.choices()
random_shuffle返回一个新列表,其中包含已洗牌的项目random.sample()
random_sample从总体中选择k个独特项目random.sample()
secure_token_hex生成加密安全的十六进制令牌secrets.token_hex()
secure_random_int生成加密安全的整数secrets.randbelow()

设置

克劳德桌面版

将此添加到您的Claude Desktop配置文件中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json\ 视窗: %APPDATA%/Claude/claude_desktop_config.json

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

工具参考

random_int

生成一个介于低和高(含)之间的随机整数。

参数:

  • low (int):下限(含)
  • high (int):上限(含)

例子:

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

random_float

在低和高之间生成随机浮动。

参数:

  • low (浮点数,可选):下限(默认值:0.0)
  • high (浮点数,可选):上限(默认值:1.0)

例子:

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

random_choices

从具有替换的总体中选择k个项目,可选加权。

参数:

  • population (列表):可供选择的项目列表
  • k (int,可选):要选择的项目数(默认值:1)
  • weights (列表,可选):每个项目的权重(默认值:相等权重)

例子:

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

random_shuffle

返回一个新列表,其中包含按随机顺序排列的项目。

参数:

  • items (list):要洗牌的项目列表

例子:

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

random_sample

从总体中选择k个唯一项目,不进行替换。

参数:

  • population (列表):可供选择的项目列表
  • k (int):可选择的项目数

例子:

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

secure_token_hex

生成加密安全的随机十六进制令牌。

参数:

  • nbytes (int,可选):随机字节数(默认值:32)

例子:

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

secure_random_int

在upper_bound以下生成一个加密安全的随机整数。

参数:

  • upper_bound (int):上限(不含)

例子:

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

安全注意事项

该软件包提供标准伪随机函数(适用于模拟、游戏等)和加密安全函数(适用于令牌、密钥等):

  • 标准功能 (random_int, random_float, random_choices, random_shuffle):使用Python random 模块-快速但不加密
  • 安全功能 (secure_token_hex, secure_random_int):使用Python secrets 模块-速度较慢但加密安全

发展

先决条件

设置

# 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/

MCP客户端配置

{
  "mcpServers": {
    "random-number-dev": {
      "command": "uv",
      "args": [
        "--directory",
        "
/random-number-mcp",
        "run",
        "random-number-mcp"
      ]
    }
  }
}

注: 替换 /random-number-mcp 带有克隆存储库的绝对路径。

建筑

# Build package
uv build

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

发布检查表

  1. 更新版本:

- 增加 version 数字在 pyproject.toml, src/random_number_mcp/__init__.py,以及 server.json.

  1. 更新变更日志:

- 在中添加新条目 CHANGELOG.md 为了释放。

- 使用编码剂起草注释 git diff 背景。

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

- 与任何其他待处理的更改一起提交。

  1. 创建GitHub版本:

- 在GitHub UI上起草一个新版本。 - 使用UI发布标签。 - GitHub工作流将自动构建包并将其发布到PyPI。

MCP检验员测试

要探索和/或开发此服务器,请使用MCP Inspector npm实用程序:

# 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注册表

mcp名称:io.github.zazencodes/random-number-mcp

许可证

MIT许可证-请参阅 许可证 文件以获取详细信息。

目录标签

目录标签

PythonClaude开发工具随机数生成本地部署加密安全Python工具

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

7

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiononeremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP