Skip to main content
Glama
MCP Rand

MCP Rand

by turlockmike

MCP 兰德

npm 版本 许可证:ISC

模型上下文协议 (MCP) 服务器提供各种随机生成实用程序,包括 UUID、数字、字符串、密码、高斯分布、掷骰子和抽牌。

安装

npm install mcp-rand

或者全局安装:

npm install -g mcp-rand

Related MCP server: mcp-rando-server

特征

UUID 生成器

  • 生成 RFC 4122 版本 4 UUID

  • 使用 Node 的原生加密模块进行安全随机生成

  • 无需参数

随机数生成器

  • 生成指定范围内的随机数

  • 可配置的最小值和最大值(含)

  • 如果没有提供参数,则默认范围为 0-100

高斯随机数生成器

  • 生成符合高斯(正态)分布的随机数

  • 标准化为 0-1 范围

  • 无需参数

随机字符串生成器

  • 生成具有可配置长度和字符集的随机字符串

  • 支持多种字符集:

    • 字母数字(默认):AZ、az、0-9

    • 数字:0-9

    • 小写:az

    • 大写:AZ

    • 特殊:!@#$%^&*()_+-=[]{};'"\|,.<>/?

  • 可配置字符串长度(默认为 10)

密码生成器

  • 使用多种字符类型生成强密码

  • 确保每种类型(大写字母、小写字母、数字、特殊字符)至少包含一个字符

  • 可配置长度(最小 8,默认 16)

  • 警告:虽然密码是在本地生成的,但建议使用专用密码管理器

骰子滚轮

  • 使用标准骰子符号掷多个骰子

  • 支持“2d6”(两个六面骰子)、“1d20”(一个二十面骰子)等符号

  • 返回每组骰子的单独掷点数和总数

  • 可以同时掷出多个不同的骰子组(例如“2d6”、“1d20”、“4d4”)

卡片抽屉

  • 从标准的 52 张牌中抽牌

  • 使用 base64 编码维护抽牌之间的牌组状态

  • 返回抽出的牌和剩余牌组的状态

  • 支持抽取任意数量的牌,直至达到牌组大小

  • 每次抽牌前正确洗牌

用法

作为 CLI 工具

npx mcp-rand

与 MCP 客户端集成

添加到您的 MCP 客户端配置:

{
  "mcpServers": {
    "mcp-rand": {
      "command": "node",
      "args": ["path/to/mcp-rand/build/index.js"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

示例用法

// Generate UUID
const uuid = await client.callTool('generate_uuid', {});
console.log(uuid); // e.g., "550e8400-e29b-41d4-a716-446655440000"

// Generate random number
const number = await client.callTool('generate_random_number', {
  min: 1,
  max: 100
});
console.log(number); // e.g., 42

// Generate Gaussian random number
const gaussian = await client.callTool('generate_gaussian', {});
console.log(gaussian); // e.g., 0.6827

// Generate random string
const string = await client.callTool('generate_string', {
  length: 15,
  charset: 'alphanumeric'
});
console.log(string); // e.g., "aB9cD8eF7gH6iJ5"

// Generate password
const password = await client.callTool('generate_password', {
  length: 20
});
console.log(password); // e.g., "aB9#cD8$eF7@gH6*iJ5"

// Roll dice
const rolls = await client.callTool('roll_dice', {
  dice: ['2d6', '1d20', '4d4']
});
console.log(rolls);
/* Output example:
[
  {
    "dice": "2d6",
    "rolls": [3, 1],
    "total": 4
  },
  {
    "dice": "1d20",
    "rolls": [4],
    "total": 4
  },
  {
    "dice": "4d4",
    "rolls": [2, 3, 2, 3],
    "total": 10
  }
]
*/

// Draw cards
const draw1 = await client.callTool('draw_cards', {
  count: 5
});
console.log(draw1);
/* Output example:
{
  "drawnCards": [
    { "suit": "hearts", "value": "A" },
    { "suit": "diamonds", "value": "7" },
    { "suit": "clubs", "value": "K" },
    { "suit": "spades", "value": "2" },
    { "suit": "hearts", "value": "10" }
  ],
  "remainingCount": 47,
  "deckState": "t//+///bDw=="
}
*/

// Draw more cards using previous deck state
const draw2 = await client.callTool('draw_cards', {
  count: 3,
  deckState: draw1.deckState
});
console.log(draw2);
/* Output example:
{
  "drawnCards": [
    { "suit": "diamonds", "value": "Q" },
    { "suit": "clubs", "value": "5" },
    { "suit": "spades", "value": "J" }
  ],
  "remainingCount": 44,
  "deckState": "l//+//zbDw=="
}
*/

贡献

请参阅CONTRIBUTING.md了解开发设置和指南。

执照

国际学习中心

Available Tools

7 tools
draw_cardsC

Draw cards from a standard deck of playing cards

Inputs: count (required), deckState.

generate_gaussianA

Generate a random number following a Gaussian (normal) distribution between 0 and 1

Inputs: no named parameters.

generate_passwordB

Generate a strong password with a mix of character types. WARNING: While this password is generated locally on your machine, it is recommended to use a dedicated password manager for generating and storing passwords securely.

Inputs: length.

generate_random_numberB

Generate a random number within a specified range

Inputs: max, min.

generate_stringA

Generate a random string with specified length and character set

Inputs: charset, length.

generate_uuidA

Generate a random UUID v4

Inputs: no named parameters.

roll_diceB

Roll a set of dice using standard dice notation (e.g., "2d6" for two six-sided dice, "3d6+5" for three six-sided dice plus 5)

Inputs: dice (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: drawing cards, generating Gaussian numbers, generating passwords, generating random numbers in a range, generating random strings, generating UUIDs, and rolling dice. The descriptions are specific enough that an agent would never confuse one tool for another.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with 'generate_' or action-based prefixes like 'draw_' and 'roll_'. The naming is uniform, predictable, and enhances readability across the entire set.

    Tool Count5/5

    With 7 tools, the server is well-scoped for random generation tasks. Each tool serves a unique function in the domain of randomness, making the count appropriate without being too sparse or overwhelming.

    Completeness4/5

    The toolset covers a broad range of random generation needs (numbers, strings, UUIDs, passwords, cards, dice) with clear operations. A minor gap is the lack of tools for generating other distributions beyond Gaussian or more specialized random data types, but core workflows are well-supported.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Generates strong passwords and evaluates password strength using zxcvbn, with uniform random sampling via Node's crypto.
      2
      6 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Cryptographically secure random number generation and randomized resources, including tools for numbers, strings, dice rolls, UUIDs, and passphrases.
      4
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Validates and generates UUIDs, including parsing version, variant, timestamps, and creating random v4 UUIDs.
      77 npm
      MIT