Drand

官方

一個用於從 drand 網路獲取可驗證隨機數的 MCP 伺服器。

你可以用 Drand MCP 做什麼?

  • Get the latest randomness beacon — Fetch the most recent verifiable random value from the drand network using get-randomness-latest.
  • Retrieve randomness for a specific past time — Supply a Unix timestamp in milliseconds to get-randomness-by-time and get the beacon emitted at or just before that moment.
  • Fetch randomness by round number — Use get-randomness-by-round to obtain the beacon for a specific drand round, enabling repeatable, verifiable sampling.

文件

drand-mcp-server 🎲

build

在你的 AI 應用程式中使用可驗證的隨機性。這個模型上下文協定 (MCP) 伺服器讓你能從 drand 網路取得隨機值、驗證其有效性,並將其作為模型驅動流程的輸入種子!

使用案例

  • 可重複的輸入資料隨機抽樣
  • 以可驗證的方式與其他 MCP 伺服器互動(例如根據提示發放獎勵)
  • 使用歷史 drand 信標驗證其他隨機程序的輸出

先決條件

  • 較新版本的 node(v21+ - 需要 fetch

安裝

你可以使用 npx 或在本地建置後執行 MCP 伺服器。

在 VS Code 中使用

在你的工作區(或家目錄)中建立一個名為 .vscode/mcp.json 的檔案,並加入以下程式碼:

{
  "servers": {
    "drand": {
      "command": "npx",
      "args": [
        "drand-mcp-server"
      ]
    }
  }
}

更多資訊請參考 VS Code 的 MCP 文件

在 Claude 中使用

你可以透過在設定檔中加入以下內容,讓 drand-mcp-server 與 Claude 桌面版一起執行:

{
  "mcpServers": {
    "drand": {
      "command": "npx",
      "args": [
        "drand-mcp-server"
      ]
    }
  }
}

工具

此 MCP 伺服器提供以下工具

名稱參數說明
get-randomness-latest從 drand quicknet 取得最新的可用信標
get-randomness-by-time毫秒時間取得在指定時間或之前發出的隨機信標
get-randomness-by-round回合數取得指定回合編號發出的隨機信標

從原始碼建置

  • 使用 npm install 安裝相依套件
  • 使用 npm run build 建置應用程式
  • 使用 npm startnode ./dist/index.mjs 執行應用程式

你也可以像上面一樣設定 VS Code 和 Claude,並將 command/args 替換為以下內容:

  "command": "node",
  "args": ["/path/to/my/project/drand-mcp-server/dist/index.mjs"]

開發藍圖

  • 取得最新隨機數
  • 依回合取得隨機數
  • 依時間取得隨機數
  • 從列表中選取項目