> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rndrntwrk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# @sw4p/kit

> Agent-native settlement surface over sw4p, MCP server, AP2 Cart Mandates, x402 V2, A2A, and ERC-7683 intents in one package.

<Info>**Status:** Pre-publish. Source available at [github.com/Render-Network-OS/sw4p-kit](https://github.com/Render-Network-OS/sw4p-kit). Public npm publish ships with the mainnet return.</Info>

# @sw4p/kit

**`@sw4p/kit` is the agent-native surface for sw4p.** It lets any MCP-aware agent, Claude Code, Cursor, Continue, Goose, Codex, Cline, ElizaOS, Hermes, Open Claw, settle cross-chain through the [sw4p](/sw4p) settlement engine over every open agent payment standard.

The kit is a thin client. Chain interaction, custody, rail selection, gas abstraction, and the settlement lifecycle live in the sw4p backend. The kit gives agents a small, opinionated tool surface and the wrappers for the open agent-payment standards.

## Why a separate kit

The sw4p backend already speaks HTTP via `@sw4p/sdk`. The kit exists for one reason: **agents don't read HTTP APIs, they read MCP tool surfaces.** Wrapping the SDK in MCP lets any agent settle cross-chain with a two-tool surface (`sw4p.balance` and `sw4p.send`) rather than hand-rolling 30+ method calls.

Beyond MCP, the kit adapts every other open agent-payment standard to the same backend:

* **MCP 2025-11-25**: tools + async Tasks primitive for long-running settlement
* **AP2 Cart Mandates**: HMAC-signed cart authorization with canonical JSON
* **x402 V2**: framework-agnostic 402 middleware + client (Web Request/Response, works in any runtime)
* **A2A (Agent-to-Agent)**: Zod-validated payment messages + handler factory
* **ERC-7683 intent builder**: produces the on-chain intent struct for solver-based execution

## Surface area

| Module    | What it does                                                                         | Talks to            |
| --------- | ------------------------------------------------------------------------------------ | ------------------- |
| `mcp`     | MCP server (stdio + Streamable HTTP), tool registry, async Tasks                     | sw4p HTTP API       |
| `core`    | `SettlementClient`, `KitError` taxonomy, in-process `TaskStore`, gasless abstraction | sw4p HTTP API       |
| `ap2`     | Cart Mandates, HMAC signer, canonical JSON, budget guard                             | Pure crypto + data  |
| `x402`    | Middleware + client + discovery                                                      | Pure HTTP semantics |
| `a2a`     | PayRequest / PaySettled / PayFailed schemas + handler factory                        | sw4p HTTP API       |
| `intents` | ERC-7683 intent struct builder                                                       | Pure data builder   |

## Tool surface (MCP)

The kit exposes a deliberately small set of MCP tools so agents see a clean surface:

* `sw4p.balance`, USDC balance across configured chains
* `sw4p.send`, submit a settlement (cross-chain or same-chain). One call: submit → settle.
* `sw4p.estimate`, pre-flight fee + route quote
* `sw4p.status`, poll a settlement by intent ID
* `sw4p.portfolio`, cross-chain portfolio aggregation
* `sw4p.rebalance_plan` / `sw4p.rebalance_execute`, agent-driven rebalance
* `sw4p.task`, MCP 2025-11-25 async task primitive
* `sw4p.ap2.cart_propose` / `sw4p.ap2.cart_execute`, AP2 Cart Mandate flow (when an AP2 signing key is configured)

## Quickstart (source install, pre-publish)

```bash theme={null}
git clone https://github.com/Render-Network-OS/sw4p-kit
cd sw4p-kit && npm install && npm run build
```

Add to any MCP-aware client (Claude Code, Cursor, Continue, Zed, ElizaOS, Hermes, Open Claw):

```json theme={null}
{
  "mcpServers": {
    "sw4p": {
      "command": "node",
      "args": ["<abs-path>/sw4p-kit/dist/mcp/bin.js"],
      "env": { "SW4P_API_KEY": "..." }
    }
  }
}
```

Once `@sw4p/kit` publishes to npm, this collapses to:

```bash theme={null}
npm install @sw4p/kit
# then args: ["sw4p-mcp"] via npx
```

## Standards covered

| Standard                       | Where in the kit |
| ------------------------------ | ---------------- |
| MCP 2025-11-25 (tools + Tasks) | `src/mcp/*`      |
| AP2 Cart Mandates (Google)     | `src/ap2/*`      |
| x402 V2 (Coinbase)             | `src/x402/*`     |
| A2A (Agent-to-Agent)           | `src/a2a/*`      |
| ERC-7683 intents               | `src/intents/*`  |

## Distribution roadmap

* **Now:** source install from GitHub.
* **Next:** `npx @sw4p/kit init` for one-command setup across every major MCP-aware agent. Auto-detects Claude Code / Cursor / Continue / Goose / Codex / Cline / Aider / ElizaOS / Hermes / Open Claw configs and writes the right config file.
* **Next:** hosted MCP gateway at `mcp.sw4p.io` for remote agents (claude.ai web, Cursor cloud, etc.), no local install required.
* **Then:** public npm publish, MCP Registry submission, Smithery listing.
* **Then:** `@sw4p/eliza-plugin` for first-class ElizaOS integration.

## Reference

* **Source:** [github.com/Render-Network-OS/sw4p-kit](https://github.com/Render-Network-OS/sw4p-kit)
* **License:** MIT
* **Backend:** [sw4p](/sw4p), the settlement engine the kit wraps
* **SDK:** [`@sw4p/sdk`](/sw4p#sdk), the lower-level HTTP client the kit is built on
