npm package: @frontiercompute/zcash-402
Description: Shielded x402 payment facilitator for AI agents. Pay for HTTP resources with ZEC via split-key MPC signing and ZAP1 attestation.
Author: Zk-nd3r
Latest version: 0.1.0

# @frontiercompute/zcash-402

Shielded x402 payment facilitator for AI agents. Part of the [ShieldedVault](https://frontiercompute.cash) agent custody stack.

## What this does

An MCP server that lets AI agents pay for HTTP resources using shielded ZEC. The payment flow:

1. Agent encounters an x402-gated resource (HTTP 402)
2. `zcash-402` negotiates payment terms with the resource server
3. Constructs a shielded ZEC transaction via split-key MPC signing
4. Attests the payment via ZAP1 (creates a verifiable Merkle receipt)
5. Submits payment proof to unlock access

The agent never holds the full spending key. Policy enforcement lives on-chain via Ika 2PC-MPC. Every payment has a ZAP1 attestation anchored on Zcash mainnet.

## Tools (4 MCP tools)

| tool | description |
|------|-------------|
| `pay_resource` | Pay for an x402-gated HTTP resource using shielded ZEC |
| `check_balance` | Check available shielded balance for payments |
| `verify_receipt` | Verify a ZAP1 attestation receipt from a prior payment |
| `list_payments` | List recent payments with attestation status |

## Quick start

```bash
npm install @frontiercompute/zcash-402
```

Configure environment:

```bash
export ZAP1_API_KEY="your-api-key"
export IKA_DWALLET_ID="your-dwallet-id"
export ZEC_PAYMENT_ADDRESS="your-shielded-address"
export ZEBRA_RPC_URL="http://127.0.0.1:8232"  # optional, defaults to localhost
```

Run as MCP server:

```bash
npx @frontiercompute/zcash-402
```

## Discovery

This package includes a `.well-known/mcp.json` server card for auto-discovery by MCP-compatible clients (Claude Desktop, Cursor, Windsurf, VS Code).

## Architecture

```
Agent (via MCP)
    |
    v
zcash-402 (this package)
    |
    +-- x402/negotiate.ts    parse 402 response, extract payment terms
    +-- x402/construct.ts    build shielded ZEC tx via Zebra RPC
    +-- x402/submit.ts       submit payment proof to resource server
    +-- attestation/         create ZAP1 receipt for the payment
    |
    v
zcash-ika (split-key MPC)   agent signs, never holds full key
    |
    v
Zcash mainnet                transaction broadcast + ZAP1 anchor
```

## ShieldedVault properties

This package implements two of the five ShieldedVault agent custody properties:

- **Non-drainable**: the agent can pay but never holds the full spending key (Ika 2PC-MPC)
- **Attested**: every payment produces a ZAP1 Merkle receipt anchored on Zcash mainnet

## Related packages

| package | description |
|---------|-------------|
| [@frontiercompute/zcash-mcp](https://www.npmjs.com/package/@frontiercompute/zcash-mcp) | MCP server for Zcash (12 tools) |
| [@frontiercompute/zcash-ika](https://www.npmjs.com/package/@frontiercompute/zcash-ika) | Split-key MPC custody via Ika |
| [@frontiercompute/zap1](https://www.npmjs.com/package/@frontiercompute/zap1) | ZAP1 attestation protocol SDK |
| [@frontiercompute/openclaw-zap1](https://www.npmjs.com/package/@frontiercompute/openclaw-zap1) | AI agent attestation wrapper |

## License

MIT