本项目是一个 MCP 服务器,借助 random.org 的随机性 API 实现真实随机的硬币翻转。它通过提供可配置边数的工具,生动演示了模型上下文协议,为用户带来更具随机性和灵活性的体验。
此 MCP 服务器借助 random.org 的随机性 API 来实现真实的硬币翻转。连接到如 Claude Desktop 这样的 MCP 客户端后,你就能用自然语言与硬币翻转工具进行交互。
flip_coin:可实现具有可配置边数的硬币翻转。
sides 参数,默认值为 2。npm install
npm run build
npm run watch
要与 Claude Desktop 一起使用,需添加服务器配置:
~/Library/Application Support/Claude/claude_desktop_config.json{
"mcpServers": {
"coin-flip": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-coin-flip"]
}
}
}
连接到像 Claude Desktop 这样的 MCP 客户端后,你可以使用自然语言与硬币翻转工具交互,例如:
- "翻转一枚硬币"
- "掷一个六面骰子"
- "给我一个 1 到 20 的随机数"
服务器将利用 random.org 的真实随机性生成结果。
由于 MCP 服务器通过 stdio 通信,调试可能存在一定挑战。我们建议使用 MCP 监视器:
npx @modelcontextprotocol/inspector node build/index.js
欢迎大家积极贡献!请随时提交拉取请求。
本项目采用 MIT 许可证。