---
updatedAt: 2026-11-03T05:00:14.000Z
agentTools:
  projectIndex: https://docs.opensea.io/llms.txt
---

# Build with AI agents

Integrate OpenSea data and trading into AI agent workflows using MCP, Agent Skills, the CLI, and the SDK.

OpenSea supports AI agents. Whether you're building with OpenClaw, Hermes Agent, Claude Code, Cursor, GitHub Copilot, Pi, or a custom agent framework like LangChain or CrewAI, there are three integration paths. Choose the one that fits your workflow.

## Instant API key

Before you start, get an API key. The instant endpoint requires no signup:

```bash
curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key'
```

This returns a free-tier key (600/h read, 30/h write, 7-day expiry) you can use immediately. For higher rate limits, create a full key at <Anchor label="Settings -> Developer" target="_blank" href="https://opensea.io/settings/developer">Settings -> Developer</Anchor>.

## Path A: MCP server

The <Anchor label="OpenSea MCP Server" target="_blank" href="https://docs.opensea.io/reference/mcp">OpenSea MCP Server</Anchor> (`mcp.opensea.io`) exposes 40 tools through the <Anchor label="Model Context Protocol" target="_blank" href="https://modelcontextprotocol.io">Model Context Protocol</Anchor>, an open standard for connecting AI tools to external data. Use it with any MCP-compatible application including Claude Desktop, Cursor, VS Code (GitHub Copilot), Windsurf, OpenClaw, and Hermes Agent.

Available tools include search, fetch, collection stats, token prices, swap quotes, wallet balances, activity history, trending data, drop details, minting, SeaDrop contract deployment, and Tool Registry discovery (ERC-8257).

### Claude

Add OpenSea as a custom connector in Claude's web or desktop app: open **Customize** > **Connectors**, click **+ Add** > **Add custom connector**, set the URL to `https://mcp.opensea.io/mcp`, and add `X-API-KEY` with your API key under **Request headers**. Claude Desktop's local `claude_desktop_config.json` is for local servers, not this remote one. See [Client setup](https://docs.opensea.io/reference/mcp#claude) for the full steps.

### Cursor

Add to `.cursor/mcp.json` (project-level) or `~/.cursor/mcp.json` (global):

```json
{
  "mcpServers": {
    "OpenSea": {
      "url": "https://mcp.opensea.io/mcp",
      "headers": {
        "X-API-KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

### VS Code (GitHub Copilot)

Run **MCP: Open User Configuration** from the Command Palette to edit your user `mcp.json`, or create `.vscode/mcp.json` in your workspace, and add:

```json
{
  "servers": {
    "OpenSea": {
      "type": "http",
      "url": "https://mcp.opensea.io/mcp",
      "headers": {
        "X-API-KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

### Custom applications

Use any MCP SDK to connect programmatically. This example uses the Vercel AI SDK's MCP client from the `@ai-sdk/mcp` package:

```typescript
import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";

const apiKey = process.env.OPENSEA_API_KEY;
if (!apiKey) throw new Error("OPENSEA_API_KEY is required");

const mcpClient = await createMCPClient({
  transport: {
    type: "http",
    url: "https://mcp.opensea.io/mcp",
    headers: { "X-API-KEY": apiKey },
  },
});

const tools = await mcpClient.tools();
```

If your agent calls paid tools, see [x402 micropayments](https://docs.opensea.io/docs/x402)
for the HTTP 402 challenge-response flow and Base USDC settlement details.

See the <Anchor label="Next.js + Vercel AI SDK starter" target="_blank" href="https://github.com/ProjectOpenSea/opensea-mcp-next-sample">opensea-mcp-next-sample</Anchor> for a complete working example.

## Path B: Agent Skill

The <Anchor label="OpenSea Agent Skill" target="_blank" href="https://github.com/ProjectOpenSea/opensea-skill">OpenSea Agent Skill</Anchor> is built for AI agents and coding assistants, including OpenClaw, Hermes Agent, Claude Code, Cursor, and Windsurf. It bundles pre-built workflows in `SKILL.md` and shell scripts that your agent can invoke directly.

### Install

```bash
npx skills add ProjectOpenSea/opensea-skill --yes
```

### Set API key

```bash
export OPENSEA_API_KEY=$(curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key')
```

Restart your AI tool after installation. Then prompt naturally:

* "Get the floor price for Pudgy Penguins on OpenSea"
* "Swap 0.02 ETH to USDC on Base using OpenSea"
* "Show me trending tokens on Ethereum"

The skill uses the <Anchor label="OpenSea CLI" target="_blank" href="https://github.com/ProjectOpenSea/opensea-cli">OpenSea CLI</Anchor>, shell scripts, and the MCP server as execution paths.

## Compatible agent platforms

OpenSea's MCP Server, Agent Skill, CLI, and SDK work with the major AI agent platforms and coding assistants. Any platform that supports MCP or shell tool-calling can integrate with OpenSea.

### Autonomous AI agents

| Platform                                                                                                               | Integration | Description                                                                                                                                                                                          |
| ---------------------------------------------------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <Anchor label="OpenClaw" target="_blank" href="https://github.com/openclaw/openclaw">OpenClaw</Anchor>                 | MCP, Skills | Open-source AI agent that autonomously executes multi-step tasks such as browsing, coding, file management, and Web3 interactions. Supports MCP servers and installable skills for crypto workflows. |
| <Anchor label="Hermes Agent" target="_blank" href="https://github.com/NousResearch/hermes-agent">Hermes Agent</Anchor> | MCP, Skills | Self-improving agent by Nous Research that learns across sessions. Built with Web3 DNA and supports delegated onchain transactions, token swaps, and DeFi operations.                                |
| <Anchor label="OpenAI Codex CLI" target="_blank" href="https://github.com/openai/codex">OpenAI Codex CLI</Anchor>      | MCP, CLI    | OpenAI's open-source coding agent with tool-calling and shell access. Connect it to the OpenSea MCP server or have it invoke CLI commands directly.                                                  |

### AI coding assistants

| Platform                                                                                                               | Integration      | Description                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <Anchor label="Claude Code" target="_blank" href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</Anchor> | MCP, Skills, CLI | Anthropic's agentic coding tool with native MCP support and skill installation.                                                                                                    |
| <Anchor label="Cursor" target="_blank" href="https://cursor.com">Cursor</Anchor>                                       | MCP, Skills      | AI code editor with built-in MCP server configuration and agent mode.                                                                                                              |
| <Anchor label="Windsurf" target="_blank" href="https://codeium.com/windsurf">Windsurf</Anchor>                         | MCP, Skills      | Codeium's AI IDE with agentic coding flows and MCP integration.                                                                                                                    |
| <Anchor label="GitHub Copilot" target="_blank" href="https://github.com/features/copilot">GitHub Copilot</Anchor>      | MCP              | VS Code agent mode with MCP server support for extending capabilities to external tools.                                                                                           |
| <Anchor label="Pi" target="_blank" href="https://pi.dev">Pi</Anchor>                                                   | Skills, CLI      | Minimal, open-source terminal coding agent. Loads AGENTS.md and on-demand skills, and shells out to the OpenSea CLI. No native MCP, but MCP support can be added via an extension. |

### Agent frameworks

| Platform                                                                                                  | Integration | Description                                                                                                             |
| --------------------------------------------------------------------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------- |
| <Anchor label="LangChain" target="_blank" href="https://www.langchain.com">LangChain / LangGraph</Anchor> | SDK, CLI    | A framework for building AI agents with tool-calling and multi-step reasoning. Use the OpenSea SDK or CLI as tools.     |
| <Anchor label="CrewAI" target="_blank" href="https://www.crewai.com">CrewAI</Anchor>                      | SDK, CLI    | Multi-agent orchestration framework where specialized agents collaborate on tasks with built-in tool integration.       |
| <Anchor label="Vercel AI SDK" target="_blank" href="https://sdk.vercel.ai">Vercel AI SDK</Anchor>         | MCP, SDK    | TypeScript toolkit for building AI applications with structured tool-calling, streaming, and native MCP client support. |

## Token-optimized responses (TOON)

The OpenSea REST API supports TOON (Token-Optimized Object Notation), a compact, lossless text format that uses \~40% fewer tokens than JSON. Any client can opt in by sending an `Accept: text/markdown` header:

```bash
curl "https://api.opensea.io/api/v2/collections/boredapeyachtclub" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: text/markdown"
```

TOON is automatically used by the MCP server and the CLI (with `--format toon`). If you're building a custom agent that calls the REST API directly, add the header to reduce token usage in your context window.

## Path C: CLI and SDK

For fully custom agents, use the CLI or SDK directly.

### CLI with TOON format

The <Anchor label="OpenSea CLI" target="_blank" href="https://github.com/ProjectOpenSea/opensea-cli">OpenSea CLI</Anchor> (`@opensea/cli`) supports a TOON output format that uses \~40% fewer tokens than JSON, which helps AI agents operating under context limits. When `--format toon` is specified, the CLI requests server-side TOON encoding via the `Accept: text/markdown` header.

```bash
npm install -g @opensea/cli
export OPENSEA_API_KEY=your-api-key

# Default JSON output
opensea collections get boredapeyachtclub

# TOON format (optimized for AI)
opensea --format toon collections get boredapeyachtclub

# Table format (human-readable)
opensea --format table collections stats mfers
```

Your agent can shell out to these commands and parse the results.

### SDK

Use `@opensea/sdk` directly in a TypeScript agent for full control:

> This guide uses viem. The SDK also supports ethers.js (v6+); see [Buy and sell NFTs](https://docs.opensea.io/docs/buy-and-sell-nfts) for the ethers setup. All SDK methods work the same with either library.

```typescript
import { createPublicClient, createWalletClient, http } from "viem";
import { mainnet } from "viem/chains";
import { OpenSeaSDK, Chain } from "@opensea/sdk/viem";

const publicClient = createPublicClient({ chain: mainnet, transport: http("https://your-rpc-url") });
const walletClient = createWalletClient({ chain: mainnet, transport: http("https://your-rpc-url"), account: "0x..." });

const sdk = new OpenSeaSDK(
  { publicClient, walletClient },
  { chain: Chain.Mainnet, apiKey: "YOUR_API_KEY" },
);

// Your agent can call any SDK method
const stats = await sdk.api.collections.getCollectionStats("boredapeyachtclub");
const trending = await sdk.api.tokens.getTrendingTokens();
```

> **Security Warning:** Do not use the SDK in client-side code, since your API key would be exposed. Use it on a backend server and return transaction data to your frontend.

## Machine-readable discovery

OpenSea provides discovery files for AI agents:

* **`llms.txt`**: <Anchor label="https://opensea.io/llms.txt" target="_blank" href="https://opensea.io/llms.txt"><https://opensea.io/llms.txt></Anchor>, a human- and AI-readable overview of OpenSea's capabilities
* **OpenAPI spec**: <Anchor label="https://api.opensea.io/api/v2/openapi.json" target="_blank" href="https://api.opensea.io/api/v2/openapi.json"><https://api.opensea.io/api/v2/openapi.json></Anchor>, the full API specification for code generation and tool building

## Example: floor price alert agent

Build an agent that monitors a collection floor price and alerts when it drops below a threshold:

```typescript
import { createPublicClient, createWalletClient, http } from "viem";
import { mainnet } from "viem/chains";
import { OpenSeaSDK, Chain } from "@opensea/sdk/viem";

const publicClient = createPublicClient({ chain: mainnet, transport: http("https://your-rpc-url") });
const walletClient = createWalletClient({ chain: mainnet, transport: http("https://your-rpc-url"), account: "0x..." });

const sdk = new OpenSeaSDK(
  { publicClient, walletClient },
  { chain: Chain.Mainnet, apiKey: "YOUR_API_KEY" },
);

const COLLECTION = "pudgypenguins";
const THRESHOLD_ETH = 5;
const CHECK_INTERVAL_MS = 60_000; // 1 minute

async function checkFloor() {
  const stats = await sdk.api.collections.getCollectionStats(COLLECTION);
  const floor = stats.total.floorPrice;

  console.log(`${COLLECTION} floor: ${floor} ETH`);

  if (floor < THRESHOLD_ETH) {
    console.log(`ALERT: Floor (${floor} ETH) is below ${THRESHOLD_ETH} ETH!`);
    // Send notification (Slack, email, etc.)
  }
}

// Poll on an interval
setInterval(checkFloor, CHECK_INTERVAL_MS);
checkFloor();
```

For real-time alerts instead of polling, combine this with [Stream real-time events](https://docs.opensea.io/docs/stream-real-time-events) using `@opensea/sdk/stream`.

## ERC-8004 AgentMetadata

<Anchor label="ERC-8004" target="_blank" href="https://eips.ethereum.org/EIPS/eip-8004">ERC-8004</Anchor> defines a standard for onchain agent metadata, allowing AI agents to declare their capabilities, endpoints, and interaction patterns as NFT traits. OpenSea supports browsing and discovering AI agent NFTs with these capability-based traits on Base.

Developers can mint agent NFTs that encode:

* **Capabilities**: what the agent can do (for example, trade, analyze, search)
* **Endpoints**: how to interact with the agent (API URLs, MCP servers)
* **Interaction patterns**: supported protocols and input/output formats

Browse AI agent collections on <Anchor label="OpenSea" target="_blank" href="https://opensea.io">opensea.io</Anchor>.

## Next steps

* <Anchor label="MCP Server reference" target="_blank" href="https://docs.opensea.io/reference/mcp">MCP Server reference</Anchor>
* <Anchor label="Agent Skill on GitHub" target="_blank" href="https://github.com/ProjectOpenSea/opensea-skill">Agent Skill on GitHub</Anchor>
* <Anchor label="OpenSea CLI on GitHub" target="_blank" href="https://github.com/ProjectOpenSea/opensea-cli">OpenSea CLI on GitHub</Anchor>
* <Anchor label="OpenSea SDK on GitHub" target="_blank" href="https://github.com/ProjectOpenSea/opensea-sdk">OpenSea SDK on GitHub</Anchor>
* [Agent accounts](https://docs.opensea.io/docs/agent-accounts): declare an account an agent and record who owns it
* [Agent tool registry (ERC-8257)](https://docs.opensea.io/docs/agent-tool-registry): build, register, and gate AI agent tools onchain
* [Search and discovery](https://docs.opensea.io/docs/search-and-discovery): find collections, tokens, and NFTs
* [Swap tokens](https://docs.opensea.io/docs/swap-tokens): execute token swaps programmatically