npx nimiq-mcp完全控制选择两个选项之一:
在您的MCP客户端配置中添加以下内容:
{
"mcpServers": {
"nimiq": {
"url": "https://nimiq-mcp.je-cf9.workers.dev/sse",
"transport": "sse"
}
}
}
在您的MCP客户端配置中添加以下内容:
{
"mcpServers": {
"nimiq": {
"command": "npx",
"args": ["nimiq-mcp"]
}
}
}
| 功能 | 远程访问 | 本地安装 |
|---|---|---|
| 设置 | 不需要安装 | 需要Node.js/npm |
| 更新 | 自动 | 手动(npx拉取最新) |
| 隐私 | 请求通过我们的服务器 | 直接连接到RPC |
| 可用性 | 取决于我们的服务运行时间 | 取决于本地环境 |
| 协议支持 | 仅支持SSE传输 | 完整的MCP协议支持 |
{
"mcpServers": {
"nimiq": {
"url": "https://nimiq-mcp.je-cf9.workers.dev/sse?rpc-url=https://your-rpc-endpoint.com&rpc-username=your-username&rpc-password=your-password",
"transport": "sse"
}
}
}
</details>
<details>
<summary>本地(npx)</summary>
{
"mcpServers": {
"nimiq": {
"command": "npx",
"args": [
"nimiq-mcp",
"--rpc-url",
"https://your-rpc-endpoint.com",
"--rpc-username",
"your-username",
"--rpc-password",
"your-password"
]
}
}
}
</details>
| CLI 参数 | URL 参数 | 描述 | 默认值 |
|---|---|---|---|
--rpc-url <url> | rpc-url=<url> | Nimiq RPC端点URL | https://rpc.nimiqwatch.com |
--rpc-username <username> | rpc-username=<username> | RPC用户名用于认证 | 无 |
--rpc-password <password> | rpc-password=<password> | RPC密码用于认证 | 无 |
--help, -h | 无 | 显示帮助信息 | 无 |
该MCP服务器提供了与Nimiq区块链交互的全面工具和资源:
| 类别 | 工具 | 描述 |
|---|---|---|
| 区块链数据工具 | getHead | 获取Nimiq区块链当前的头部区块 |
getBlockByNumber | 通过编号检索特定区块 | |
getBlockByHash | 通过哈希检索特定区块 | |
getEpochNumber | 获取当前纪元编号 | |
| 区块链计算工具 | getSupply | 获取当前流通的NIM供应量 |
calculateSupplyAt | 计算给定时间的Nimiq PoS供应量 | |
calculateStakingRewards | 计算基于质押的潜在财富积累 | |
interactiveStakingCalculator | 新:带有提取支持的互动计算器 | |
getPrice | 获取NIM相对于其他货币的价格 | |
| 账户和余额工具 | getAccount | 通过地址获取详细的账户信息 |
getBalance | 获取特定账户地址的余额 | |
| 交易工具 | getTransaction | 通过哈希获取详细的交易信息 |
getTransactionsByAddress | 获取特定地址的交易历史 | |
| 验证者工具 | getValidators | 获取所有活跃验证者的相关信息 |
getValidator | 获取特定验证者的详细信息 | |
getSlots | 获取当前或特定区块的验证者槽位信息 | |
| 网络工具 | getNetworkInfo | 获取网络状态,包括节点数量和共识状态 |
| 文档工具 | getRpcMethods | 从最新的OpenRPC文档获取所有可用的RPC方法 |
searchDocs | 使用全文搜索在Nimiq文档中搜索 |
| 类别 | 资源 | 描述 |
|---|---|---|
| 文档资源 | nimiq://docs/web-client | 完整的web客户端文档,适用于LLMs |
nimiq://docs/protocol | 完整的Nimiq协议和学习文档,适用于LLMs | |
nimiq://docs/validators | 完整的验证者和质押文档,适用于LLMs |
每个工具接受特定参数:
includeBody(布尔值)以包含交易详情address(字符串)用于Nimiq地址hash(字符串)用于交易哈希,max(数字)用于限制includeSchemas(布尔值)用于getRpcMethods以包含详细的参数/结果模式query(字符串)用于搜索词,limit(数字)以控制结果数量资源通过其URI访问,不需要参数:
nimiq://docs/web-client,nimiq://docs/protocol或nimiq://docs/validators访问{
"total": 210000000000000,
"vested": 0,
"burned": 0,
"max": 210000000000000,
"initial": 25200000000000,
"staking": 100000000000,
"minted": 1000000000,
"circulating": 25200000000000,
"mined": 0,
"updatedAt": "2025-01-20T12:00:00.000Z"
}
{
"blockNumber": 21076071,
"block": {
"hash": "90e2ba0a831eec477bca1a26ba8c5e2b3162b5d042667828c4db0f735247d41e",
"number": 21076071,
"timestamp": 1749486768481,
"parentHash": "b4fae3fc846ac13bfc62aa502c8683e25e92616d987f3f642b9cb57da73b6392",
"type": "micro",
"producer": {
"slotNumber": 305,
"validator": "NQ51 LM8E Q8LS 53TX GGDG 26M4 VX4Y XRE2 8JDT"
}
},
"timestamp": "2025-06-09T16:32:49.055Z",
"network": "mainnet"
}
{
"query": "validator staking",
"totalResults": 3,
"results": [
{
"title": "验证者设置",
"content": "要在Nimiq成为验证者,您需要质押NIM代币...",
"section": "验证者",
"score": 0.95,
"snippet": "...成为Nimiq的验证者,您需要质押NIM代币并运行验证者软件..."
},
{
"title": "质押奖励",
"content": "验证者因生产区块和验证交易而获得奖励...",
"section": "经济",
"score": 0.87,
"snippet": "...因生产区块和验证交易而获得奖励。质押奖励..."
}
],
"searchedAt": "2025-01-20T12:00:00.000Z"
}
选项1:远程(零设置)
在您的claude_desktop_config.json中添加:
{
"mcpServers": {
"nimiq": {
"url": "https://nimiq-mcp.je-cf9.workers.dev/sse",
"transport": "sse"
}
}
}
选项2:本地安装
在您的claude_desktop_config.json中添加:
{
"mcpServers": {
"nimiq": {
"command": "npx",
"args": ["nimiq-mcp"]
}
}
}
{
"mcpServers": {
"nimiq": {
"command": "npx",
"args": [
"nimiq-mcp",
"--rpc-url",
"https://rpc.nimiqwatch.com"
]
}
}
}
直接通过HTTP访问远程服务器:
// 连接到远程MCP服务器
const mcpClient = new SSEClientTransport(
new URL('https://nimiq-mcp.je-cf9.workers.dev/sse')
)
该服务器遵循MCP规范,可以与任何兼容MCP的客户端一起使用:
本地安装:
npx nimiq-mcp
远程访问:
https://nimiq-mcp.je-cf9.workers.dev/toolshttps://nimiq-mcp.je-cf9.workers.dev/infohttps://nimiq-mcp.je-cf9.workers.dev/healthhttps://nimiq-mcp.je-cf9.workers.dev/# 安装依赖
pnpm install
# 运行代码检查
pnpm run lint
# 修复代码检查问题
pnpm run lint:fix
# 构建生产版本
pnpm run build
# 手动测试服务器
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/index.js
# 安装依赖,包括Wrangler
pnpm install
# 启动本地开发服务器
pnpm run dev:worker
# 构建并测试Worker部署
pnpm run build:worker
# 部署到Cloudflare
pnpm run deploy
请参阅完整的部署指南以获取详细说明。
快速部署步骤:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDwrangler secret put NIMIQ_RPC_URL
wrangler secret put NIMIQ_RPC_USERNAME
wrangler secret put NIMIQ_RPC_PASSWORD
该Worker将在以下位置可用:https://nimiq-mcp.je-cf9.workers.dev
该MCP服务器构建使用:
此服务器实现了最新的模型上下文协议规范(2025-06-18),具有增强的功能:
本地部署(STDIO传输)
远程部署(SSE传输)
该服务器使用Valibot对所有工具进行全面的输入验证,提供:
示例验证:
const StakingRewardsSchema = v.object({
amount: v.optional(v.pipe(v.number(), v.description('初始质押的NIM金额')), 1),
days: v.optional(v.pipe