CryptoMCP
by RMAAPK
README.md
# š”ļø CryptoMCP: Ultra-Secure Model Context Protocol Crypto & Web3 Gateway
[](LICENSE)
[](https://github.com/RMAAPK)
[](https://github.com/punkpeye/fastmcp)
[](https://github.com/RMAAPK/dmcps)
**CryptoMCP** (engineered by **RMAA Holdings**) is an ultra-hardened Model Context Protocol (MCP) Web3 gateway built with TypeScript and `FastMCP`.
It enables AI Agents (Claude Desktop, ChatGPT, Gemini, ForgeAI) to query multichain balances, inspect smart contracts, and draft DeFi interactions **with 100x stronger anti-drainer security rails to prevent catastrophic wallet loss, honeypot scams, and prompt injection drainers**.
---
## š”ļø 100x Hardened Anti-Drainer Security Rails
On-chain cryptocurrency transactions are permanent and non-reversible. CryptoMCP implements mathematical defenses inspired by [DMCPS](https://github.com/RMAAPK/dmcps):
```
+-------------------------------------------------------------------------------------------------+
| CRYPTOMCP ANTI-DRAINER ARCHITECTURE |
+-------------------------------------------------------------------------------------------------+
| AI AGENT (Claude / GPT / Gemini) |
| ā |
| ā¼ JSON-RPC (FastMCP / Stdio / Stream) |
| [CRYPTOMCP SECURITY INTERCEPTOR] āāāŗ Emergency Freeze Active? āāāāāāāāāāāŗ [INSTANT BLOCK] |
| ā |
| āāāāŗ Infinite Token Allowance (type(uint256).max)? āāāāāāāāāāāāāāāāŗ [INSTANT BLOCK] |
| āāāāŗ Non-Whitelisted Contract / Wallet Address? āāāāāāāāāāāāāāāāāāāŗ [INSTANT BLOCK] |
| āāāāŗ Value Exceeds Single Tx Cap ($100 USD)? āāāāāāāāāāāāāāāāāāāāāāŗ [INSTANT BLOCK] |
| āāāāŗ Value Exceeds Cumulative Daily Cap ($500 USD)? āāāāāāāāāāāāāāāŗ [INSTANT BLOCK] |
| ā |
| āāāāŗ Value >= $25 USD (Human Challenge Gate)? āāāāāāāāāāāāāāāāāāāāāŗ [REQUIRES TOKEN] |
| ā ā |
| ā ā¼ |
| ā [DMCPS ANTI-DRAINER UI] |
| ā Human Cryptographic Sign |
| ā ā |
| ā¼ ā |
| [BLOCKCHAIN BROADCAST & SIGNING (ETH / Polygon / Solana / BTC)] āāāāāāāāāāāāāāāāā |
+-------------------------------------------------------------------------------------------------+
```
### 1. Mathematical Anti-Drainer (Infinite Approval Blocker)
- **The Attack:** 95% of phishing dApps trick users or agents into approving `type(uint256).max` (`0xffffffff...`), granting the smart contract unlimited permission to drain all ERC-20 tokens at any future point.
- **The Defense:** CryptoMCP inspects the calldata selector (`0x095ea7b3`) and automatically drops any transaction attempting infinite or unbounded allowances.
### 2. Strict Destination Whitelisting
- The AI **cannot** send funds or interact with unverified contract addresses extracted from untrusted web pages or prompts.
- All target addresses (e.g. 1inch, Uniswap, Aave) must be explicitly registered and assigned a daily budget by the human owner in the Dashboard.
### 3. Human-In-The-Loop (HITL) Cryptographic Challenge Gate
- Any transaction value greater than or equal to `$25.00 USD` triggers an unforgeable challenge token (`CRYPTO_AUTH_...`) with a 10-minute expiry.
- The transaction cannot be broadcast to the blockchain until the human owner confirms the details in the Dashboard or passes the token back to `submit_crypto_approval_token`.
### 4. Cold Wallet Emergency Killswitch
- One click on the Dashboard instantly freezes all signing operations and rejects any inbound agent tool calls.
---
## š ļø MCP Tools Exposed to AI
| Tool Name | Risk Level | Description |
| :--- | :--- | :--- |
| `list_wallets` | š¢ Safe (Read) | Lists managed public wallet addresses, chains, and token balances. |
| `list_whitelisted_contracts` | š¢ Safe (Read) | Lists authorized DEX routers, lending pools, and recipient entities. |
| `transfer_crypto` | š“ High (Gated)| Initiates transfer or contract interaction; guarded by Anti-Drainer rules. |
| `submit_crypto_approval_token`| š” Auth (Commit)| Submits human challenge token to sign and broadcast high-value transaction. |
| `get_crypto_security_status` | š¢ Safe (Read) | Audits active USD spend caps, remaining daily budget, and freeze status. |
---
## š Quickstart & Dashboard
### 1. Install & Build
```bash
npm install
npm run build
```
### 2. Configure Environment
```bash
cp .env.example .env
```
Edit `.env` credentials:
```env
PORT=8090
ADMIN_USERNAME=admin
ADMIN_PASSWORD=your_secure_password_here
MAX_SINGLE_TX_USD=100
MAX_DAILY_TX_USD=500
HUMAN_APPROVAL_THRESHOLD_USD=25
BLOCK_INFINITE_ALLOWANCE=true
```
### 3. Run the Gateway
```bash
npm start
```
- **Anti-Drainer Control Dashboard:** `http://localhost:8090/dashboard`
- **FastMCP Transport Gateway:** Stdio or Stream mode ready for MCP clients.
### 4. Run the Security Test Suite
```bash
npm test
```
```text
ā CryptoSecurityGuard: Anti-Drainer blocks infinite allowance (type(uint256).max) (14.9ms)
ā CryptoSecurityGuard: Blocks non-whitelisted contract/wallet targets (10.4ms)
ā CryptoSecurityGuard: Demands Human-In-The-Loop Approval Above Threshold (11.0ms)
ā CryptoSecurityGuard: Emergency Freeze Kills All Web3 Interactions (6.3ms)
ā¹ tests 4 | pass 4 | fail 0
```
---
## š License
Released under the [Business Source License 1.1 (BSL 1.1)](LICENSE) by **RMAA Holdings** & Contributors (matching DMCPS).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues