游戏协议分析MCP服务器

Svony MCP 是一个面向游戏协议逆向分析的 MCP 服务器,通过 BM25 与语义向量混合检索,支持游戏协议解析、代码搜索和漏洞研究等场景。

  • by Ghenghis
  • ActionScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Ghenghis/rag-rte-mcp

使用说明

╔═══════════════════════════════════════════════════════════════════════════════╗
║                                                                               ║
║   ███████╗██╗   ██╗ ██████╗ ███╗   ██╗██╗   ██╗    ███╗   ███╗ ██████╗██████╗ ║
║   ██╔════╝██║   ██║██╔═══██╗████╗  ██║╚██╗ ██╔╝    ████╗ ████║██╔════╝██╔══██╗║
║   ███████╗██║   ██║██║   ██║██╔██╗ ██║ ╚████╔╝     ██╔████╔██║██║     ██████╔╝║
║   ╚════██║╚██╗ ██╔╝██║   ██║██║╚██╗██║  ╚██╔╝      ██║╚██╔╝██║██║     ██╔═══╝ ║
║   ███████║ ╚████╔╝ ╚██████╔╝██║ ╚████║   ██║       ██║ ╚═╝ ██║╚██████╗██║     ║
║   ╚══════╝  ╚═══╝   ╚═════╝ ╚═╝  ╚═══╝   ╚═╝       ╚═╝     ╚═╝ ╚═════╝╚═╝     ║
║                                                                               ║
║            🔮 Advanced Reverse Engineering Intelligence Platform 🔮           ║
║                                                                               ║
╚═══════════════════════════════════════════════════════════════════════════════╝

🎯 166,043 Indexed Chunks • 🔍 55,871 Symbols • ⚡ Hybrid BM25 + Semantic Search • 📡 301+ Protocol Commands


🚀 Overview

Svony MCP is an advanced Model Context Protocol server providing AI-powered reverse engineering intelligence for game protocol analysis. It combines lexical search (BM25) with semantic embeddings to deliver precise code discovery and protocol analysis.

┌─────────────────────────────────────────────────────────────────────────────┐
│                        SVONY INTELLIGENCE ENGINE                            │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│   ┌───────────────┐     ┌───────────────┐     ┌───────────────┐            │
│   │   WINDSURF    │────▶│   MCP SERVER  │────▶│  RAG ENGINE   │            │
│   │     IDE       │◀────│   (stdio)     │◀────│  (hybrid)     │            │
│   └───────────────┘     └───────────────┘     └───────────────┘            │
│          │                     │                      │                     │
│          │              ┌──────┴──────┐        ┌──────┴──────┐             │
│          │              │   Node.js   │        │   166,043   │             │
│          ▼              │   Wrapper   │        │   Chunks    │             │
│   ┌───────────────┐     └─────────────┘        └─────────────┘             │
│   │   AI TOOLS    │            │                      │                     │
│   │  • search     │     ┌──────┴──────┐        ┌──────┴──────┐             │
│   │  • stats      │     │  No stderr  │        │   55,871    │             │
│   │  • mode       │     │  File logs  │        │   Symbols   │             │
│   └───────────────┘     └─────────────┘        └─────────────┘             │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

📊 Knowledge Base

📁 Indexed Content

Category Files Description
Source Code 7,469 ActionScript, Python, JS
Protocol 85 AMF, Commands, Packets
Scripts 106 AutoEvony, Automation
Keys 1,230 Encryption, Signatures
Exploits 26 Vulnerabilities

🔧 Search Capabilities

Feature Specification
Chunks 166,043 indexed
Symbols 55,871 extracted
BM25 Lexical matching
Embeddings 384-dimensional
Fusion Reciprocal Rank

🛠️ MCP Tools

╔══════════════════════════════════════════════════════════════════════════════╗
║  TOOL              ║  DESCRIPTION                           ║  PARAMETERS   ║
╠══════════════════════════════════════════════════════════════════════════════╣
║  evony_search      ║  Hybrid lexical+semantic search        ║  query, k     ║
║  evony_stats       ║  Knowledge base statistics             ║  -            ║
║  evony_mode        ║  Get/set query mode                    ║  mode?        ║
╚══════════════════════════════════════════════════════════════════════════════╝

🔐 Query Modes

Mode Access Level Use Case
research Standard General protocol analysis
forensics Extended Deep vulnerability research
full_access Complete Unrestricted data access

⚡ Quick Start

1️⃣ Clone & Install

git clone https://github.com/Ghenghis/Svony-mcp.git
cd Svony-mcp
pip install -r requirements.txt

2️⃣ Configure Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "evony-knowledge": {
      "command": "node",
      "args": ["/path/to/Svony-mcp/evony_mcp_wrapper.js"]
    }
  }
}

3️⃣ Search!

evony_search("ACTION_KEY encryption")      # Find encryption keys
evony_search("army.newArmy protocol")      # Protocol commands
evony_search("overflow exploit threshold") # Vulnerability research

🔐 Encryption Keys Reference

┌─────────────────────────────────────────────────────────────────────────────┐
│                         EXTRACTED ENCRYPTION KEYS                            │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ACTION_KEY     │ TAO_{313-894*&*($*#-FDIU(430}-{facebook_dioe(&*%$l}      │
│  USER_INFO_KEY  │ IUGI_md5_key_{djfiji3*4930}-{fjdi3284$9dlld}             │
│  API_KEY        │ 9f758e2deccbe6244f734371b9642eda                         │
│  XOR_KEY        │ 0xAA (170 decimal)                                       │
│  LOGIN_SALT     │ evony                                                    │
│                                                                             │
├─────────────────────────────────────────────────────────────────────────────┤
│  SIGNATURE: MD5(data + ACTION_KEY)                                          │
└─────────────────────────────────────────────────────────────────────────────┘

💥 Exploit Thresholds

┌─────────────────────────────────────────────────────────────────────────────┐
│                     INTEGER OVERFLOW THRESHOLDS                              │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  Troop Type     │  Cost  │  Overflow Threshold  │  Formula                 │
│  ──────────────────────────────────────────────────────────────────────    │
│  Archer         │  350   │  6,135,037           │  INT32_MAX / 350 + 1     │
│  Worker         │  50    │  42,949,673          │  INT32_MAX / 50 + 1      │
│  Catapult       │  3000  │  715,828             │  INT32_MAX / 3000 + 1    │
│  Cavalry        │  500   │  4,294,968           │  INT32_MAX / 500 + 1     │
│  Warrior        │  100   │  21,474,837          │  INT32_MAX / 100 + 1     │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

🏗️ Architecture

svony-mcp/
│
├── 📄 evony_mcp_wrapper.js        # Node.js stdio wrapper (ignores stderr)
├── 📄 requirements.txt            # Python dependencies
├── 📄 README.md                   # This file
│
├── 📁 evony_rag/                  # ═══════════════════════════════════════
│   ├── 🔧 mcp_server_clean.py     # MCP server - NO STDERR (Windsurf fix)
│   ├── 🔧 rag_v2.py               # RAG orchestrator engine
│   ├── 🔧 hybrid_search.py        # BM25 + semantic fusion (RRF)
│   ├── 🔧 embeddings.py           # Vector embeddings (384-dim)
│   ├── 🔧 policy.py               # Query mode access control
│   ├── 🔧 config.py               # Configuration constants
│   └── 📁 logs/                   # File-only logging
│
└── 📁 docs/                       # ═══════════════════════════════════════
    ├── 📖 README.md               # Documentation index
    ├── 📁 keys/                   # Encryption keys & signatures
    │   └── ENCRYPTION_KEYS.md
    ├── 📁 protocols/              # Protocol reference (301+ commands)
    │   ├── COMMANDS.md
    │   └── AMF_PROTOCOL.md
    ├── 📁 exploits/               # Vulnerability documentation
    │   └── EXPLOITS.md
    └── 📁 diagrams/               # Architecture diagrams
        └── ARCHITECTURE.md

📡 Protocol Commands (301+)

🗡️ Army Commands
Command Description Parameters
army.newArmy Create army cityId, heroId, troops[]
army.getArmyByCity Get armies cityId
army.attackOtherPlayer Attack armyId, targetCityId
army.scout Scout target armyId, x, y
army.disbandArmy Disband armyId
🏃 Troop Commands
Command Description Parameters
troop.produceTroop Train troops cityId, type, num
troop.cancelProduceTroop Cancel cityId, type
troop.disbandTroop Disband cityId, type, num
troop.getProduceQueue Get queue cityId
🏰 Building Commands
Command Description Parameters
castle.newBuilding Build cityId, posId, typeId
castle.upgradeBuilding Upgrade cityId, posId
castle.destructBuilding Destroy cityId, posId
castle.speedUpBuilding Speed up cityId, posId, itemId
👤 Hero Commands
Command Description Parameters
hero.fireHero Dismiss heroId
hero.promoteHero Promote heroId
hero.resetAttrPoint Reset stats heroId
hero.addAttrPoint Add points heroId, attr, num

🔬 Search Pipeline

                              HYBRID SEARCH PIPELINE
┌─────────────────────────────────────────────────────────────────────────────┐
│                                                                             │
│   Query: "ACTION_KEY encryption"                                            │
│                    │                                                        │
│          ┌────────┴────────┐                                                │
│          ▼                 ▼                                                │
│   ┌─────────────┐   ┌─────────────┐                                         │
│   │    BM25     │   │  Semantic   │                                         │
│   │   Lexical   │   │  Embedding  │                                         │
│   │   Search    │   │   Search    │                                         │
│   └──────┬──────┘   └──────┬──────┘                                         │
│          │                 │                                                │
│          │   k=20          │   k=20                                         │
│          │                 │                                                │
│          └────────┬────────┘                                                │
│                   ▼                                                         │
│          ┌─────────────────┐                                                │
│          │   RRF Fusion    │  score = Σ(1 / (60 + rank))                    │
│          └────────┬────────┘                                                │
│                   │                                                         │
│                   ▼                                                         │
│          ┌─────────────────┐                                                │
│          │  Top K Results  │  Ranked by combined score                      │
│          └─────────────────┘                                                │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

⚙️ Technical Specifications

Component Specification
Search Engine Hybrid BM25 + Semantic
Embedding Model all-MiniLM-L6-v2 (384d)
Index Size 166,043 chunks
Symbol Index 55,871 symbols
Fusion Algorithm Reciprocal Rank Fusion
MCP Transport stdio (JSON-RPC)
Logging File-only (no stderr)

🔒 Security Notes

  • ✅ No credentials stored - User accounts excluded from repo
  • ✅ Policy-controlled access - Three query modes
  • ✅ Windsurf compatible - No stderr output (causes Error status)
  • ✅ Input sanitization - BOM stripping, JSON validation

📚 Documentation

Document Description Link
🔐 Encryption Keys All keys & signatures View
📡 Protocol Commands 301+ game commands View
📦 AMF Protocol AMF3 serialization View
💥 Exploits Vulnerabilities View
🏗️ Architecture System diagrams View

🤝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open Pull Request

📜 License

MIT License - See LICENSE for details.


╔═══════════════════════════════════════════════════════════════════════════════╗
║                                                                               ║
║                    Built with 💚 for Reverse Engineering                      ║
║                                                                               ║
║              ⭐ Star this repo if you find it useful! ⭐                      ║
║                                                                               ║
╚═══════════════════════════════════════════════════════════════════════════════╝