Build with AI Agents
Integrate OpenSea data and trading into AI agent workflows using MCP, Agent Skills, the CLI, and the SDK.
OpenSea provides first-class support for AI agents. Whether you're building with OpenClaw, Hermes Agent, Claude Code, Cursor, GitHub Copilot, 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:
curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key'This returns a free-tier key (60/min read, 5/min write, 30-day expiry) you can use immediately. For higher rate limits, create a full key at Settings -> Developer.
Path A: MCP Server
The OpenSea MCP Server (mcp.opensea.io) exposes 22+ tools through the Model Context Protocol — 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, and SeaDrop contract deployment.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"OpenSea": {
"url": "https://mcp.opensea.io/mcp",
"headers": {
"X-API-KEY": "YOUR_API_KEY"
}
}
}
}Cursor
Add to .cursor/mcp.json (project-level) or ~/.cursor/mcp.json (global):
{
"mcpServers": {
"OpenSea": {
"url": "https://mcp.opensea.io/mcp",
"headers": {
"X-API-KEY": "YOUR_API_KEY"
}
}
}
}VS Code (GitHub Copilot)
Add to your settings.json:
{
"mcp": {
"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:
import { experimental_createMCPClient as createMCPClient } from "ai";
const mcpClient = await createMCPClient({
transport: {
type: "http",
url: "https://mcp.opensea.io/mcp",
headers: { "X-API-KEY": process.env.OPENSEA_API_KEY },
},
});
const tools = await mcpClient.tools();See the opensea-mcp-next-sample for a complete working example.
Path B: Agent Skill
The OpenSea Agent Skill is purpose-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
npx skills add ProjectOpenSea/opensea-skillSet API Key
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 OpenSea CLI, shell scripts, and the MCP server as execution paths.
Compatible Agent Platforms
OpenSea's MCP Server, Agent Skill, CLI, and SDK work with the leading 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 |
|---|---|---|
| OpenClaw | MCP, Skills | Open-source AI agent that autonomously executes multi-step tasks — browsing, coding, file management, and Web3 interactions. Supports MCP servers and installable skills for crypto workflows. |
| Hermes Agent | 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. |
| OpenAI Codex CLI | 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 |
|---|---|---|
| Claude Code | MCP, Skills, CLI | Anthropic's agentic coding tool with native MCP support and skill installation. |
| Cursor | MCP, Skills | AI code editor with built-in MCP server configuration and agent mode. |
| Windsurf | MCP, Skills | Codeium's AI IDE with agentic coding flows and MCP integration. |
| GitHub Copilot | MCP | VS Code agent mode with MCP server support for extending capabilities to external tools. |
Agent Frameworks
| Platform | Integration | Description |
|---|---|---|
| LangChain / LangGraph | SDK, CLI | The most widely adopted framework for building AI agents with tool-calling and multi-step reasoning. Use the OpenSea SDK or CLI as tools. |
| CrewAI | SDK, CLI | Multi-agent orchestration framework where specialized agents collaborate on tasks with built-in tool integration. |
| Vercel AI SDK | MCP, SDK | TypeScript toolkit for building AI applications with structured tool-calling, streaming, and native MCP client support. |
Path C: CLI + SDK
For fully custom agents, use the CLI or SDK directly.
CLI with TOON Format
The OpenSea CLI (@opensea/cli) supports a TOON output format that uses ~40% fewer tokens than JSON — ideal for AI agents operating under context limits.
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 mfersYour agent can shell out to these commands and parse the results.
SDK
Use @opensea/sdk directly in a TypeScript agent for maximum control:
import { ethers } from "ethers";
import { OpenSeaSDK, Chain } from "@opensea/sdk";
const provider = new ethers.JsonRpcProvider("https://your-rpc-url");
const sdk = new OpenSeaSDK(provider, {
chain: Chain.Mainnet,
apiKey: "YOUR_API_KEY",
});
// Your agent can call any SDK method
const stats = await sdk.api.getCollectionStats("boredapeyachtclub");
const trending = await sdk.api.getTrendingTokens();Security Warning: Do not use the SDK in client-side code — 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— https://opensea.io/llms.txt — a human- and AI-readable overview of OpenSea's capabilities- OpenAPI spec — https://api.opensea.io/api/v2/openapi.json — the full API specification for code generation and tool building
Example: Floor Price Alert Agent
Build a simple agent that monitors a collection floor price and alerts when it drops below a threshold:
import { ethers } from "ethers";
import { OpenSeaSDK, Chain } from "@opensea/sdk";
const provider = new ethers.JsonRpcProvider("https://your-rpc-url");
const sdk = new OpenSeaSDK(provider, {
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.getCollectionStats(COLLECTION);
const floor = stats.total.floor_price;
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 using @opensea/stream-js.
ERC-8004 AgentMetadata
ERC-8004 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 (e.g., 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 opensea.io.
Next Steps
- MCP Server reference
- Agent Skill on GitHub
- OpenSea CLI on GitHub
- OpenSea SDK on GitHub
- Search and Discovery — find collections, tokens, and NFTs
- Swap Tokens — execute token swaps programmatically
Updated 1 day ago
