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
31 changes: 13 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

<!-- Badge row 1 - status -->

[![GitHub contributors](https://img.shields.io/github/contributors/base/base-skills)](https://github.com/base/base-skills/graphs/contributors)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/base/base-skills)](https://github.com/base/base-skills/graphs/contributors)
![GitHub repo size](https://img.shields.io/github/repo-size/base/base-skills)
[![GitHub contributors](https://img.shields.io/github/contributors/base/skills)](https://github.com/base/skills/graphs/contributors)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/base/skills)](https://github.com/base/skills/graphs/contributors)
![GitHub repo size](https://img.shields.io/github/repo-size/base/skills)

<!-- Badge row 2 - links and profiles -->

Expand All @@ -20,29 +20,24 @@

<!-- Badge row 3 - detailed status -->

[![GitHub pull requests by-label](https://img.shields.io/github/issues-pr-raw/base/base-skills)](https://github.com/base/base-skills/pulls)
[![GitHub Issues](https://img.shields.io/github/issues-raw/base/base-skills.svg)](https://github.com/base/base-skills/issues)
[![GitHub pull requests by-label](https://img.shields.io/github/issues-pr-raw/base/skills)](https://github.com/base/skills/pulls)
[![GitHub Issues](https://img.shields.io/github/issues-raw/base/skills.svg)](https://github.com/base/skills/issues)

## Available Skills
## Recommended Skills

| Skill | Description |
| ----- | ----------- |
| [Adding Builder Codes](./skills/adding-builder-codes/SKILL.md) | Appends Base builder codes to transactions across Privy, Wagmi, Viem, and standard Ethereum RPC implementations. Automatically detects the user's framework before applying the correct integration pattern. |
| [Building with Base Account](./skills/building-with-base-account/SKILL.md) | Integrates Base Account SDK for authentication and payments, including SIWB, Base Pay, Paymasters, Sub Accounts, and Spend Permissions. |
| [Connecting to Base Network](./skills/connecting-to-base-network/SKILL.md) | Provides Base Mainnet and Sepolia network configuration, RPC endpoints, chain IDs, and explorer URLs. |
| [Converting Farcaster Miniapp to App](./skills/convert-farcaster-miniapp-to-app/SKILL.md) | Converts Farcaster Mini App SDK projects into regular Base web apps, with an option to preserve a small separate Farcaster-specific surface when needed. |
| [Deploying Contracts on Base](./skills/deploying-contracts-on-base/SKILL.md) | Deploys and verifies contracts on Base with Foundry, plus common troubleshooting guidance. |
| [Running a Base Node](./skills/running-a-base-node/SKILL.md) | Covers production node setup, hardware requirements, networking ports, and syncing guidance. |
| [Converting MiniKit to Farcaster](./skills/converting-minikit-to-farcaster/SKILL.md) | Migrates Mini Apps from MiniKit (OnchainKit) to native Farcaster SDK with mappings, examples, and pitfalls. |
| [Migrating an OnchainKit App](./skills/migrating-an-onchainkit-app/SKILL.md) | Migrates apps from @coinbase/onchainkit to standalone wagmi/viem components, replacing the provider, wallet, and transaction components. |
| [Registering an Agent on Base](./skills/registering-agent-base-dev/SKILL.md) | Registers an agent wallet with the Base builder code API and wires ERC-8021 transaction attribution into viem, ethers, or managed signing services. |
Two consolidated skills that cover the most common use cases. Each uses progressive reference loading — the skill loads a single entry point and pulls in detailed references only when needed.

| Skill | Install | Description |
| ----- | ------- | ----------- |
| [build-on-base](./skills/build-on-base/SKILL.md) | `npx skills add base/skills --skill build-on-base` | Complete Base development playbook: network, contracts, wallet auth, payments, attribution, and migrations. Consolidates all individual skills into one. |
| [base-mcp](./skills/base-mcp/SKILL.md) | `npx skills add base/skills --skill base-mcp` | Base Account MCP server — gives your AI assistant a wallet via mcp.base.org. Tools for sending, swapping, signing, batching calls, and checking balances. Includes Morpho lending plugin. |

## Installation

Install with [Vercel's Skills CLI](https://skills.sh):

```bash
npx skills add base/base-skills
npx skills add base/skills
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "base-skills",
"name": "skills",
"private": true
}
83 changes: 83 additions & 0 deletions skills/base-mcp/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: base-mcp
description: >
Base MCP — gives your AI assistant access to your Base account via the Base MCP server (mcp.base.org).
Tools: get_wallets (list wallets), get_portfolio (balances, any address), send (ETH/ERC-20 transfers),
swap (token swaps via Coinbase), sign (EIP-712/personal_sign), send_calls (EIP-5792 batch),
get_transaction_history (paginated tx history), get_request_status (poll approval), search_tokens (token lookup),
web_request (fetch whitelisted partner APIs to get calldata, then pass to send_calls — hostname must be in server allowlist).
Approval mode: send/swap/sign/send_calls require user approval at keys.coinbase.com; response includes approvalUrl + requestId.
Plugins: Morpho lending protocol available via plugins/morpho.md. Moonwell lending on Base/Optimism via plugins/moonwell.md.
---

# Base MCP

The Base MCP server gives your AI assistant access to your Base account on Base.

## Step 1 — Check if the MCP is installed

Before anything else, attempt to call `get_wallets`. If the tool is not available or the call fails with a connection error, the MCP server is not installed. Go to **Step 2**. If it succeeds, skip to **Step 3**.

## Step 2 — Install the MCP server

Tell the user the MCP is not connected and point them to [references/install.md](references/install.md) for step-by-step UI instructions. That file covers Claude Desktop, ChatGPT app, Claude.ai web, Claude Code CLI, and Cursor — with beginner-friendly walkthroughs for each.

Quick reference:
- **Claude Desktop** — Claude menu → Settings → Integrations → Add integration → `https://mcp.base.org`
- **ChatGPT app** — Settings → Connectors → Add connector → MCP server → `https://mcp.base.org`
- **Claude.ai web** — Settings → Integrations → Add integration → `https://mcp.base.org`
- **Claude Code CLI** — `claude mcp add base-account --transport http https://mcp.base.org`

After connecting, the user signs in to authorize via Base account — no Coinbase account required. Once installed, re-run `get_wallets` to confirm the connection, then continue to Step 3.

## Step 3 — Get wallets

Call `get_wallets` immediately at the start of any session involving transactions. This returns:
- The user's Base account address
- Any agent wallets and their delegation status
- `inSession: true/false` — determines whether approval mode is required

**If `inSession: true`** on an agent wallet: transactions can execute without manual approval (M2 mode). Pass `agentWalletId` to send/swap.

**If no wallet is `inSession: true`**: all write tools use approval mode — every transaction goes to keys.coinbase.com for the user to approve.

Load [references/wallets.md](references/wallets.md) for full field reference.

## Tool Routing

Read this table first. For the current task, load ONLY the matching reference file — do not preload all references.

| Task | Tool | Reference |
|------|------|-----------|
| Install the MCP / platform-specific setup | — | [references/install.md](references/install.md) |
| List wallets / check session status | `get_wallets` | [references/wallets.md](references/wallets.md) |
| Check balance / portfolio / token lookup | `get_portfolio`, `search_tokens` | [references/portfolio.md](references/portfolio.md) |
| Send ETH or ERC-20 | `send` | [references/send.md](references/send.md) |
| Swap tokens | `swap` | [references/swap.md](references/swap.md) |
| Sign a message or typed data | `sign` | [references/sign.md](references/sign.md) |
| Batch contract calls | `send_calls` | [references/batch-calls.md](references/batch-calls.md) |
| View transaction history | `get_transaction_history` | [references/history.md](references/history.md) |
| Check pending approval status | `get_request_status` | [references/approval-mode.md](references/approval-mode.md) |
| Resolve token by symbol | `search_tokens` | [references/tokens.md](references/tokens.md) |
| Fetch protocol API calldata (Moonwell, etc.) | `web_request` | [references/web-request.md](references/web-request.md) |

## Approval Mode

All write tools (send, swap, sign, send_calls) return an `approvalUrl` and `requestId`. Direct the user to open the URL to approve, then call `get_request_status` to confirm completion. Never report success before `get_request_status` returns confirmed.

Load [references/approval-mode.md](references/approval-mode.md) for full details.

## Plugins

Additional protocol capabilities — no extra MCP server needed for Moonwell (uses `web_request`); Morpho requires its own MCP server.

| Plugin | Protocol | Reference |
|--------|---------|-----------|
| Morpho | Lending / vaults on Base | [plugins/morpho.md](plugins/morpho.md) |
| Moonwell | Lending / borrowing on Base and Optimism | [plugins/moonwell.md](plugins/moonwell.md) |

## Installation

```bash
npx skills add base/skills --skill base-mcp
```
155 changes: 155 additions & 0 deletions skills/base-mcp/plugins/moonwell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Moonwell Plugin

Moonwell is a Compound v2 lending protocol on Base and Optimism. Use `web_request` to call the Moonwell HTTP API to read positions/rates and prepare unsigned calldata, then execute via `send_calls`.

No additional MCP server required — everything goes through `web_request` + `send_calls`.

**Prerequisite:** `api.moonwell.fi` must be in the MCP server's `web_request` allowlist. If requests to that hostname are rejected, inform the user that the Moonwell API is not yet whitelisted on this MCP instance.

**Supported chains:** Base (8453), Optimism (10).

---

## Orchestration Pattern

```
web_request(https://api.moonwell.fi/v1/prepare/<verb>?...)
→ { data: { transactions: [ { to, data, value, chainId }, ... ] } }
send_calls(chainId, calls mapped from transactions[])
→ approvalUrl + requestId
User approves at keys.coinbase.com
get_request_status(requestId) → confirmed
```

Steps in `transactions[]` are ordered — `approve` and `enter-market` come before the protocol action. Execute them as a single `send_calls` batch.

---

## Read Endpoints (use web_request GET)

```
GET https://api.moonwell.fi/v1/markets?chain=base
GET https://api.moonwell.fi/v1/markets/USDC?chain=base
GET https://api.moonwell.fi/v1/rates?chain=base&asset=USDC
GET https://api.moonwell.fi/v1/yield?chain=base&sort=apy&min-tvl=1000000&limit=5
GET https://api.moonwell.fi/v1/positions/<address>?chain=base
GET https://api.moonwell.fi/v1/health/<address>?chain=base
GET https://api.moonwell.fi/v1/rewards/<address>?chain=base
GET https://api.moonwell.fi/v1/token-balance/<address>?chain=base&asset=USDC
```

Market reads are edge-cached 30 s. User-scoped reads (`positions`, `health`, `rewards`, `token-balance`) are never cached.

`/positions` returns an array — one entry per market. Use `?active=true` to filter out markets where both `suppliedUsd` and `borrowedUsd` are zero.

---

## Prepare Endpoints (use web_request → send_calls)

Verbs: `supply`, `withdraw`, `borrow`, `repay`.

**GET form** (query params):

```
GET https://api.moonwell.fi/v1/prepare/supply?chain=base&asset=USDC&amountDecimal=100&from=<address>
```

**POST form** (JSON body — pass as the `body` object parameter to `web_request`):

```json
{
"url": "https://api.moonwell.fi/v1/prepare/supply",
"method": "POST",
"headers": { "content-type": "application/json" },
"body": { "chain": "base", "asset": "USDC", "amountDecimal": "100", "from": "<address>" }
}
```

Both return identical response shapes. Use GET when simpler; use POST when the body is complex.

### Key parameters

| Field | Notes |
|-------|-------|
| `chain` | `base` (default), `optimism`, or chain ID |
| `asset` | Symbol: `USDC`, `WETH`, `ETH` (alias for WETH) |
| `amountDecimal` | Human-readable string, e.g. `"100"`. Use this **or** `amount` (base units), never both. |
| `from` | User's wallet address (from `get_wallets`) |

### Response → send_calls mapping

```json
{
"data": {
"transactions": [
{ "step": "approve", "to": "0x...", "data": "0x...", "value": "0x0", "chainId": 8453 },
{ "step": "enter-market", "to": "0x...", "data": "0x...", "value": "0x0", "chainId": 8453 },
{ "step": "moonwell-supply", "to": "0x...", "data": "0x...", "value": "0x0", "chainId": 8453 }
]
}
}
```

Pass all items as the `calls` array to `send_calls`, using `chainId` from any transaction item (`0x2105` for Base mainnet).

---

## Example Flows

### Supply 100 USDC on Base

```
1. get_wallets → address
2. web_request GET /token-balance/<address>?chain=base&asset=USDC → confirm balance ≥ 100
3. web_request GET /prepare/supply?chain=base&asset=USDC&amountDecimal=100&from=<address>
4. send_calls(chainId=0x2105, calls from transactions[])
5. User approves → get_request_status(requestId)
```

### Borrow USDC against collateral

```
1. get_wallets → address
2. web_request GET /health/<address>?chain=base → verify health > 1.5
3. web_request GET /prepare/borrow?chain=base&asset=USDC&amountDecimal=50&from=<address>
4. send_calls(chainId=0x2105, calls from transactions[])
5. User approves → get_request_status(requestId)
```

### Check positions and health

```
1. get_wallets → address
2. web_request GET /positions/<address>?chain=base&active=true → show per-market balances
3. web_request GET /health/<address>?chain=base → show health factor
```

---

## Protocol Notes

- **mTokens** — ERC-20 receipt tokens (mUSDC, mWETH…); exchange rate accrues over time
- **WETH special-case** — borrow/withdraw deliver native ETH; supply/repay require ERC-20 WETH. Both `asset=ETH` and `asset=WETH` resolve to the same mWETH market
- **Compound v2 error codes** — `mint`, `borrow`, `repay` return non-zero codes for business-logic failures without reverting. Check the on-chain receipt after broadcast
- **Base has two mUSDC entries** — the current market and a deprecated bridged-USDC market. Disambiguate by `marketAddress` or `deprecated: true`

### Health factor guide

| Value | Status |
|-------|--------|
| `> 1.5` | Healthy |
| `1.1 – 1.5` | Caution |
| `< 1.1` | Liquidation risk |
| `null` | No borrows |

---

## Chain IDs for send_calls

| Chain | chainId param |
|-------|--------------|
| Base mainnet | `0x2105` |
| Optimism | `0xa` |
89 changes: 89 additions & 0 deletions skills/base-mcp/plugins/morpho.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Morpho Plugin

Morpho is a lending protocol on Base. The Morpho MCP server prepares lending operations (deposit, borrow, withdraw, repay, supply collateral) which are then executed via Base MCP's `send_calls`.

## MCP Server

URL: `https://mcp.morpho.org/`

## Installation (alongside Base MCP)

Add both servers to your MCP config:

```json
{
"mcpServers": {
"base-account": { "url": "https://mcp.base.org" },
"morpho": { "url": "https://mcp.morpho.org/" }
}
}
```

Claude Code: `claude mcp add morpho --transport http https://mcp.morpho.org/`

## Morpho Tools (17 total)

### Read
- `morpho_health_check` — server connectivity
- `morpho_get_supported_chains` — supported chains
- `morpho_query_vaults` — list vaults with filtering/sorting
- `morpho_get_vault` — details for a specific vault
- `morpho_query_markets` — list markets with filtering
- `morpho_get_market` — details for a specific market
- `morpho_get_positions` — all positions for an address (all vaults + markets)
- `morpho_get_token_balance` — token balance and approval state

### Write (prepare_ returns unsigned calls for send_calls)
- `morpho_prepare_deposit` — prepare vault deposit with approvals
- `morpho_prepare_withdraw` — prepare vault withdrawal (supports max)
- `morpho_prepare_supply` — prepare market supply with approvals
- `morpho_prepare_borrow` — prepare market borrow with health check
- `morpho_prepare_repay` — prepare market repay (supports max)
- `morpho_prepare_supply_collateral` — supply collateral to market
- `morpho_prepare_withdraw_collateral` — withdraw collateral with health check

### Simulate
- `morpho_simulate_transactions` — simulate with post-state analysis

## Orchestration Pattern

Morpho `prepare_*` tools return unsigned call data. Pass the result to Base MCP's `send_calls` to execute.

```
morpho_prepare_deposit(vaultAddress, amount) → { calls: [...], chainId }
send_calls(chainId, calls) → approvalUrl + requestId
User approves at keys.coinbase.com
get_request_status(requestId) → confirmed
```

## Example Prompts

```
Find the best USDC vault on Base by APY and deposit 100 USDC
```
1. `morpho_query_vaults` (filter by USDC, sort by APY)
2. `morpho_prepare_deposit` (selected vault, 100 USDC)
3. `send_calls` (chainId + calls from prepare_deposit)
4. Direct user to approvalUrl, poll get_request_status

```
Show all my Morpho positions on Base
```
1. `get_wallets` (get user's address)
2. `morpho_get_positions` (user's address)

```
Check if my Morpho borrow position is healthy
```
1. `get_wallets` (get address)
2. `morpho_get_positions` (address)
3. Report health factor from position data

## Important Notes

- Morpho `prepare_*` tools simulate before returning — review simulation output before calling `send_calls`
- Always use `morpho_simulate_transactions` for novel or large operations
- Morpho operates on Base mainnet; check `morpho_get_supported_chains` for current list
Loading