MCP Rand

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Allows publishing and installing the MCP-rand server as a package from the npm registry

  • Used to display badges showing the package's npm version and license information

MCP 兰德

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

安装

npm install mcp-rand

或者全局安装:

npm install -g mcp-rand

特征

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了解开发设置和指南。

执照

国际学习中心

ID: ccd6b0hni8