# JAW CLI & MCP Server > Command-line interface and MCP server for interacting with JAW smart accounts from terminal, shell scripts, or AI agents. **This file is self-contained.** You have everything needed to help with this topic. Do NOT fetch other llms-*.txt files unless the user explicitly asks about a different topic. ## Key Info - **Package:** `@jaw.id/cli` - **Install:** `npm install -g @jaw.id/cli` - **Dashboard:** https://dashboard.jaw.id - **Docs:** https://docs.jaw.id ## Quick Example ```typescript # Configure jaw config set apiKey=YOUR_KEY defaultChain=8453 # Connect wallet (opens browser for passkey) jaw rpc call wallet_connect # Send a transaction jaw rpc call wallet_sendCalls '{"calls":[{"to":"0x...","value":"0xDE0B6B3A7640000"}]}' # JSON output for scripts/agents jaw rpc call eth_accounts -o json -y ``` --- ## RPC Reference Source: https://docs.jaw.id/cli/api-reference ## RPC Reference All RPC methods supported by the JAW CLI via `jaw rpc call `. Methods marked with **Browser** require passkey confirmation in the browser. ### Account Methods \| Method | Browser | Description | \| ---------------------------- | ------- | ------------------------------------------ | \| `wallet_connect` | Yes | Connect and authenticate with passkey | \| `wallet_disconnect` | No | Disconnect the current session | \| `eth_requestAccounts` | Yes | Request account access (alias for connect) | \| `eth_accounts` | No | Get connected account addresses | \| `eth_chainId` | No | Get current chain ID | \| `wallet_switchEthereumChain` | No | Switch to a different chain | #### wallet\_connect ```bash jaw rpc call wallet_connect ``` Returns the connected account address. Opens the browser for passkey authentication on first connection. #### eth\_accounts ```bash jaw rpc call eth_accounts ``` Returns an array of connected addresses. Does not require browser approval. *** ### Transaction Methods \| Method | Browser | Description | \| ------------------------ | ------- | ------------------------------------ | \| `wallet_sendCalls` | Yes | Send one or more calls (recommended) | \| `eth_sendTransaction` | Yes | Send a single transaction (legacy) | \| `wallet_getCallsStatus` | No | Check transaction bundle status | \| `wallet_getCallsHistory` | No | Get transaction history | #### wallet\_sendCalls The preferred method for sending transactions. Supports batching, paymasters, and permission-based execution. ```bash # Single call jaw rpc call wallet_sendCalls '{"calls":[{"to":"0xRecipient","value":"0xDE0B6B3A7640000"}]}' # Batch calls jaw rpc call wallet_sendCalls '{"calls":[{"to":"0xAddr1","value":"0x1"},{"to":"0xAddr2","value":"0x2"}]}' # With paymaster (gas sponsoring) jaw rpc call wallet_sendCalls '{"calls":[{"to":"0xRecipient","value":"0x1"}],"capabilities":{"paymasterService":true}}' ``` #### wallet\_getCallsStatus ```bash jaw rpc call wallet_getCallsStatus '["0xBundleId"]' ``` Returns status (`pending`, `confirmed`) and receipts. *** ### Signing Methods \| Method | Browser | Description | \| ---------------------- | ------- | ------------------------ | \| `personal_sign` | Yes | Sign a plaintext message | \| `eth_signTypedData_v4` | Yes | Sign EIP-712 typed data | \| `wallet_sign` | Yes | Sign using ERC-7871 | #### personal\_sign ```bash # Message as hex-encoded string, followed by signer address jaw rpc call personal_sign '["0x48656c6c6f","0xYourAddress"]' ``` #### eth\_signTypedData\_v4 ```bash # Address followed by JSON-encoded typed data jaw rpc call eth_signTypedData_v4 '["0xYourAddress","{\"types\":{\"EIP712Domain\":[...],\"Mail\":[...]},\"primaryType\":\"Mail\",\"domain\":{...},\"message\":{...}}"]' ``` :::info The typed data parameter must be a JSON string within the JSON array — double-encoded. ::: *** ### Permission Methods \| Method | Browser | Description | \| -------------------------- | ------- | --------------------------- | \| `wallet_grantPermissions` | Yes | Grant delegated permissions | \| `wallet_revokePermissions` | Yes | Revoke a permission by hash | \| `wallet_getPermissions` | No | List active permissions | #### wallet\_grantPermissions ```bash jaw rpc call wallet_grantPermissions '{"permissions":[{"type":"call","data":{"to":"0xContractAddress"}},{"type":"spend","data":{"token":"0xUSDCAddress","limit":"1000000","period":"daily"}}],"expiry":1735689600}' ``` #### wallet\_revokePermissions ```bash jaw rpc call wallet_revokePermissions '{"permissionHash":"0x..."}' ``` #### wallet\_getPermissions ```bash jaw rpc call wallet_getPermissions ``` *** ### Query Methods \| Method | Browser | Description | \| ------------------------ | ------- | ------------------------------------ | \| `wallet_getCapabilities` | No | Get supported capabilities per chain | \| `wallet_getAssets` | No | Get token balances | #### wallet\_getCapabilities ```bash jaw rpc call wallet_getCapabilities ``` Returns supported features (atomicBatch, paymasterService, permissions) per chain. #### wallet\_getAssets ```bash jaw rpc call wallet_getAssets ``` Returns token balances for the connected account. *** ### Tips for AI Agents When using the CLI programmatically or via MCP: * Always pass `-o json` for machine-readable output * Use `-y` to skip confirmation prompts * Prefer `wallet_sendCalls` over `eth_sendTransaction` for batching and paymaster support * Check `wallet_getCapabilities` to discover supported features per chain ## Commands Source: https://docs.jaw.id/cli/commands ## Commands ### jaw rpc call Execute any EIP-1193 RPC method through the browser bridge. ```bash jaw rpc call [params] ``` #### Arguments \| Argument | Required | Description | \| -------- | -------- | ------------------------------------------------------------ | \| `method` | Yes | RPC method name (e.g., `wallet_connect`, `wallet_sendCalls`) | \| `params` | No | JSON string with method parameters | #### Flags \| Flag | Short | Default | Description | \| ----------- | ----- | ------- | -------------------------------- | \| `--output` | `-o` | `human` | Output format: `json` or `human` | \| `--chain` | `-c` | config | Chain ID (e.g., `8453` for Base) | \| `--api-key` | | config | JAW API key | \| `--timeout` | `-t` | `120` | Request timeout in seconds | \| `--yes` | `-y` | `false` | Skip confirmations | \| `--quiet` | `-q` | `false` | Suppress non-essential output | #### Examples **Connect wallet:** ```bash jaw rpc call wallet_connect ``` **Get accounts:** ```bash jaw rpc call eth_accounts ``` **Send ETH (0.01 ETH on Base):** ```bash jaw rpc call wallet_sendCalls '{"calls":[{"to":"0xRecipient","value":"0x2386F26FC10000"}]}' -c 8453 ``` **Send ERC-20 tokens:** ```bash jaw rpc call wallet_sendCalls '{"calls":[{"to":"0xTokenAddress","data":"0xa9059cbb000000000000000000000000RECIPIENT0000000000000000000000000000000000000000000000000000000000000000000000000000000DE0B6B3A7640000"}]}' -c 8453 ``` **Sign a message:** ```bash jaw rpc call personal_sign '["0x48656c6c6f","0xYourAddress"]' ``` **Grant permissions:** ```bash jaw rpc call wallet_grantPermissions '{"permissions":[{"type":"call","data":{"to":"0xContractAddress"}},{"type":"spend","data":{"token":"0xUSDCAddress","limit":"1000000","period":"daily"}}],"expiry":1735689600}' ``` **Check transaction status:** ```bash jaw rpc call wallet_getCallsStatus '["0xBundleId"]' ``` **JSON output (for scripts and AI agents):** ```bash jaw rpc call eth_accounts -o json -y ``` *** ### jaw config set Set one or more configuration values. ```bash jaw config set [key=value ...] ``` Valid keys: `apiKey`, `defaultChain`, `keysUrl`, `paymasterUrl`, `ens`, `relayUrl` #### Examples ```bash # Set API key and chain jaw config set apiKey=YOUR_KEY defaultChain=8453 # Enable ENS resolution jaw config set ens=myapp.eth # Set paymaster for gas sponsoring jaw config set paymasterUrl=https://paymaster.example.com # Use a self-hosted relay jaw config set relayUrl=wss://relay.mycompany.com ``` *** ### jaw config show Display current configuration. The API key is redacted in output. ```bash jaw config show jaw config show -o json ``` *** ### jaw disconnect Close the relay session and browser tab. Cleans up the session stored in `~/.jaw/relay.json`. ```bash jaw disconnect ``` *** ### jaw mcp Start the MCP server on stdio for AI agent integration. See the [MCP Server](/cli/mcp) page for setup details. ```bash jaw mcp ``` *** ### jaw version Display the CLI version. ```bash jaw version jaw -v ``` ## JAW CLI Source: https://docs.jaw.id/cli/index ## JAW CLI The JAW CLI (`@jaw.id/cli`) is a command-line interface for interacting with JAW smart accounts from the terminal. It supports developers, shell scripts, and AI agents through both direct commands and an MCP server. ### How It Works The CLI doesn't store private keys. Instead, it connects through a WebSocket relay to a browser tab where passkey signing happens. All messages between the CLI and browser are **end-to-end encrypted** (ECDH P-256 + AES-256-GCM) — the relay is a blind pipe that cannot read your data. ``` ┌─────────┐ E2E Encrypted ┌──────────────┐ E2E Encrypted ┌─────────────┐ │ CLI │ ◄──────────────────────► │ Relay │ ◄──────────────────────► │ Browser │ │ (jaw) │ via WebSocket │ relay.jaw.id │ via WebSocket │ keys.jaw.id │ └─────────┘ └──────────────┘ └─────────────┘ Passkey Auth ``` 1. You run a CLI command (e.g., `jaw rpc call wallet_connect`) 2. The CLI connects to the relay and opens a browser tab to `keys.jaw.id` 3. The browser authenticates with your passkey and connects to the same relay session 4. Commands are encrypted end-to-end — the relay never sees your data 5. The browser executes the request (signing, transactions) and returns the result Read-only methods like `eth_accounts` or `wallet_getAssets` don't require browser approval. ### Installation :::code-group ```bash [npm] npm install -g @jaw.id/cli ``` ```bash [pnpm] pnpm add -g @jaw.id/cli ``` ```bash [yarn] yarn global add @jaw.id/cli ``` ```bash [bun] bun add -g @jaw.id/cli ``` ::: **Requirements:** Node.js 18+ ### Configuration Set your API key and default chain before using the CLI: ```bash jaw config set apiKey=YOUR_API_KEY defaultChain=8453 ``` Get an API key from the [JAW Dashboard](https://dashboard.jaw.id). #### Configuration Keys \| Key | Description | Example | \| -------------- | --------------------------------- | ----------------------------------------- | \| `apiKey` | Your JAW API key (required) | `jaw config set apiKey=sk_...` | \| `defaultChain` | Default chain ID | `jaw config set defaultChain=8453` | \| `ens` | ENS domain for subname resolution | `jaw config set ens=myapp.eth` | \| `paymasterUrl` | Paymaster URL for gas sponsoring | `jaw config set paymasterUrl=https://...` | \| `keysUrl` | Keys service URL | Default: `https://keys.jaw.id` | \| `relayUrl` | Relay WebSocket URL | Default: `wss://relay.jaw.id` | #### Resolution Order Configuration values are resolved in this order (first match wins): 1. CLI flags (`--api-key`, `--chain`) 2. Environment variables (`JAW_API_KEY`, `JAW_CHAIN_ID`, `JAW_OUTPUT`) 3. Config file (`~/.jaw/config.json`) 4. Built-in defaults #### Quick Start ```bash # Configure jaw config set apiKey=YOUR_KEY defaultChain=8453 # Connect your wallet (opens browser for passkey) jaw rpc call wallet_connect # Check your address jaw rpc call eth_accounts # Send a transaction jaw rpc call wallet_sendCalls '{"calls":[{"to":"0xRecipient","value":"0xDE0B6B3A7640000"}]}' ``` ### Self-Hosting the Relay The relay server is open-source and can be self-hosted. Since it's a blind pipe (all messages are E2E encrypted), self-hosting is mainly about availability and infrastructure control. **Repository:** [github.com/JustaName-id/jaw-relay](https://github.com/JustaName-id/jaw-relay) #### Docker (Recommended) ```bash docker build -t jaw-relay . docker run -p 8080:8080 jaw-relay ``` #### Node.js ```bash npm install npm run build PORT=8080 node dist/index.js ``` #### Point CLI to Your Relay ```bash jaw config set relayUrl=wss://your-relay-host.com ``` \| Variable | Default | Description | \| -------- | ------- | --------------------- | \| `PORT` | `8080` | Server listening port | Sessions auto-expire after 15 minutes of inactivity. The relay supports reconnection within the session lifetime. ## MCP Server Source: https://docs.jaw.id/cli/mcp ## MCP Server The JAW CLI includes an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server that lets AI agents interact with JAW smart accounts programmatically. ### Setup with Claude Desktop Add this to your `claude_desktop_config.json`: ```json { "mcpServers": { "jaw": { "command": "npx", "args": ["-y", "@jaw.id/cli", "mcp"], "env": { "JAW_API_KEY": "YOUR_API_KEY", "JAW_CHAIN_ID": "8453" } } } } ``` The MCP server runs on stdio transport — no ports or URLs to configure. :::info Environment variables in the MCP config follow the same resolution order as the CLI. You can also pre-configure via `jaw config set` and omit the `env` block. ::: ### Available Tools \| Tool | Description | \| ----------------- | -------------------------------------------------------- | \| `jaw_rpc` | Execute any RPC method (`method`, `params?`, `chainId?`) | \| `jaw_config_show` | Display current configuration | \| `jaw_config_set` | Update a configuration value (`key`, `value`) | \| `jaw_status` | Check relay session and connection status | \| `jaw_disconnect` | Close relay session and browser tab | #### jaw\_rpc The primary tool. Executes any EIP-1193 RPC method through the browser bridge. ```json { "method": "wallet_sendCalls", "params": { "calls": [{ "to": "0x...", "value": "0x..." }] }, "chainId": 8453 } ``` Methods that require signing (e.g., `wallet_sendCalls`, `personal_sign`) will open the browser for passkey confirmation on first use. The session persists across multiple tool calls. #### jaw\_config\_set ```json { "key": "defaultChain", "value": "8453" } ``` Valid keys: `apiKey`, `defaultChain`, `keysUrl`, `paymasterUrl`, `ens` ### Available Resources The MCP server exposes documentation resources that AI agents can read for context. \| Resource URI | Description | \| ------------------------------ | -------------------------------------------- | \| `jaw://api-reference` | Index of all supported RPC methods | \| `jaw://api-reference/{method}` | Detailed documentation for a specific method | ### Agent Skills For AI coding assistants that support [skills](https://skills.sh), there's an official skill package that provides deep knowledge of the JAW CLI and SDK. **Repository:** [github.com/JustaName-id/jaw-skills](https://github.com/JustaName-id/jaw-skills) #### Install ```bash npx skills add JustaName-id/jaw-skills ``` This installs two skills: \| Skill | Description | \| ------------------------ | --------------------------------------------------- | \| `jaw-cli` | CLI usage patterns and best practices | \| `jaw-sdk-best-practices` | SDK development patterns and architectural guidance | Once installed, AI assistants automatically apply JAW-specific guidance when working with CLI commands or SDK integration code.