Skip to main content
Glama
AgentKit x402 Edge API & MCP Server

AgentKit x402 Edge API & MCP Server

by clytjpgemini
README.md
# โšก AgentKit x402 Edge API & MCP Server (v1.1)

Zero-API-key, pay-per-request edge utilities and **Streamable HTTP MCP Server** for **AI Agents & Developers**, powered by **Cloudflare Workers** and **x402 v2 Mainnet USDC** (Base & Solana via PayAI Facilitator).

๐ŸŒ **Live API & Playground**: https://agentkit.clytjpgemini.workers.dev  
๐Ÿ”Œ **MCP Endpoint (Streamable HTTP)**: `https://agentkit.clytjpgemini.workers.dev/mcp` ([manifest](https://agentkit.clytjpgemini.workers.dev/mcp.json))  
๐Ÿค– **Machine Discovery**: `/.well-known/x402` ยท `/llms.txt` ยท `/openapi.json`

## Paid x402 Endpoints (Base & Solana Mainnet USDC)

| Endpoint | Price (USDC) | Description |
| :--- | :---: | :--- |
| `GET /v1/dns/audit?domain=github.com` | `$0.01` | SPF, DMARC, MX, CAA, IPv6, DNSSEC security audit + A+..F grade & fixes |
| `GET /v1/http/headers-audit?url=https://cloudflare.com` | `$0.005` | HSTS, CSP, XFO, XCTO, Referrer & Permissions-Policy security audit + grade |
| `GET /v1/web/extract?url=https://...` | `$0.01` | Clean URL-to-Markdown + OpenGraph + JSON-LD metadata + deduplicated links |
| `GET /v1/web/feed?url=https://...` | `$0.005` | RSS 2.0 / Atom feed to clean LLM-ready JSON digest |
| `GET /v1/crypto/balance?chain=base&address=0x...` | `$0.005` | Normalized Base (ETH + USDC) or Solana (SOL + USDC) live wallet balance |

## Connect as an MCP Server (Claude Code / Cursor / Antigravity / Windsurf)

```json
{
  "mcpServers": {
    "agentkit-x402": {
      "transport": "streamable-http",
      "url": "https://agentkit.clytjpgemini.workers.dev/mcp"
    }
  }
}
```

## Free Endpoints

- `POST /mcp` & `GET /mcp.json` โ€” Streamable HTTP MCP Server (catalog, edge info, live DNS demo, x402 challenge generator)
- `GET /health` โ€” Service health
- `GET /v1/free/demo-audit` โ€” Sample output of `/v1/dns/audit` for `example.com`
- `GET /v1/free/edge-info` โ€” Request edge colo, IP, ASN, UTC time

## Quick Test

```bash
# Inspect HTTP 402 Payment Challenge & PAYMENT-REQUIRED header
curl -i "https://agentkit.clytjpgemini.workers.dev/v1/http/headers-audit?url=https://cloudflare.com"

# List MCP tools via Streamable HTTP
curl -s -X POST "https://agentkit.clytjpgemini.workers.dev/mcp"   -H "Content-Type: application/json"   -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

## Architecture

- **Zero dependencies**: Single ES Module Cloudflare Worker (`worker.js`), sub-50ms edge latency.
- **Dual-chain x402 v2**: Accepts USDC on **Base (`eip155:8453`)** and **Solana (`solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`)** with Bazaar discovery extension metadata.
- **SSRF-protected**: Blocks loopback, RFC1918 private networks, and metadata IPs on fetch routes.

## Self-Custodial Treasury & Sponsorship

- **Base / EVM USDC**: `0x438491c605533C8C651664B567CDA0a2009b9ec0`
- **Solana USDC / SOL**: `5gqTBUc5nJKyz4teYJASAwk9U2JFt56goHzYSY5jkJcS`

License: MIT