Skip to main content
Glama
NEXAITECHAU

NEX Agent Co. MCP Server

Official
by NEXAITECHAU
README.md
# NEX Agent Co. — MCP Server

MCP server wrapping **all 31 paid x402 endpoints** of NEX Agent Co. as standard MCP tools. Agents that pay in USDC on Base get inference, data, security, and discovery — no API keys.

- **Default mode:** every call goes to the free mirror at `/v1/free/<endpoint>` (30 req/min/IP, no payment). Perfect for dev, eval, and prototypes.
- **Paid mode:** pass `paid: true` on any call. Server signs an EIP-3009 `transferWithAuthorization` for the tier's price in USDC and retries with `X-PAYMENT`.

## Tools (31 total)

### Inference (6)

| Tool | Endpoint | Paid price | Description |
|---|---|---|---|
| `nex_chat` | `/v1/chat` | $0.001 | Chat via nemotron-3.5-lightning:30b (1M ctx, 4x throughput) |
| `nex_chat_compat` | `/v1/chat/completions` | $0.001 | OpenAI-compatible chat completions |
| `nex_code` | `/v1/code` | $0.005 | Code via qwen3-coder:30b |
| `nex_code_pro` | `/v1/code-pro` | $0.012 | Premium code via qwen3-coder-next 80B-A3B (70.6% SWE-bench, MoE) |
| `nex_vision` | `/v1/vision` | $0.010 | Vision+text via qwen3.8:27b |
| `nex_embed` | `/v1/embed` | $0.0001 | Embeddings via nomic-embed-text |

### KYA / Agent Identity (2)

| Tool | Endpoint | Paid price | Description |
|---|---|---|---|
| `nex_agent_passport` | `/v1/agent-passport` | $0.01 | Issue ERC-8004-style agent passport (signed JSON credential) |
| `nex_agent_verify` | `/v1/agent-verify` | $0.005 | Verify a signed agent passport (valid/invalid + issuer + age) |

### B2B Enrichment (2)

| Tool | Endpoint | Paid price | Description |
|---|---|---|---|
| `nex_company_lookup` | `/v1/company-lookup` | $0.05 | Company enrichment via SEC EDGAR + Wikipedia |
| `nex_email_verify` | `/v1/email-verify` | $0.01 | Email deliverability (DNS MX + SMTP banner + disposable check) |

### Web / Discovery (2)

| Tool | Endpoint | Paid price | Description |
|---|---|---|---|
| `nex_web_search` | `/v1/web-search` | $0.005 | Web search via DuckDuckGo instant-answer |
| `nex_bazaar_search` | `/v1/bazaar-search` | $0.005 | Search 28K x402 services by keyword |

### Security (11)

| Tool | Endpoint | Paid price | Description |
|---|---|---|---|
| `nex_phishing_check` | `/v1/phishing-check` | $0.001 | URL safety (typosquatting, suspicious TLDs, punycode, shorteners) |
| `nex_contract_risk` | `/v1/contract-risk` | $0.05 | Smart contract risk grade (A-F) via Base RPC + DefiLlama |
| `nex_wallet_approvals` | `/v1/wallet-approvals` | $0.05 | Scan wallet for risky ERC-20 approvals |
| `nex_token_safety` | `/v1/token-safety` | $0.01 | Token safety (mint fn, honeypot patterns, owner privileges) |
| `nex_address_label` | `/v1/address-label` | $0.005 | Label lookup (exchanges, bridges, MEV bots, famous wallets) |
| `nex_address_reputation` | `/v1/address-reputation` | $0.05 | Address reputation score 0-1000 (age, balance, activity, sanctions) |
| `nex_hack_feed` | `/v1/hack-feed` | $0.001 | Recent hack/exploit feed from DefiLlama |
| `nex_ens_lookup` | `/v1/ens-lookup` | $0.001 | Resolve ENS name -> address |
| `nex_wallet_audit` | `/v1/wallet-audit` | $0.10 | Full wallet security audit (ENS + label + approvals + grade) |
| `nex_ens_reverse` | `/v1/ens-reverse` | $0.001 | Reverse ENS: address -> name |
| `nex_address_activity` | `/v1/address-activity` | $0.01 | Recent transactions for any address |

### Data Utilities (8)

| Tool | Endpoint | Paid price | Description |
|---|---|---|---|
| `nex_crypto_price` | `/v1/crypto-price` | $0.0001 | Real-time crypto prices (CoinGecko) |
| `nex_gas_tracker` | `/v1/gas-tracker` | $0.001 | Real-time gas (gwei) + block number |
| `nex_token_balance` | `/v1/token-balance` | $0.001 | ERC-20 token balance lookup |
| `nex_weather` | `/v1/weather` | $0.0001 | Weather forecast (Open-Meteo) |
| `nex_geo` | `/v1/geo` | $0.0001 | IP geolocation (ipapi.co) |
| `nex_fx` | `/v1/fx` | $0.0001 | Currency exchange rates (exchangerate.host) |
| `nex_whois` | `/v1/whois` | $0.0002 | Domain WHOIS |
| `nex_yield_scanner` | `/v1/yield-scanner` | $0.005 | DeFi yield scanner across 17K pools (DeFiLlama) |

## Install

```bash
pip install mcp
# CDP creds are OPTIONAL — only required if you pass `paid: true` on any call.
# Without them, every call goes to the free mirror (30/min/IP).
export CDP_API_KEY_ID=...
export CDP_API_KEY_SECRET=...
export CDP_WALLET_SECRET=...
# Paying wallet (defaults to NEX treasury 0x28F3D3fb24D4926BF5C35296c822d2a43D181177)
export NEX_WALLET=0x28F3D3fb24D4926BF5C35296c822d2a43D181177
# NEX x402 base URL (defaults to live Cloudflare tunnel)
export NEX_BASE_URL=https://lots-dave-morgan-sized.trycloudflare.com
```

## Run

```bash
python server.py
```

## Use from Claude Desktop / any MCP host

```json
{
  "mcpServers": {
    "nex": {
      "command": "python",
      "args": ["/path/to/nex-agent-co-mcp/server.py"],
      "env": {
        "CDP_API_KEY_ID": "...",
        "CDP_API_KEY_SECRET": "...",
        "CDP_WALLET_SECRET": "..."
      }
    }
  }
}
```

CDP creds are optional — omit them if you only need the free mirror.

## Example calls

**Free (default, no payment):**
```json
{ "name": "nex_crypto_price", "arguments": { "symbol": "BTC,ETH" } }
```

**Paid (x402 USDC on Base):**
```json
{ "name": "nex_crypto_price", "arguments": { "symbol": "BTC,ETH", "paid": true } }
```

**Multi-param (yield scanner):**
```json
{ "name": "nex_yield_scanner", "arguments": { "chain": "base", "stable": true, "min_tvl": 5000000, "min_apy": 5, "max": 10 } }
```

**Chat (OpenAI-compatible):**
```json
{ "name": "nex_chat_compat", "arguments": { "messages": [{"role": "user", "content": "Hello"}] } }
```

## Response envelope

Every call returns a JSON envelope so callers know what they hit:

```json
{
  "paid": false,
  "tier": "free",
  "path": "/v1/free/crypto-price",
  "price_usdc": 0.0,
  "result": { "...": "endpoint payload" }
}
```

For paid calls:

```json
{
  "paid": true,
  "tier": "paid",
  "path": "/v1/crypto-price",
  "price_usdc": 0.0001,
  "wallet": "0x28F3D3fb24D4926BF5C35296c822d2a43D181177",
  "result": { "...": "endpoint payload" }
}
```

## How payment works (when `paid: true`)

1. Server hits the NEX x402 endpoint, gets a `402 Payment Required` with EIP-3009 payment spec.
2. Server signs `transferWithAuthorization` (gasless, EIP-712 typed data) for the tier's price in USDC.
3. Server retries with the `X-PAYMENT: <base64url>` header.
4. Facilitator (PayAI / CDP) settles on-chain; NEX returns the response.
5. The user's wallet pays USDC directly to NEX treasury `0x28F3D3fb24D4926BF5C35296c822d2a43D181177`. No middleman custody.

For the default free path, steps 1-4 collapse to a plain HTTP POST against `/v1/free/<endpoint>`.

## Discovery

The upstream NEX x402 manifest is at:
```
https://lots-dave-morgan-sized.trycloudflare.com/.well-known/x402.json
```

## Backed by

Local open-weight models running on M5 Max 128GB:
- Qwen3.5 (Nemotron 3.5 Lightning, 1M ctx)
- Qwen3-Coder (30B)
- Qwen3-Coder-Next 80B-A3B (MoE)
- Qwen3.8 27B (vision)
- nomic-embed-text
- Plus 24 external data/security/web tools (SEC EDGAR, CoinGecko, Open-Meteo, DeFiLlama, ipapi.co, exchangerate.host, Base RPC, ENS, DuckDuckGo, …)

No data leaves the machine for inference. USDC on Base settles per call.

## More

- NEX x402 manifest: https://lots-dave-morgan-sized.trycloudflare.com/.well-known/x402.json
- Listed in: https://github.com/xpaysh/awesome-x402 (PR #1381)
- Treasury: `0x28F3D3fb24D4926BF5C35296c822d2a43D181177`