File size: 13,175 Bytes
846b6be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# RMI Platform β€” System Architecture

> **v3 (Jun 21 2026)**: This document now describes the rebuilt architecture.
> The legacy monolith has been replaced via strangler-fig. New v1 routes
> mount via `app/api/v1/__init__.py` aggregator. See `docs/adr/0003-strangler-fig-not-rewrite.md`
> for the migration pattern, and `docs/adr/0001-why-fastapi.md` for framework choice.

## v3 Architecture Diagram

```
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚   CONSUMERS         β”‚
                            β”‚  Frontend | MCP     β”‚
                            β”‚  Telegram | API     β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                    β”‚                    β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
          β”‚  MCP ENDPOINT β”‚   β”‚  REST v1 API  β”‚   β”‚  X402 GATEWAY β”‚
          β”‚  /mcp/*       β”‚   β”‚  /api/v1/*    β”‚   β”‚  CF Workers   β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚                    β”‚                    β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚   app/api/v1/__init__.py β”‚
                          β”‚   AGGREGATOR (NEW)       β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                        β”‚                        β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  AUTH ROUTERS     β”‚  β”‚  PUBLIC ROUTERS     β”‚  β”‚  ADMIN ROUTERS    β”‚
    β”‚  alerts, wallet   β”‚  β”‚  wallet, token,     β”‚  β”‚  alerts_webhook   β”‚
    β”‚                   β”‚  β”‚  scanner, databus   β”‚  β”‚  (Prometheus)     β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚      DATABUS          β”‚
                          β”‚  96 chains, 119 prov. β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                       β”‚                       β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  SERVICE LAYER    β”‚  β”‚  PROVIDER CHAINS    β”‚  β”‚  LOCAL MCP      β”‚
    β”‚  app/domain/*     β”‚  β”‚  Jupiter β†’ Helius β†’ β”‚  β”‚  SVM + EVM      β”‚
    β”‚  (pure Python)    β”‚  β”‚  Alchemy β†’ …        β”‚  β”‚  Self-hosted    β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Overview

Rug Munch Intelligence is a unified crypto intelligence platform serving 234 tools across 9 provider categories. Every data call routes through a multi-layer caching shield with automatic provider fallback. The x402 micropayment layer handles paid tool access across 8 chains with instant settlement.

```
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚   FRONTEND / BOTS   β”‚
                            β”‚  Web | Telegram | APIβ”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚                    β”‚                    β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
          β”‚  MCP ENDPOINT β”‚   β”‚  REST API     β”‚   β”‚  X402 GATEWAY β”‚
          β”‚  /mcp/*       β”‚   β”‚  /api/v1/*    β”‚   β”‚  CF Workers   β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚                    β”‚                    β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚    CACHING SHIELD       β”‚
                          β”‚  L1 Memory β†’ Rate Limit β”‚
                          β”‚  β†’ Provider Chain       β”‚
                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                        β”‚                        β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  DATA PROVIDERS   β”‚  β”‚  LOCAL MCP SERVERS  β”‚  β”‚  SERVICE MCP      β”‚
    β”‚  20 sources       β”‚  β”‚  SVM (60) + EVM (25)β”‚  β”‚  GMGN, Birdeye... β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Tool Categories

| Category | Count | Access | Description |
|----------|-------|--------|-------------|
| Security Scanning | 45 | Free trial + paid | Rug pulls, honeypots, audits, clone detection |
| Wallet Intelligence | 38 | Free trial + paid | PnL, clustering, insider networks, whale tracking |
| Market Data | 32 | Free trial + paid | Prices, liquidity, volume, arbitrage, trends |
| Token Analytics | 28 | Free trial + paid | Holder distribution, sniper detection, deployer history |
| DeFi Analytics | 24 | Free trial + paid | TVL, yields, protocol risk, liquidity flow |
| Social Signals | 18 | Free trial + paid | Sentiment, KOL tracking, profile flips |
| **Caching Shield** | **13** | **Free internal** | Funding trace, risk scan, token price, wallet balance |
| Local MCP | 85 | Self-hosted | SVM Solana RPC, EVM blockchain queries |
| Free Public MCP | 50 | Free external | Boar blockchain (ETH, ENS, contracts) |

## Caching Shield Architecture

Every data call goes through three layers before hitting any external API:

1. **L1 Memory Cache** β€” Sub-millisecond lookup. TTLs: 8s (price) to 1hr (contract ABI).
2. **Rate Limiter** β€” Token bucket per provider. Prevents burning free tier quotas.
3. **Provider Chain** β€” Ordered fallback. If primary fails, next provider tried automatically.

Example: Token Price Request
```
Request β†’ L1 cache (miss) β†’ Rate check (allowed) β†’ Jupiter (primary) β†’
  if fail: Solana Tracker β†’ if fail: DexScreener β†’ if fail: Binance
Result cached for 8 seconds. Next request hits L1 cache instantly.
```

## Provider Fallback Chains

| Data Type | Primary | Fallback 1 | Fallback 2 | Fallback 3 |
|-----------|---------|------------|------------|------------|
| Token Price | Jupiter | Solana Tracker | DexScreener | Binance |
| Token Metadata | Helius DAS | Solana Tracker | Jupiter | DexScreener |
| Wallet Balance | Helius | QuickNode | Alchemy | PublicNode |
| Risk Scan | GoPlus | RugCheck | Honeypot | Local Labels |
| EVM Funding | Blockscout | Etherscan | Public RPC | Boar MCP |
| Solana Funding | Helius | Solana Tracker | Public RPC | Local Labels |

## Free Access Tiers

### Free Trials (x402 Tools)
- Every paid tool includes 1-5 free trial calls
- No payment required for trial calls
- Fingerprint-gated anti-abuse protection
- Reset monthly or on tool updates

### Always-Free Tools
- **Funding Tracer** β€” Trace wallet funding sources (Solana + 9 EVM chains)
- **Token Price** β€” Real-time price with multi-provider consensus
- **Risk Scan** β€” Quick security check with 4 fallback layers
- **Wallet Balance** β€” Balance lookup with provider redundancy
- **GMGN Security** β€” Token safety analysis
- **Etherscan Gas** β€” Current gas prices
- **CoinGecko Price** β€” Market data
- **Langfuse Stats** β€” Observability metrics
- **All Local MCP Tools** β€” 85 tools running on our infrastructure

### Free Tier Limits (External APIs)
Solana Tracker: 5,000 requests/month across 2 accounts (6 RPS combined)
Helius: 2 accounts, 25 RPS each (50 RPS total)
Blockscout PRO: 100,000 credits/day, 5 RPS
CoinMarketCap: 10,000 calls/month, 11 endpoints
Boar MCP: Unlimited (keyless, read-only)

## X402 Payment System

- **Price range:** $0.01 - $0.40 per tool call
- **Payment chains:** Base, Solana, Ethereum, BSC, TRON, Bitcoin, Polygon, Arbitrum
- **8 payment facilitators** with automatic fallback
- **Instant refund** if tool returns no data
- **Settlement:** Instant on Base and Solana

## Local MCP Servers

Two self-hosted MCP servers run on our bare metal, accessed via stdio transport:

**Solana SVM MCP** (60 tools, Rust)
- getBalance, getAccountInfo, getTokenSupply, getSignaturesForAddress
- getTransaction, getProgramAccounts, getBlock, getBlockHeight
- WebSocket subscriptions for real-time updates
- Built-in x402 payment protocol support

**EVM MCP** (25 tools, 86 networks)
- getBalance, getTokenBalance, getAllowance
- getTransaction, getTransactionReceipt, waitForTransaction
- getBlock, resolveENS, lookupENS
- getGasPrice, getContractABI, getChainInfo

## Observability

Langfuse cloud with smart sampling:
- 20% of normal traces sent to cloud
- 100% of errors sent to cloud
- Full archive in local ClickHouse
- Target: 30,000 observations/month (free tier: 50,000)

## Deployment

- **Server:** Bare metal VPS (193GB SSD, Ubuntu)
- **Containers:** Docker Compose (30 containers)
- **CI/CD:** GitHub Actions β€” auto-deploy on push to main
- **Edge:** Cloudflare Workers for x402 payment gateway
- **Secrets:** GPG-encrypted vault (52 secrets), age-encrypted Docker runtime

## Auto-Updating Platform Manifest

All platform descriptions, tool counts, pricing, and agent skills are managed by a single source of truth at `app/caching_shield/platform_manifest.py`. Every external surface reads from here.

**Live endpoints (always current):**
- `GET /mcp/manifest` β€” Full platform manifest with live tool counts
- `GET /mcp/membership` β€” Membership tiers, scan packs, streams, research, batch
- `GET /mcp/skills` β€” 18 agent skills with workflows and anti-abuse rules

**Directory sync (run to update external listings):**
```bash
python3 /root/backend/scripts/sync_platforms.py
```
Updates Smithery, Glama, mcp.so, and README from the manifest.

**Tools by category (auto-counted):**
| Category | Count | Access |
|----------|-------|--------|
| Paid Tools (with free trials) | 200+ | 1-5 free calls, then pay-per-use |
| Local MCP Tools | 85 | Self-hosted, no rate limits |
| Free Public MCP | 50 | Keyless, read-only |
| Agent Skills | 18 | Free, included with any access |
| Scan Packs | 4 | 50-53% off individual tools |
| Membership Tiers | 4 | $4.99-$199.99/mo, daily call limits |
| Streaming Feeds | 4 | Real-time data via WebSocket |
| Research Reports | 4 | Deep dive investigations |
| Batch Products | 3 | 75-90% off bulk scanning |
| AI Data Feeds | 3 | Machine-ready market data |