BitSage MCP服务器
MCP(模型上下文协议)服务器,使Claude等LLM能够与BitSage网络交互,进行分布式计算操作。
特性
- 作业管理:提交、监视和取消计算作业
- 工人发现:列出并检查可用的计算工作者
- 证明验证:验证链上的ZK证明
- 质押:抵押SAGE代币并领取奖励
- 水龙头:声明测试网令牌(仅限Sepolia)
- 网络统计:监控网络运行状况和利用率
安装
npm install @bitsage/mcp-server
或者直接使用npx运行:
npx @bitsage/mcp-server
配置
设置环境变量:
# API endpoint (optional, defaults to production)
export BITSAGE_API_URL=https://api.bitsage.network
# Starknet RPC (optional)
export STARKNET_RPC_URL=https://starknet-sepolia.public.blastapi.io
# Network: mainnet or sepolia (optional, defaults to sepolia)
export BITSAGE_NETWORK=sepolia
使用Claude Desktop
添加到您的Claude Desktop配置(~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"bitsage": {
"command": "npx",
"args": ["@bitsage/mcp-server"],
"env": {
"BITSAGE_NETWORK": "sepolia"
}
}
}
}
可用工具
作业管理
| 工具 | 说明 |
|---|
bitsage_submit_job | 提交计算作业(AI推理、ZK证明等) |
bitsage_get_job_status | 获取作业的当前状态 |
bitsage_cancel_job | 取消挂起或正在运行的作业 |
bitsage_list_jobs | 列出具有可选状态筛选器的作业 |
工人管理
| 工具 | 说明 |
|---|
bitsage_list_workers | 列出可用的计算工作者 |
bitsage_get_worker | 获取特定员工的详细信息 |
证明验证
| 工具 | 说明 |
|---|
bitsage_get_proof | 通过哈希获取证明细节 |
bitsage_verify_proof | 验证链上的证明 |
质押
| 工具 | 说明 |
|---|
bitsage_stake | 抵押SAGE代币 |
bitsage_unstake | 解锁SAGE代币 |
bitsage_claim_rewards | 领取质押奖励 |
bitsage_get_stake_info | 获取地址的质押信息 |
水龙头(仅限测试网)
| 工具 | 说明 |
|---|
bitsage_faucet_claim | 声明测试网SAGE令牌 |
bitsage_faucet_status | 检查水龙头冷却状态 |
ZKML证明与验证
| 工具 | 说明 |
|---|
bitsage_submit_zkml_proof | 提交ZKML证明作业(模型必须加载到证明器上) |
bitsage_get_zkml_proof_status | 证明工作状态和进度的民意调查 |
bitsage_get_zkml_proof_result | 获得完整的证明(通话数据、承诺、天然气估算) |
bitsage_verify_zkml_onchain | 检查证明或模型的链上验证状态 |
网络
| 工具 | 说明 |
|---|
bitsage_network_stats | 获取网络统计信息 |
ZKML配置
ZKML工具连接到 prove-server 实例(参见 libs/stwo-ml/)以及链上验证器合约。
# Prover server URL (default: http://localhost:8080)
export BITSAGE_PROVER_URL=http://your-gpu-server:8080
# On-chain verifier contract (default: deployed v3 on Sepolia)
export ZKML_VERIFIER_ADDRESS=0x048070fbd531a0192f3d4a37eb019ae3174600cae15e08c737982fae5d929160
交互示例
提交AI推理作业
User: Submit an AI inference job using llama-7b model with my prompt "What is the capital of France?"
Claude: I'll submit that job for you.
[Uses bitsage_submit_job tool]
The job has been submitted successfully:
- Job ID: abc123-def456
- Status: pending
- Estimated cost: 50 SAGE tokens
检查网络状态
User: How many workers are available on the BitSage network?
Claude: Let me check the network stats.
[Uses bitsage_network_stats tool]
The BitSage network currently has:
- Total workers: 150
- Active workers: 89
- Worker utilization: 59.3%
- Jobs in progress: 42
- Total jobs completed: 15,234
证明和验证ML推理
User: Prove the model 0xabc123 and check if it verifies on-chain.
Claude: I'll submit a proving job and track it.
[Uses bitsage_submit_zkml_proof with model_id: "0xabc123", gpu: true]
Proving job submitted:
- Job ID: d4e5f6a7-...
- Status: queued
[Uses bitsage_get_zkml_proof_status with job_id: "d4e5f6a7-..."]
Proof completed in 40.5s:
- 160 matmul sumcheck proofs
- 40 layers proven
- ~350,000 estimated gas
- 2,847 calldata felts
[Uses bitsage_verify_zkml_onchain with model_id: "0xabc123"]
On-chain status:
- Verification count: 3
- Weight commitment: 0x7f2a...
发展
# Install dependencies
npm install
# Build
npm run build
# Run in development
npm run dev
许可证
麻省理工学院