🧠 MCP加密精简版
一个使用Node.js+TypeScript+MCP构建的最小的模块化加密交易机器人。\ 纸质交易基金会准备就绪 超液体测试网 整合。
______________________________________________________________________
🚀 概述
该项目使用 模型上下文协议(MCP) 框架。它目前运行在 纸张模式 --在连接到真实交易所之前,执行模拟交易并验证逻辑。
______________________________________________________________________
📊 阶段进展
| 阶段 | 状态 | 描述 |
|---|---|---|
| 1.MCP服务器基础 | ✅ | 完成纸质交易,验证ping/ticker/订单工具 |
| 2.超流测试网集成 | ⏳ | 使用实时API+WebSocket支持替换mock |
| 3.信号生成和路由 | 🧩 | 带ATR确认的动态区域检测(区域A/区域B) |
| 4.政策与风险管理 | 🧠 | 最大风险和每日损失上限的护栏 |
| 5.教练模式和记录 | 🗣️ | 交易推理+电报警报 |
| 6.状态持久性和恢复 | ♻️ | 完全重启恢复和PnL跟踪 |
______________________________________________________________________
🗂️ 项目结构
mcp-crypto-lite/
├── data/
│ └── .gitkeep
├── src/
│ ├── env.ts # Environment loader
│ ├── server.ts # MCP entry point
│ ├── tools/ # MCP tools
│ │ ├── ping.ts
│ │ ├── getTicker.ts
│ │ └── placeOrder.ts
│ └── services/
│ └── hyperliquid.ts # Exchange adapter (stub)
├── .env.example # Safe env template
├── .gitignore
├── mcp.config.json
├── package.json
├── tsconfig.json
└── README.md
⚙️ Setup & Run
bash
Copy code
# 1. Install dependencies
npm install
# 2. Run in dev mode
npm run dev
# 3. Run local test suite
npm test
You should see:
✅ Ping tool success
✅ Get-ticker success
✅ Paper order written to data/orders.json
🔐 Environment Variables
Copy .env.example → .env and fill in your Hyperliquid Testnet details:
bash
Copy code
HL_BASE=https://api.hyperliquid-testnet.xyz
HL_AGENT_WALLET=
HL_AGENT_KEY=
🧠 Tech Stack
Node.js 22+
TypeScript 5
MCP SDK
Node / TS tooling
🧩 Roadmap
Each phase builds toward a self-regulating trading agent capable of transparent, auditable automation.
Phase Goal Key Milestones
2. Hyperliquid Testnet Integration 🔗 Replace mocks with live data REST & WebSocket ticker stream, paper orders via testnet
3. Signal Generation & Routing 🧠 Strategy logic Dynamic zone detection (Zone A / Zone B), ATR-based confirmation router
4. Policy & Risk Management 🛡️ Guardrails Risk per trade, daily loss caps, trade cooldowns
5. Coach Mode & Logging 🗣️ Contextual feedback Telegram alerts, trade reasoning, structured journaling
6. State Persistence & Recovery ♻️ Fault tolerance Restart recovery, daily PnL tracking, persistent bot state
🧾 Versioning & Conventions
TypeScript strict mode enforced
Environment isolation: .env and .env.example
Paper-trading safety: no real funds, full local state logging
🤝 Contributing
Pull requests are welcome.
For major changes, open an issue first to discuss scope.
🪪 License
MIT — use, fork, build.
🧭 Project Ethos
Built with a focus on clarity, safety, and transparency.
Every trade, decision, and state update is intended to be verifiable and human-auditable.
yaml
Copy code
---
4️⃣ Then run these in your terminal:
git add README.md git rebase --continue git push -u origin main````
