Skip to main content
Glama
sovereign-x402-mcp

sovereign-x402-mcp

by hathoai
README.md
# sovereign-x402-mcp

**Zero-dependency Model Context Protocol (MCP) server** connecting Claude Desktop, Cursor, Windsurf, Cline, and autonomous AI agents to **6 deterministic Engineering & Web3 Security APIs** settled per-call in **Base Mainnet USDC** via the [x402 Payment Protocol](https://x402.org) (PayAI Facilitator, zero API keys, zero subscriptions).

> **Permanent Hub & Browser Tools:** https://hathoai.github.io/
> **x402 Discovery Registry:** `https://hathoai.github.io/api-live.json` -> `/.well-known/x402`
> **Settlement Network:** Base Mainnet (`eip155:8453`) USDC (`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`)
> **PayTo Address:** `0x24b41A1A536aA9969AEC93aDf2E2f4A9eC22c2Dc`

---

## Available MCP Tools

| Tool Name | Price (Base USDC) | What It Does |
|---|---:|---|
| `get_x402_catalog` | **Free** | Fetches live `/.well-known/x402` catalog, pricing, facilitator, and endpoints |
| `csv_pii_audit` | **$0.01** | Deterministic CSV/TSV/JSON profiling, Luhn/PII detection & redaction (`mask`/`hash`/`drop`), deduplication |
| `seo_page_audit` | **$0.02** | Deterministic HTML5 Technical SEO audit (title, meta, canonical, viewport, H1–H3, OpenGraph, alt tags, JSON-LD) |
| `log_forensics` | **$0.03** | Nginx/Apache/JSONL access log forensics: route-normalized p50/p95/p99 latency, 5xx spikes, scanner detection, Nginx/Cloudflare WAF block rules |
| `solidity_security_scan` | **$0.04** | Defensive Solidity static scanner: CEI reentrancy violations, `tx.origin`, unsafe `delegatecall`, `selfdestruct`, unprotected admin functions, weak randomness |
| `evm_tx_preflight` | **$0.02** | Multi-chain EVM transaction preflight (`eth_getCode`, EIP-55 checksum, ERC-20/NFT calldata decoder, unlimited approval & zero/burn address trap guard) |
| `token_allowance_risk` | **$0.02** | Live on-chain ERC-20 `allowance(owner, spender)` + `balanceOf` exposure scan across Base, Arbitrum, Polygon, Optimism, and Ethereum |

---

## Quick Install (Zero Dependencies — Pure Python 3.9+ Stdlib)

```bash
pip install git+https://github.com/hathoai/sovereign-x402-mcp.git
```

Or run directly from a cloned checkout:

```bash
git clone https://github.com/hathoai/sovereign-x402-mcp.git
python3 -m sovereign_x402_mcp
```

---

## Configure in Claude Desktop / Cursor / Windsurf

Add to `claude_desktop_config.json` or `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "sovereign-x402": {
      "command": "sovereign-x402-mcp",
      "env": {
        "X402_PAYMENT_HEADER": ""
      }
    }
  }
}
```

Or without installing globally:

```json
{
  "mcpServers": {
    "sovereign-x402": {
      "command": "python3",
      "args": ["-m", "sovereign_x402_mcp"],
      "cwd": "/path/to/sovereign-x402-mcp"
    }
  }
}
```

### How x402 Per-Call Payment Works
1. Call `get_x402_catalog` (free) or call any paid tool directly without `payment_header`.
2. The gateway responds with `http_status: 402` and a standards-compliant x402 v1 + v2 `PAYMENT-REQUIRED` challenge (Base Mainnet USDC, `payTo: 0x24b41A1A536aA9969AEC93aDf2E2f4A9eC22c2Dc`).
3. Sign an EIP-3009 `TransferWithAuthorization` payload with your x402 agent wallet (e.g., Coinbase x402 SDK / PayAI client) and pass it via `payment_header` (or `X402_PAYMENT_HEADER`).
4. The gateway settles atomically on Base Mainnet and returns deterministic structured JSON in <100ms.

---

## Prefer Unlimited Offline Local Software? (One-Time License — No Per-Call Fees)

- **SchemaGuard Pro ($29)** — Offline CSV/JSON/Excel Cleaner, PII Masking & SQL DDL Generator: https://haminthoai.gumroad.com/l/ukjvnb
- **LogSentinel Pro ($34)** — Zero-Cloud Nginx/Apache/JSONL Forensics & Cloudflare WAF Generator: https://haminthoai.gumroad.com/l/xkxavc
- **PropFirm Guard v1 ($29)** — Deterministic Trading Drawdown & Risk Calculator: https://haminthoai.gumroad.com/l/kdwubd
- **Direct On-Chain Checkout (10% OFF USDC/USDT on Base/Arbitrum/Polygon/Optimism/Ethereum):** https://hathoai.github.io/go/store.html

---

## Development & Tests

```bash
pytest -q
```

## Glama MCP Directory

Inspect tool schemas, quality score, and test interactively via [Glama MCP Server Listing](https://glama.ai/mcp/servers/@hathoai/sovereign-x402-mcp) and [MCP Inspector](https://glama.ai/mcp/inspector).

MIT Licensed. Built by [Sovereign Engineering Studio](https://hathoai.github.io/).