迷你MCP
Minima区块链模型上下文协议服务器
生产就绪的MCP服务器使大型语言模型能够通过标准化工具、自主代理编排和多模型推理与Minima区块链安全交互。
 ](https://nodejs.org) 
概述
Minima MCP使大型语言模型能够通过安全、标准化的模型上下文协议接口与Minima区块链进行交互。它为区块链操作、自主代理编排和多模型推理提供了27个工具。
什么是MCP?
模型上下文协议是由Anthropic创建的开放标准,允许人工智能系统安全地连接到外部工具和数据源。此实现为Minima提供了特定于区块链的工具。
主要特点
区块链运营
- 交易管理(发送、接收、搜索)
- 令牌创建和验证
- 智能合约执行
- 通过Maxima进行P2P消息传递
- 保险库操作和时间锁
安全
- OAuth 2.1身份验证
- API密钥管理
- 利率限制和交易限额
- 全面的审计日志记录
- 输入验证
AI集成
- Google Gemini 3 Pro集成
- 脚本分析和解释
- 安全审计
- 代币分配优化
生产基础结构
- 普罗米修斯指标
- Docker部署
- 健康监测
- 全面的错误处理
先决条件
系统要求
- Node.js>=18.0.0
- Java>=11(适用于Minima节点)
- RAM>=2GB
- 区块链数据磁盘>=5GB
Minima节点
在运行MCP服务器之前,您需要一个正在运行且可访问的Minima节点。
下载Minima:
访问 全球最小值 下载Minima节点软件,或:
curl -O https://github.com/minima-global/Minima/releases/latest/download/minima.jar启动节点:
# Basic startup for development
java -jar minima.jar -data .minima -rpcenable
# Production startup (connects to network)
java -jar minima.jar -data .minima -p2pnodes megammr.minima.global:9001 -rpcenable
# With MDS (Minima DApp System)
java -jar minima.jar -data .minima -mdsenable -mdspassword YOUR_PASSWORD -rpcenable验证节点是否正在运行:
curl http://localhost:9005/status重要提示:
- 端口9005是RPC API终结点
- 节点必须正在运行,MCP服务器才能正常工作
- 使用
-clean标记仅用于首次设置(擦除所有数据)
安装
# Clone the repository
git clone https://github.com/furcateresearch/minima-mcp.git
cd minima-mcp
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your configuration
# Build the project
npm run build配置
编辑 .env 文件:
# Minima Node Configuration
MINIMA_HOST=localhost
MINIMA_PORT=9005
# Google Gemini AI (optional - for AI-powered features)
GOOGLE_API_KEY=your_google_api_key_here
# Authentication
JWT_SECRET=your_jwt_secret_here
DEFAULT_API_KEY=your_default_api_key_here
# Server Configuration
NODE_ENV=development
MCP_PORT=3000
METRICS_PORT=9090
LOG_LEVEL=info
# Security - Rate Limiting
RATE_LIMIT_MAX_REQUESTS=100
MAX_TRANSACTION_AMOUNT=1000000
DAILY_LIMIT=10000000用法
启动MCP服务器
npm run start服务器以stdio模式启动,并监听MCP协议消息。
健康检查:
curl http://localhost:9090/health韵律学:
curl http://localhost:9090/metricsDocker部署
# Start all services (Minima node, MCP server, Redis, Prometheus, Grafana)
docker-compose up -d
# Check health
curl http://localhost:9090/health
# View logs
docker-compose logs -f
# Stop services
docker-compose down可用工具
MCP服务器提供27个区块链工具:
交易工具
minima_send_transaction-发送Minima或代币minima_search_transactions-搜索交易历史记录minima_get_balance-获取钱包余额minima_get_address-生成新地址
令牌工具
minima_create_token-创建新令牌minima_list_tokens-列出所有令牌minima_validate_token-验证令牌ID
智能合约工具
minima_execute_script-执行Minima脚本minima_validate_script-验证脚本语法minima_generate_script-从模板生成minima_get_script_templates-获取可用模板
AI驱动的工具
minima_ai_explain_script-解释脚本功能minima_ai_security_audit-安全分析minima_ai_optimize_distribution-优化代币分配
P2P通信(Maxima)
minima_maxima_send_message-发送P2P消息minima_maxima_get_contacts-获取联系人列表
分析和监控
minima_analytics_network-网络指标minima_analytics_transactions-交易模式minima_node_health-节点健康状态minima_chain_info-区块链信息minima_mempool_info-Mempool状态
保险库操作
minima_vault_lock-用时间锁锁定资金minima_vault_status-检查保险库状态
网络工具
minima_get_status-完整节点状态minima_get_block-按数字/哈希值获取块minima_get_peers-获取同行列表
备份
minima_backup_create-创建节点备份
MCP客户端集成
克劳德桌面
要与Claude Desktop集成,请执行以下操作:
- 构建项目:
npm run build- 编辑Claude桌面配置:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
窗户: %APPDATA%\Claude\claude_desktop_config.json
- 添加此配置:
{
"mcpServers": {
"minima-blockchain": {
"command": "node",
"args": ["/absolute/path/to/minima-mcp/dist/index.js"],
"env": {
"MINIMA_HOST": "localhost",
"MINIMA_PORT": "9005",
"GOOGLE_API_KEY": "your_google_api_key"
}
}
}
}- 重新启动克劳德桌面
看 MCP_INTEGRATION.md 详细说明。
自主代理示例
这 examples/agents/ 目录包含三个生产就绪的自主代理:
1.上下文助理
使用区块链数据回答问题的人工智能助手:
npm run agent:assistant2.事务调度程序
安排经常性交易(DCA、付款、分配):
npm run agent:scheduler3.钱包编排器
优化钱包操作并管理多个地址:
npm run agent:orchestrator看 examples/agents/README.md 详细文档。
api参考
工具调用示例
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
const transport = new StdioClientTransport({
command: 'node',
args: ['dist/index.js']
});
const client = new Client({
name: 'my-app',
version: '1.0.0'
}, {
capabilities: {}
});
await client.connect(transport);
// Get balance
const result = await client.callTool({
name: 'minima_get_balance',
arguments: {}
});
console.log(result);发展
建筑
npm run build发展模式
npm run dev测试
# All tests
npm test
# Unit tests only
npm run test:unit
# Integration tests
npm run test:integration
# Watch mode
npm run test:watch装订和格式化
npm run lint
npm run format建筑
┌─────────────────────────────────────────────┐
│ MCP Client (LLMs, Applications) │
│ - Connects via stdio │
│ - Calls blockchain tools │
└─────────────┬───────────────────────────────┘
│ stdio
▼
┌─────────────────────────────────────────────┐
│ MCP Server (this project) │
│ ├─ Authentication & Authorization │
│ ├─ Tool Registry (27 tools) │
│ ├─ Prompt & Resource Registries │
│ └─ Request Handlers │
└─────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ Security Middleware │
│ ├─ Rate Limiter │
│ ├─ Transaction Limits │
│ ├─ Audit Logger │
│ └─ Input Validation │
└─────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ Services Layer │
│ ├─ Transaction, Token, Analytics │
│ ├─ Maxima, Vault, Script │
│ ├─ Node, AI Services │
│ └─ Omnia (Layer 2) │
└─────┬───────────────────────┬───────────────┘
│ │
│ ▼
│ ┌───────────────────────────┐
│ │ AI Inference Gateway │
│ │ ├─ Inference Router │
│ │ ├─ Inference Client │
│ │ └─ Multi-model support │
│ └───────┬───────────────────┘
│ │ HTTPS
│ ▼
│ ┌───────────────────────────┐
│ │ AI Endpoints │
│ │ ├─ Gemini 3 Pro │
│ │ ├─ Claude Sonnet 4.5 │
│ │ ├─ GPT-5 │
│ │ ├─ Custom LLMs │
│ │ └─ Time-series models │
│ └───────────────────────────┘
│
│ Raw TCP (HTTP)
▼
┌─────────────────────────────────────────────┐
│ Minima HTTP Client │
│ ├─ Raw TCP implementation │
│ ├─ Command execution │
│ └─ Error handling │
└─────────────┬───────────────────────────────┘
│ HTTP/RPC
▼
┌─────────────────────────────────────────────┐
│ Minima Node (Port 9005) │
│ ├─ Blockchain operations │
│ ├─ Private key storage │
│ ├─ Transaction signing │
│ └─ P2P networking │
└─────────────────────────────────────────────┘多模型推理支持
MCP服务器包括一个支持多个AI提供者的推理网关:
支持的提供商:
- 谷歌双子座(3 Pro)
- 人物克劳德(十四行诗4.5)
- OpenAI(GPT-5)
- 自定义推理端点(本地模型、专用模型)
- 时间序列预测模型
路由策略:
- 基于成本:选择最便宜的端点
- 基于速度:选择最快的端点
- 基于质量:为任务选择最佳模型
看 MULTI_MODEL_ARCHITECTURE.md 获取详细的实施指南。
安全
私钥管理
私钥永远不会离开Minima节点。MCP服务器通过RPC与节点通信,密钥在节点的保险库中保持安全。
交易限额
可配置的限制可防止未经授权或过度交易:
- 每笔交易的最大金额
- 每日支出限额
- 大型交易的审批门槛
- 最大待处理交易数
审计日志
所有操作都以JSONL格式记录,以进行合规性和安全审计。
速率限制
通过每个客户端可配置的速率限制防止滥用。
监控
普罗米修斯指标
可在 http://localhost:9090/metrics:
- 活动连接
- 请求费率
- 错误率
- 区块链指标(身高、同龄人等)
- 工具使用统计
Grafana仪表板
访问地址: http://localhost:3001 (使用Docker时):
- 实时区块链指标
- 业务监控
- 误差跟踪
- 性能分析
故障排除
MCP服务器无法启动
检查Minima节点是否正在运行:
curl http://localhost:9005/status验证环境变量:
cat .env检查日志:
tail -f logs/app.log连接错误
确保端口正确(RPC为9005):
Minima节点必须以以下方式启动 -rpcenable 标志:
java -jar minima.jar -rpcenable验证连接:
npm run healthAI功能不起作用
AI功能需要 GOOGLE_API_KEY 待设定。如果没有它,服务器将返回回退响应。
项目结构
minima-mcp/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # MCP server implementation
│ ├── minima/ # Minima client
│ │ ├── client.ts
│ │ ├── http-client.ts
│ │ ├── raw-http-client.ts
│ │ └── types.ts
│ ├── tools/ # MCP tool implementations
│ │ └── registry.ts
│ ├── services/ # Business logic
│ │ ├── transaction.service.ts
│ │ ├── token.service.ts
│ │ ├── analytics.service.ts
│ │ └── ...
│ ├── security/ # Security components
│ ├── auth/ # Authentication
│ └── utils/ # Utilities
├── examples/
│ └── agents/ # Autonomous agent examples
├── tests/ # Test suites
├── docker-compose.yml # Docker configuration
└── package.json贡献
欢迎投稿!请遵循以下指南:
- 复刻仓库
- 创建要素分支
- 进行更改
- 添加新功能的测试
- 确保所有测试通过
- 提交拉取请求
代码规范
- TypeScript严格模式
- ESLint合规性
- 全面的错误处理
- 安全第一的方法
许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
版权所有(c)2025希拉勒·阿吉尔
资源
- Minima网站:https://minima.global
- Minima文件:https://docs.minima.global
- MCP协议:https://modelcontextprotocol.io
- GitHub存储库:https://github.com/furcateresearch/minima-mcp
致谢
本项目建立在以下基础之上:
- Minima Global的Minima区块链平台
- Anthropic的模型上下文协议规范
- 谷歌Gemini人工智能平台
