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

# Agent Session (MCP)

> A complete MCP JSON-RPC session against Skia: initialize, tools/list, issue_invoice, acknowledge_invoice, pay_invoice, get_receivable.

# Agent Session — MCP

A complete agent session against the hosted MCP server
(`https://mcp.skia.money`), speaking JSON-RPC 2.0 over Streamable HTTP
(protocol `2025-06-18`). The same calls work same-origin against
`/api/mcp`. Bearer on testnet = the agent's wallet address (simulated
ethSigAuth).

## 1. Initialize

```bash theme={null}
curl -s https://mcp.skia.money/mcp -X POST \
  -H 'Content-Type: application/json' -H 'Accept: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2025-06-18",
      "capabilities": {},
      "clientInfo": { "name": "my-agent", "version": "1.2.0" }
    }
  }'
```

The result carries the server's capabilities and its **instructions** — which
include the invoice-family flow (issue → acknowledge → pay → read). Follow
with `notifications/initialized` (a notification: fire and forget, no id).

## 2. Discover the tools

```bash theme={null}
curl -s https://mcp.skia.money/mcp -X POST \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
```

Sixteen tools come back — the settlement family (`skia_get_quote`,
`skia_commit`, `skia_reveal`, `skia_swap`, ...) plus the five locked invoice
names: `issue_invoice`, `acknowledge_invoice`, `pay_invoice`,
`dispute_invoice`, `get_receivable`. Each carries its input schema; every
invoice tool is a thin proxy over the same handlers the REST routes use —
one law, two mounts.

## 3. Issue the invoice

```bash theme={null}
curl -s https://mcp.skia.money/mcp -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer 0x<issuer-address>' \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "issue_invoice",
      "arguments": {
        "claim": {
          "invoiceId": "INV-2026-002",
          "issuer": "0x<issuer-address>",
          "debtor": "0x<debtor-address>",
          "amount": "250000000",
          "currency": "USDC",
          "settleChainId": 196,
          "issuedAt": 1793500000,
          "dueAt": 1794796000,
          "gracePeriodSeconds": 604800,
          "lateFeeBpsPerDay": 30,
          "feeBearer": "debtor",
          "memo": "Agent services, SOW-14"
        },
        "issuerSignature": "0x<65-byte EIP-712 signature over the claim digest>"
      }
    }
  }'
```

The tool result carries `claimHash` and `restrictionCheck` — the same
`IssueInvoiceResponse` the REST path returns.

## 4. Acknowledge (the debtor's agent)

```bash theme={null}
curl -s https://mcp.skia.money/mcp -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer 0x<debtor-address>' \
  -d '{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "tools/call",
    "params": {
      "name": "acknowledge_invoice",
      "arguments": {
        "invoiceId": "INV-2026-002",
        "decision": "acknowledge",
        "debtorSignature": "0x<65-byte countersignature over the same claim digest>"
      }
    }
  }'
```

## 5. Pay

```bash theme={null}
curl -s https://mcp.skia.money/mcp -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer 0x<debtor-address>' \
  -d '{
    "jsonrpc": "2.0",
    "id": 5,
    "method": "tools/call",
    "params": {
      "name": "pay_invoice",
      "arguments": {
        "invoiceId": "INV-2026-002",
        "templateId": "swap-direct"
      }
    }
  }'
```

The result is the payment intent: the attempt (`INTENT_CREATED`, fresh nonce,
pinned amount) and the unsigned 10-minute Order template. The debtor's agent
signs the template offline and binds it — `POST
/v1/invoices/{invoiceId}/payments/{attemptId}/order` (REST) — then settles
through the existing commit → reveal lanes. The MCP surface never forks
settlement logic.

## 6. Read the receivable

```bash theme={null}
curl -s https://mcp.skia.money/mcp -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer 0x<issuer-address>' \
  -d '{
    "jsonrpc": "2.0",
    "id": 6,
    "method": "tools/call",
    "params": {
      "name": "get_receivable",
      "arguments": { "invoiceId": "INV-2026-002" }
    }
  }'
```

The pure fold view: status, outstanding, paidToDate, creditedToDate,
openDisputedAmount, lateFeeAccrued — and the full event list.

## Role law is server-side

A tool call with the wrong bearer fails the same way REST does — the proxies
forward to the same handlers:

* Only the **issuer** issues, credits, voids, declares default.
* Only the **debtor** acknowledges, rejects, disputes, pays, binds.
* Reads are two-party.

## Where to next

* Point a client at the server: [MCP Server](https://docs.skia.money/mcp-server.md).
* The REST twin of this session: [Invoice lifecycle](https://docs.skia.money/examples/invoice-lifecycle.md).
* What the fold view means: [Invoices](https://docs.skia.money/concepts/invoices.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.