区块链DeFi操作服务器

Telos Network MCP Server是一个为Telos区块链提供DeFi操作和分析的生产就绪型服务器,支持智能代币管理、DEX集成和实时数据分析。

  • by Tairon-ai
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 Tairon-ai/telos-mcp

使用说明

🌐 Telos网络MCP服务器v0.1

用于Telos区块链DeFi操作和分析的生产就绪模型上下文协议(MCP)服务器

特性 • 快速开始 • API • 工具 • 例子 • 提示 • 安全


🚀 特性

🎯 完整的DeFi生态系统集成

  • 完全支持Swapsicle V2 DEX,流动性集中
  • 13%APY的sTLOS液体质押协议
  • 通过DefiLama实时跟踪TVL和APY
  • 来自DexScreener的实时交易数据和池分析
  • 具有最佳路由的智能存款自动化
  • 通过LayerZero实现跨链桥接

🧠 智能令牌管理

  • 支持45多种代币,包括TLOS、稳定币和生态系统代币
  • 自动令牌检测和余额管理
  • 通过多个DEX聚合器进行智能路由
  • 来自Teloscan API的实时价格信息
  • 防滑保护和耐MEV

🤖 MCP协议实现

  • 34+区块链自动化专用工具
  • 与Claude Desktop和AI助手兼容
  • HTTP、SSE和stdio传输支持
  • 自动签名的实时交易执行
  • 全面的错误处理和重试逻辑
  • WebSocket支持实时区块链事件

🏛️ 企业就绪架构

  • 使用NestJS v11构建可扩展性
  • TypeScript 5.7用于类型安全
  • 模块化服务架构
  • 80%+测试覆盖率要求
  • Docker多阶段构建
  • 全面的日志记录和监控

📦 快速开始

✅ 先决条件

# Required
Node.js >= 18.0.0
pnpm >= 8.0.0 (REQUIRED - do not use npm or yarn)

# Optional
Docker & Docker Compose (for containerized deployment)
Private key for transaction execution

📥 安装

# Clone the repository
git clone https://github.com/Tairon-ai/telos-mcp.git
cd telos-mcp

# Install dependencies (MUST use pnpm)
pnpm install

# Configure environment
cp .env.example .env
# Edit .env with your configuration

# Start the server
pnpm run start

# Development mode with hot reload
pnpm run start:dev

# MCP stdio server for Claude Desktop
pnpm run start:mcp

🐳 Docker部署

# Build and run with Docker Compose
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

🤖 Claude桌面集成

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "telos-mcp": {
      "command": "node",
      "args": ["/path/to/telos-mcp/dist/stdio/mcp-server.js"],
      "env": {
        "RPC_URL": "https://rpc.telos.net/evm",
        "PRIVATE_KEY": "your_private_key_without_0x"
      }
    }
  }
}

🛠 可用工具

🏦 DeFi协议操作

工具 说明 参数
telos_stake sTLOS的股权TLOS(13%APY) amount, address
telos_unstake 将sTLOS撤销为TLOS amount, address
swapsicle_swap 在Swapsicle上执行令牌交换 tokenIn, tokenOut, amount, address
swapsicle_quote 获取掉期报价 tokenIn, tokenOut, amount
swapsicle_pools 获取流动性池信息 -
smart_deposit_auto 自动转换和质押 inputToken, amount, address

💱 令牌操作

工具 说明 参数
get_balance 获取TLOS或代币余额 token, address
get_address_balances 获取所有代币余额 address
telos_wrap 将TLOS包裹到WTLOS amount, address
telos_unwrap 将WTLOS拆分为TLOS amount, address
telos_token_price 获取代币价格 token
telos_tokens_list 列出所有支持的令牌 -

📊 分析和数据

工具 说明 参数
telos_top_stable_yields 最高稳定硬币收益率 limit
telos_biggest_lps TVL最大的流动性池 limit
telos_realtime_pairs 实时交易对 token
telos_trending_tokens 按交易量统计的代币趋势 limit
telos_tvl_rankings 协议TVL排名 -
telos_protocol_details 协议信息 protocol
telos_historical_tvl 历史TVL数据 protocol, days

🔍 区块链实用程序

工具 说明 参数
get_gas_price 获取当前天然气价格 -
telos_top_native_holders 顶级TLOS持有者 limit
telos_top_token_holders 任何代币的最高持有者 token, limit
telos_token_search 在DexScreener上搜索令牌 query
health_check 服务器运行状况 -

🔗 API终点

🌐 核心终点

GET  /           # Server status and info
GET  /health     # Health check
GET  /mcp        # MCP server information
POST /mcp        # MCP protocol endpoint
GET  /mcp/tools  # List available tools
GET  /info       # Server capabilities

📡 WebSocket/SSE支持

GET /sse         # Server-Sent Events for real-time updates
GET /stdio       # Stdio process status
POST /stdio      # Send request to stdio MCP server

💡 例子

💰 sTLOS的TLOS权益

// Stake 100 TLOS to earn 13% APY
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "telos_stake",
    "arguments": {
      "amount": "100",
      "address": "0x..."
    }
  },
  "id": 1
}

🔄 自动转换智能存款

// Automatically convert USDC to TLOS and stake
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "smart_deposit_auto",
    "arguments": {
      "inputToken": "USDC",
      "amount": "1000",
      "address": "0x..."
    }
  },
  "id": 1
}

📊 获取最佳掉期报价

// Get quote for swapping 1000 TLOS to USDC
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "swapsicle_quote",
    "arguments": {
      "tokenIn": "TLOS",
      "tokenOut": "USDC",
      "amount": "1000"
    }
  },
  "id": 1
}

🏊 获得最高收益机会

// Get top 5 stable coin yield opportunities
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "telos_top_stable_yields",
    "arguments": {
      "limit": 5
    }
  },
  "id": 1
}

🤖 提示

💬 Claude、ChatGPT或其他AI助手的示例提示

这些提示演示了如何在与AI助手集成时通过自然语言与MCP服务器交互:

💼 投资组合管理

"Check my TLOS balance and all token holdings at address 0x..."

"Show me the value of my portfolio in USD at 0x..."

"What's my sTLOS staking position and current rewards?"

"Calculate my total DeFi positions across all Telos protocols"

🏦 打桩作业

"I want to stake 500 TLOS to earn yield. My address is 0x..."

"Help me unstake 200 sTLOS back to TLOS"

"What's the current APY for sTLOS staking?"

"Show me my staking rewards and when I can claim them"

"Calculate how much I'll earn staking 1000 TLOS for 30 days"

🔄 代币交换

"Find the best route to swap 1000 TLOS to USDC on Swapsicle"

"I have 500 USDT and want to convert it to TLOS with minimal slippage"

"Execute a swap of 2 ETH to USDC with maximum 1% slippage"

"Compare swap rates for 1000 TLOS to USDC across all DEXes"

🚀 智能存款

"I have 1000 USDC and want to automatically convert and stake for best yield"

"Help me deposit and stake 500 USDT using smart deposit"

"Auto-convert my 2 ETH to TLOS and stake it all"

"What's the optimal deposit strategy for 5000 USDC?"

📊 DeFi 分析

"Show me the top 10 liquidity pools on Telos by TVL"

"What are the best stable coin yield opportunities right now?"

"Find trending tokens on Telos with highest 24h volume"

"Show me real-time trading data for TLOS/USDC pair"

"What's the total TVL across all Telos DeFi protocols?"

🔍 令牌信息

"Get the current price of TLOS in USD"

"Show me the top 20 TLOS holders"

"Who are the biggest holders of ZAPPY token?"

"List all supported tokens with their current prices"

"Search for 'CHARM' token and show me its liquidity pools"

📈 收益策略

"What are the top 5 stable yields on Telos?"

"Show me the best APY opportunities for USDC"

"Compare yields between different stablecoin pools"

"Find the highest yielding pools with over $100k TVL"

"Calculate my potential returns for providing liquidity to TLOS/USDC"

⛽ 事务管理

"Check current gas prices on Telos network"

"Estimate transaction cost for staking 1000 TLOS"

"Show me my last 10 transactions"

"What's the optimal gas price for a fast transaction?"

🔧 AI助手的集成技巧

在MCP服务器上使用这些提示时:

  1. 始终指定钱包地址 用于用户特定操作
  2. 设定适当的金额 以TLOS或令牌为单位
  3. 监控天然气价格 大型交易前
  4. 检查余额 在尝试掉期或入股之前
  5. 先用引号 在执行实际掉期交易之前

🗺️ 自然语言到工具映射

用户意图 MCP工具使用
“检查我的余额” get_address_balances
“股权TLOS” telos_stake
“松开sTLOS” telos_unstake
“交换令牌” swapsicle_swap
“获取掉期报价” swapsicle_quote
“自动存款和质押” smart_deposit_auto
“查看最高收益率” telos_top_stable_yields
“查找流动性池” telos_biggest_lps
“获取代币价格” telos_token_price
“搜索令牌” telos_token_search

🧪 测试

🧪 运行测试

# Run all tests
pnpm test

# Run with coverage
pnpm test:cov

# Run specific test suites
pnpm test:unit
pnpm test:integration
pnpm test:e2e

# Test specific modules
pnpm test:blockchain
pnpm test:staking
pnpm test:swaps

🔍 使用cURL进行API测试

# Check server health
curl http://localhost:8080/health

# Get MCP server info
curl http://localhost:8080/mcp

# List all available tools
curl http://localhost:8080/mcp/tools

# Execute a tool
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_balance",
      "arguments": {
        "token": "TLOS",
        "address": "0x..."
      }
    },
    "id": 1
  }'

🔒 安全

🔐 最佳实践

  • 私钥管理:永远不要提交私钥。使用环境变量
  • 交易模拟:测试 AUTO_EXECUTE=false 第一
  • 防滑保护:设定适当的限制(通常为0.5-2%)
  • 天然气管理:监控天然气价格并设定合理的限制
  • 访问控制:实施生产认证
  • 监控:使用Teloscan跟踪所有交易

🛡️ 安全功能

  • 带缓冲器的自动气体估算
  • 执行前的交易模拟
  • 所有掉期都有防滑保护
  • 输入验证和净化
  • 速率限制(可配置)
  • 全面的错误处理

📊 支持的网络和代币

🌐 网络

  • Telos EVM主网 (链ID:40)
  • RPC: https://rpc.telos.net/evm
  • 浏览器: Teloscan

🪙 支持的代币(45+)

原生&质押

  • TLOS、WTLOS、sTLOS

稳定币

  • 美国数据中心、美国数据技术中心、美国国防部、美国陆军部、法国

主要代币

  • ETH、WETH、BTC、WBTC、BNB

生态系统代币

  • 魅力,扎比,道格,交换,IMX,TSWAPS,LVTX,VEX

DeFi令牌

  • AAVE、LINK、UNI、SUSHI、CRV、BAL

📜 关键合同

  • Swapsicle V2路由器: 0x93395129bd3fcf49d95730D3C2737c17990fF328
  • sTLOS标桩: 0xB4B01216a5Bc8F1C8A33CD990A1239030E60C905
  • Omnidex路由器: 0xF9678db1CE83f6f51E5df348E2Cc842Ca51EfEc1

🚀 部署

🏭 生产部署

# Build for production
pnpm run build

# Start production server
pnpm run start:prod

# Build MCP server
pnpm run build:mcp

# With PM2
pm2 start dist/main.js --name telos-mcp

# With Docker
docker build -t telos-mcp .
docker run -d -p 8080:8080 --env-file .env telos-mcp

🔑 环境变量

# Required
PORT=8080
RPC_URL=https://rpc.telos.net/evm
CHAIN_ID=40
PRIVATE_KEY=your_private_key_without_0x
TELOS_API_URL=https://api.teloscan.io

# Optional
LOG_LEVEL=info
AUTO_EXECUTE=true
TRANSACTION_MODE=interactive
RATE_LIMIT_TTL=60
RATE_LIMIT_MAX=100

📈 演出

  • 响应时间:读取操作<50ms
  • 交易速度:Telos网络上约0.5秒
  • 吞吐量:每秒1000+个请求
  • 运行时间:99.9%的可用性目标
  • 气体优化:Telos超低费用
  • 缓存:价格数据缓存1分钟

🤝 贡献

我们欢迎捐款!请查看我们的 贡献指南 了解详情。

# Fork and clone
git fork https://github.com/Tairon-ai/telos-mcp
git clone https://github.com/Tairon-ai/telos-mcp

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and test
pnpm test
pnpm run lint

# Commit and push
git commit -m 'feat: add amazing feature'
git push origin feature/amazing-feature

# Open Pull Request

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。


🙏 致谢


建造于 Tairon.ai 在克劳德的帮助下