# WebcoBit SafePerp / SafeSwap MCP - Full Technical Reference

Base URL: https://safeperp.webcobit.com
Primary Brand Portal: https://webcobit.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 transactions are returned as Base64 VersionedTransaction payloads alongside a short-lived (5 minute) strict-CSP signing receipt URL at https://safeperp.webcobit.com/sign/{sessionId}.

## 2. Pre-Trade Anti-Rug Risk Engine
Parallel sources executed before every Solana 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.
4. Fail-closed guarantee: if all upstream providers fail, buy transactions are blocked automatically.

## 3. Disclosed Official Protocol Fees
- Token Safety Scan: 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 (upcoming P2): 0.03% official Builder Code after one-time user EIP-712 ApproveBuilderFee.

## 4. Available MCP Tools (Local stdio & Remote POST /mcp)
### Tool 1: scan_token_safety
Input: { "tokenAddress": "<Solana base58 mint>" }
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)

## 5. REST Endpoints
- GET https://safeperp.webcobit.com/api/v1/health
- POST https://safeperp.webcobit.com/api/v1/safety/scan
- POST https://safeperp.webcobit.com/api/v1/solana/swap
- GET https://safeperp.webcobit.com/api/v1/sign-sessions/{id}
- POST https://safeperp.webcobit.com/api/v1/solana/broadcast
- POST https://safeperp.webcobit.com/mcp (JSON-RPC 2.0 Remote MCP)
- GET https://safeperp.webcobit.com/openapi.json
- GET https://safeperp.webcobit.com/.well-known/mcp.json
- GET https://safeperp.webcobit.com/.well-known/agent.json
