# Dovafy SafePerp / SafeSwap MCP - Full Technical Reference

Base URL: https://safeperp.dovafy.com
Primary Brand Portal: https://dovafy.com

## 1. Security & Zero-Custody Architecture
- Server refuses to boot if any private key, secret key, or mnemonic environment variable is present.
- All write endpoints (/api/v1/* and /mcp) inspect payloads recursively and reject private key fields, 64-hex EVM keys, 12/24-word seed phrases, and 64-byte Solana secret arrays with HTTP 400 ZERO_CUSTODY_VIOLATION.
- Unsigned Solana and EVM transactions are returned alongside a short-lived (5 minute) strict-CSP signing receipt URL at https://safeperp.dovafy.com/sign/{sessionId}.

## 2. Pre-Trade Anti-Rug Risk Engine
Solana parallel sources executed before every swap:
1. Solana Mainnet RPC (getAccountInfo jsonParsed): detects missing mints, active freezeAuthority (hard block), active mintAuthority (warn), Token-2022 PermanentDelegate (hard block), defaultAccountState=frozen (hard block), and high transferFeeConfig (>5% warn, >15% hard block).
2. RugCheck API v1 (/v1/tokens/{mint}/report/summary): normalized risk score, LP lock warnings, honeypot/rugged flags.
3. GoPlus Solana Token Security (/api/v1/solana/token_security): freezable, balance_mutable_authority, non_transferable, top-10 holder concentration.
EVM pre-trade checks executed before every LI.FI bridge/swap:
4. GoPlus EVM Token Security (/api/v1/token_security/{chainId}): honeypot, cannot_sell_all, cannot_buy, owner_change_balance, selfdestruct, extreme buy/sell tax (>15% hard block).
5. Fail-closed guarantee: if all upstream providers fail, buy transactions are blocked automatically.

## 3. Disclosed Official Protocol Fees (All Live)
- Token Safety Scan (Solana & EVM): 0.00% (Free)
- Solana Swaps (Jupiter Swap API v2 /order): 0.20% (20 bps) collected only when SOL, USDC, or USDT is part of the swap pair; 0.00% on unsupported meme-to-meme pairs.
- Hyperliquid Perps (Official Builder Code): 0.03% (30 tenths-bps) after one-time user gasless EIP-712 ApproveBuilderFee at https://safeperp.dovafy.com/authorize/hyperliquid.
- EVM Cross-Chain & Swap (LI.FI Integrator Fee): 0.15% (15 bps) across Ethereum, Base, Arbitrum, BSC, Optimism, Polygon (gracefully falls back to 0.00% if integrator fee wallet is pending activation).

## 4. Available MCP Tools (Local stdio & Remote POST /mcp)
### Tool 1: scan_token_safety
Input: { "chain": "solana" | "evm", "chainId": 8453 (required when chain="evm"), "tokenAddress": "<Solana mint or EVM 0x contract>" }
Output: PASS / WARN / BLOCK decision, 0-100 riskScore, hardBlocked flag, checkedSources, and itemized risk flags.

### Tool 2: safe_swap_solana
Input:
- inputMint (string, Solana base58 mint)
- outputMint (string, Solana base58 mint)
- amount (string, integer raw base units, e.g. "100000000" for 0.1 SOL)
- userPublicKey (string, user Solana PUBLIC wallet address)
- slippageBps (optional integer 1-1500, default 100)
- swapMode (optional "ExactIn" | "ExactOut", default "ExactIn")
- acknowledgeHighRisk (optional boolean, default false; never overrides critical hardBlocked honeypots)

### Tool 3: safe_perp_order_hyperliquid
Input:
- coin (string, e.g. "BTC", "ETH", "SOL")
- isBuy (boolean, true = long, false = short)
- sizeUsd (number, notional USD size)
- leverage (optional number 1-50, default 3)
- orderType (optional "market" | "limit", default "market")
- limitPrice (optional positive number, required for limit orders)
- slippageBps (optional integer 1-500, default 50)
- reduceOnly (optional boolean, default false)
- userAddress (string, user EVM 0x PUBLIC wallet address)
- acknowledgeHighRisk (optional boolean, default false)

### Tool 4: safe_bridge_quote
Input:
- fromChainId (integer, e.g. 8453 Base, 42161 Arbitrum, 1 Ethereum, 56 BSC, 10 Optimism, 137 Polygon)
- toChainId (integer)
- fromToken (string, 0x ERC-20 address or 0x0000000000000000000000000000000000000000 for native asset)
- toToken (string, destination 0x address)
- fromAmount (string, integer raw base units)
- userAddress (string, user EVM 0x PUBLIC wallet address)
- slippageBps (optional integer 1-1500, default 100)
- acknowledgeHighRisk (optional boolean, default false)

## 5. REST Endpoints
- GET https://safeperp.dovafy.com/api/v1/health
- POST https://safeperp.dovafy.com/api/v1/safety/scan
- POST https://safeperp.dovafy.com/api/v1/solana/swap
- GET https://safeperp.dovafy.com/api/v1/sign-sessions/{id}
- POST https://safeperp.dovafy.com/api/v1/solana/broadcast
- GET https://safeperp.dovafy.com/api/v1/hyperliquid/builder-status?user=0x...
- POST https://safeperp.dovafy.com/api/v1/hyperliquid/perp-order
- POST https://safeperp.dovafy.com/api/v1/hyperliquid/approve-builder
- POST https://safeperp.dovafy.com/api/v1/evm/bridge-quote
- GET https://safeperp.dovafy.com/authorize/hyperliquid
- POST https://safeperp.dovafy.com/mcp (JSON-RPC 2.0 Remote MCP)
- GET https://safeperp.dovafy.com/openapi.json
- GET https://safeperp.dovafy.com/.well-known/mcp.json
- GET https://safeperp.dovafy.com/.well-known/agent.json
