Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/ai-agents/guides/batch-calls.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "Execute Contract Calls"
description: "Batch multiple contract interactions into a single user approval using send_calls and Base MCP"
keywords: ["send_calls MCP", "batch contract calls AI", "EIP-5792 AI", "DeFi AI agent", "Morpho AI Base", "batch transaction AI"]
---

import { AcceptingPaymentsDemo } from "/snippets/AcceptingPaymentsDemo.jsx"

<AcceptingPaymentsDemo />

## What it does

`send_calls` submits a batch of EIP-5792 contract calls to your Base Account in a single approval. Use it for DeFi interactions, multi-step operations, and NFT mints that go beyond simple send or swap.

The most common use case: protocol plugins like [Morpho](/ai-agents/plugins/morpho) prepare a `calls` array (including token approvals and deposits), and you pass it directly to `send_calls` — everything executes atomically in one approval.

## What you can ask

With the [Morpho plugin](/ai-agents/plugins/morpho) installed:

```text
Find the best USDC vault on Base and deposit 100 USDC
```

```text
Supply 1 ETH as collateral on Morpho and borrow 2000 USDC
```

```text
Repay all my Morpho debt
```

## How it works

<Steps>
<Step title="A plugin prepares the calls">
Protocol plugins like Morpho return a `calls` array and `chainId` from their `prepare_*` tools. The calls include any required token approvals and the protocol interaction itself.
</Step>
<Step title="Your assistant calls send_calls()">
Passes the `calls` array and hex `chainId` to Base MCP.
</Step>
<Step title="You review and approve">
Open the `keys.coinbase.com` link to review all calls in the batch before signing.
</Step>
<Step title="Calls execute onchain">
All calls in the batch execute atomically — if one fails, none go through.
</Step>
</Steps>

## Parameters

| Parameter | Required | What it does |
|-----------|----------|-------------|
| `chainId` | Yes | Hex chain ID: `0x2105` for Base mainnet, `0x14a34` for Base Sepolia |
| `calls` | Yes | Array of `{ to, value?, data? }` objects |

## Related guides

<CardGroup cols={2}>
<Card title="Morpho plugin" icon="puzzle-piece" href="/ai-agents/plugins/morpho">
Full Morpho orchestration pattern — query, prepare, execute.
</Card>
<Card title="Sign messages" icon="pen-nib" href="/ai-agents/guides/sign-messages">
Sign individual messages and typed data.
</Card>
</CardGroup>
53 changes: 53 additions & 0 deletions docs/ai-agents/guides/check-balance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "Check Balance & Portfolio"
description: "View your token balances, portfolio value, and wallet details using Base MCP"
keywords: ["check balance AI", "get_portfolio MCP", "get_wallets MCP", "Base wallet balance AI assistant"]
---

import { DataFetchingDemo } from "/snippets/DataFetchingDemo.jsx"

<DataFetchingDemo />

## What you can ask

```text
Show me my wallets
```

```text
What's my USDC balance on Base?
```

```text
Show my full portfolio
```

```text
What's the balance of 0x1234...abcd?
```

## How it works

**`get_wallets`** — lists all wallets in your wallet group (your Base Account plus any agent wallets). Shows which wallets are active in the current session (`inSession: true`).

**`get_portfolio`** — returns portfolio value and per-asset breakdown. Works for any public address — not just your own.

| Parameter | What it does |
|-----------|-------------|
| `address` | Address to query — defaults to your Base Account |
| `chain` | Filter by chain: `base` or `ethereum` |
| `query` | Filter by token name or symbol (e.g. "USDC") |
| `includePnl` | Include unrealized/realized P&L per asset |

**`search_tokens`** — resolve a token symbol or name to its contract address and decimals. Useful before sending less common tokens.

## Related guides

<CardGroup cols={2}>
<Card title="Send tokens" icon="paper-plane" href="/ai-agents/guides/send-tokens">
Send ETH or any ERC-20 from your Base Account.
</Card>
<Card title="View transaction history" icon="clock-rotate-left" href="/ai-agents/guides/view-history">
See past sends, swaps, and receives.
</Card>
</CardGroup>
29 changes: 29 additions & 0 deletions docs/ai-agents/guides/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Guides"
description: "Step-by-step guides for common things to do with Base MCP"
keywords: ["Base MCP guides", "send tokens AI", "swap tokens AI", "check balance AI", "x402 payments AI"]
---

<CardGroup cols={2}>
<Card title="Check balance & portfolio" icon="wallet" href="/ai-agents/guides/check-balance">
View your token balances, portfolio value, and wallet details.
</Card>
<Card title="Send tokens" icon="paper-plane" href="/ai-agents/guides/send-tokens">
Send ETH or any ERC-20 to an address, ENS name, or basename.
</Card>
<Card title="Swap tokens" icon="arrows-rotate" href="/ai-agents/guides/swap-tokens">
Swap between any two tokens via the Coinbase swap service.
</Card>
<Card title="Pay for services (x402)" icon="bolt" href="/ai-agents/guides/pay-for-services">
Pay for API access per-request in USDC — no subscriptions, no API keys.
</Card>
<Card title="View transaction history" icon="clock-rotate-left" href="/ai-agents/guides/view-history">
Browse past transactions and filter by asset or date range.
</Card>
<Card title="Sign messages" icon="pen-nib" href="/ai-agents/guides/sign-messages">
Sign EIP-712 typed data and plain messages for authentication.
</Card>
<Card title="Execute contract calls" icon="code" href="/ai-agents/guides/batch-calls">
Batch multiple contract interactions into a single user approval.
</Card>
</CardGroup>
90 changes: 90 additions & 0 deletions docs/ai-agents/guides/pay-for-services.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: "Pay for Services (x402)"
description: "Pay for API access per-request in USDC using the x402 protocol — no subscriptions, no API keys required"
keywords: ["x402 payments AI", "pay for API AI", "pay-for-service skill", "x402 protocol Base", "USDC API payments AI agent"]
---

import { PaymentsQuickstartDemo } from "/snippets/PaymentsQuickstartDemo.jsx"

<PaymentsQuickstartDemo />

## What is x402?

x402 is a payment protocol built on HTTP status `402 Payment Required`. When your agent calls an x402-enabled API without paying, the server responds with `402` and payment terms (amount, token, network). Your agent pays in USDC and retries — the entire flow is automatic.

No subscriptions. No API keys. No pre-existing relationship with the provider.

## What you can ask

```text
Find a weather API and get the forecast for New York
```

```text
Get the current ETH price from a paid data source
```

```text
Find APIs for sentiment analysis
```

```text
Set up a paid endpoint for my market data at $0.01 per request
```

## x402 with CDP Agentic Wallet

x402 payments currently require the **CDP Agentic Wallet** skill. Install it once and your agent handles discovery, payment, and retries automatically.

```bash Terminal
npx skills add coinbase/agentic-wallet-skills
```

Then authenticate:

```text
Sign in to my wallet with your@email.com
```

The `pay-for-service` skill handles the full flow: discovers the API, pays in USDC, retries with the payment signature, and returns the data.

<Note>
x402 support for Base MCP is coming soon. Once available, no separate wallet skill will be needed — your Base Account will pay directly.
</Note>

## How the x402 flow works

<Steps>
<Step title="Your agent makes a request">
A standard HTTP request to any x402-enabled endpoint.
</Step>
<Step title="Server responds with 402">
The response includes payment terms: how much, which token, which network.
</Step>
<Step title="Your agent pays">
The CDP Agentic Wallet constructs and signs a payment in USDC on Base.
</Step>
<Step title="Your agent retries">
The original request is retried with the `X-Payment-Signature` header. The server verifies and returns the data.
</Step>
</Steps>

## Discover x402 services

Browse the x402 Bazaar to find APIs that accept per-request USDC payments:

```bash Terminal
npx awal@latest x402 bazaar search "price feed"
npx awal@latest x402 bazaar list --network base
```

## Reference

<CardGroup cols={2}>
<Card title="CDP Agentic Wallet" icon="coins" href="/ai-agents/skills/wallets/cdp-agentic-wallet">
Install the wallet skill needed for x402 payments today.
</Card>
<Card title="CDP Payment Skills" icon="bolt" href="/ai-agents/skills/payments/cdp-payment-skills">
search-for-service, pay-for-service, and monetize-service skills.
</Card>
</CardGroup>
73 changes: 73 additions & 0 deletions docs/ai-agents/guides/send-tokens.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: "Send Tokens"
description: "Send ETH or any ERC-20 token to an address, ENS name, basename, or cb.id using Base MCP"
keywords: ["send tokens AI", "send USDC AI assistant", "send ETH AI", "Base MCP send", "ENS basename send AI"]
---

import { TradeExecutionDemo } from "/snippets/TradeExecutionDemo.jsx"

<TradeExecutionDemo />

## What you can ask

```text
Send 10 USDC to alice.base.eth
```

```text
Transfer 0.01 ETH to 0x1234...abcd
```

```text
Pay bob.eth 5 USDC
```

```text
Send 50 DEGEN to vitalik.eth
```

## How it works

The `send` tool constructs a transaction from your Base Account and requires your approval at `keys.coinbase.com`. Nothing is sent until you confirm.

| Parameter | Required | What it does |
|-----------|----------|-------------|
| `recipient` | Yes | Address, ENS name, basename (e.g. `alice.base.eth`), cb.id name, or username |
| `amount` | Yes | Human-readable decimal (e.g. `"10.5"`) |
| `asset` | Yes | Token symbol (`ETH`, `USDC`) or ERC-20 contract address |
| `chain` | Yes | `base` or `base-sepolia` |
| `decimals` | When using contract address | Required when `asset` is a contract address |

<Tip>
For common tokens like ETH and USDC, just use the symbol — no contract address needed. For less common tokens, your assistant will call `search_tokens` first to resolve the address and decimals automatically.
</Tip>

## Approval flow

Every send requires a manual approval:

<Steps>
<Step title="Your assistant calls send()">
The transaction is constructed but not yet broadcast.
</Step>
<Step title="You receive an approval link">
Open the `keys.coinbase.com` link to review the recipient, amount, and fee.
</Step>
<Step title="You approve">
Confirm the transaction in the approval UI. Nothing is sent without your explicit confirmation.
</Step>
<Step title="Transaction confirms">
Your assistant polls `get_request_status` and reports success once the transaction is confirmed onchain.
</Step>
</Steps>

## Related guides

<CardGroup cols={2}>
<Card title="Swap tokens" icon="arrows-rotate" href="/ai-agents/guides/swap-tokens">
Exchange one token for another.
</Card>
<Card title="Check balance" icon="wallet" href="/ai-agents/guides/check-balance">
Verify your balance before sending.
</Card>
</CardGroup>
60 changes: 60 additions & 0 deletions docs/ai-agents/guides/sign-messages.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: "Sign Messages"
description: "Sign EIP-712 typed data and plain messages with your Base Account using Base MCP"
keywords: ["sign message AI", "EIP-712 sign AI", "personal_sign AI", "Base MCP sign", "sign typed data AI assistant"]
---

import { X402PayDemo } from "/snippets/x402PayDemo.jsx"

<X402PayDemo />

## What it does

The `sign` tool requests a cryptographic signature from your Base Account. Like all write tools, it requires your approval at `keys.coinbase.com`.

Two signature types are supported:

| Type | Standard | Use case |
|------|----------|---------|
| `0x45` | personal_sign (EIP-191) | Simple text messages, SIWE auth challenges |
| `0x01` | EIP-712 typed data | Structured data, permit signatures, protocol auth |

## What you can ask

```text
Sign this message: "I agree to the terms of service"
```

```text
Sign in to this app using my Base Account
```

Signing is usually invoked by protocols or integrations, not directly prompted by users. Your assistant will handle the signing flow when a service requests it.

## How it works

<Steps>
<Step title="Your assistant calls sign()">
Passes the message type and payload to Base MCP.
</Step>
<Step title="You receive an approval link">
Open `keys.coinbase.com` to review what you're signing — the message content is shown in full.
</Step>
<Step title="You approve">
Confirm the signature in the approval UI.
</Step>
<Step title="Signature returned">
Your assistant polls `get_request_status` to retrieve the completed signature, then passes it to the requesting service.
</Step>
</Steps>

## Related guides

<CardGroup cols={2}>
<Card title="Execute contract calls" icon="code" href="/ai-agents/guides/batch-calls">
Batch multiple contract interactions into one approval.
</Card>
<Card title="Morpho plugin" icon="puzzle-piece" href="/ai-agents/plugins/morpho">
Example of signing-in-the-flow with a DeFi protocol.
</Card>
</CardGroup>
Loading
Loading