Blockchain RPC and docs MCP for Agent frameworks
Configure blockchain RPC for LangChain, ElizaOS, viem, wagmi, and Coinbase AgentKit, with a page and runnable code for each, and discover capabilities via docs MCP. Includes AgentOS RPC_ROBINHOOD_URL setup on Robinhood Chain using an API-key URL.
Configure blockchain RPC in LangChain, ElizaOS, viem, wagmi or Coinbase AgentKit using the recipes below; LangChain, ElizaOS and Coinbase AgentKit each have their own page with runnable code. Developers and AI Agents can first use docs MCP to discover methods and documentation, then follow the separate HTTP sign-up flow to create an API key. Use that key in RPC and Data API requests or in the MCP client's x-api-key header for keyed tools; keyless RPC access is limited to each chain's public.methods.
Read documentation with an SDK
For a first documentation lookup without a model, wallet or BlockVectra API key, use the standalone examples from this fixed checkout:
git clone https://github.com/blockvectra/agent-quickstart.git
cd agent-quickstart
git checkout --detach c4c0d5c81c5518add7f0f204a77f42934d183588Python / OpenAI Agents SDK
With Python 3.12+ and uv, run from the checkout root:
uv run examples/openai_agents_docs.pyThe example pins openai-agents==0.24.0 and mcp==2.3.0. It calls the SDK-managed MCP server directly without running an Agent or Runner; tracing is disabled.
Node.js / mcp-use
With Node.js 22.22.2+, run from the checkout root:
cd examples/mcp-use-docs
npm ci --ignore-scripts
npm startThe standalone example pins @mcp-use/client to 2.4.5, includes a dependency lockfile, and disables SDK anonymous telemetry before loading the client.
Both examples connect to https://docs.blockvectra.com/mcp/docs, list its two documentation tools, search for quickstart in English and print the returned page. Tool errors or empty results stop the example. Reading the page does not execute its RPC or account instructions. Dependency installation needs network access before the examples start.
LangChain
- Full guide: Use blockchain RPC in LangChain agents
- Official documentation: LangChain MCP and tools
A LangChain agent reaches BlockVectra through one @tool function that POSTs JSON-RPC to https://api.blockvectra.com/v1/eth_mainnet/public, or through MCPAdapter pointed at https://docs.blockvectra.com/mcp. The guide has the Python and TypeScript code, the keyed variant and the error table.
ElizaOS
- Full guide: Use blockchain RPC in ElizaOS agents
- Official documentation: elizaOS Documentation
- Official repository: elizaos/eliza
ElizaOS reaches EVM chains through @elizaos/plugin-evm. Set EVM_PROVIDER_URL for Ethereum mainnet and ETHEREUM_PROVIDER_<CHAIN_NAME> for other chains in .env, and add @elizaos/plugin-mcp to use the docs MCP server. The guide has the full .env, character and MCP configuration.
AgentOS
For RPC on Robinhood Chain, set RPC_ROBINHOOD_URL in AgentOS. Use BlockVectra's path-key RPC route without changing AgentOS or adding a proxy. Supply BLOCKVECTRA_API_KEY privately in the AgentOS process environment, then set:
# robinhood_mainnet: expected chain ID 4663; remove conflicting "4663"/"robinhood" URL overrides.
export RPC_ROBINHOOD_URL="https://api.blockvectra.com/v1/robinhood_mainnet/${BLOCKVECTRA_API_KEY:?Set BLOCKVECTRA_API_KEY privately first}"Start AgentOS from that environment using your usual command. An existing chain-ID or alias entry in [trading.rpc_urls] takes priority: remove that override, or update it privately to the same path-key URL. The variable expands in the shell; TOML does not perform this shell expansion. See the AgentOS URL resolver.
Treat the full URL as a secret: keep it out of version control, shared logs, screenshots and browser code, and do not use shell tracing (set -x) while setting it. AgentOS's LP path can use a separate public log fallback; selecting this URL does not mean all external calls use BlockVectra or verify a trading/LP workflow. The quickstart example records the offline checks and their scope.
viem
- Official documentation: viem Documentation
- Transports reference: viem HTTP Transport and viem WebSocket Transport
- Official repository: wevm/viem
In viem, configure client transports using http() or webSocket().
HTTP transport with API key
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
export const client = createPublicClient({
chain: mainnet,
transport: http(`https://api.blockvectra.com/v1/eth_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
});HTTP transport with keyless public endpoint
For read requests on permitted public methods without an API key:
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
export const publicClient = createPublicClient({
chain: mainnet,
transport: http("https://api.blockvectra.com/v1/eth_mainnet/public"),
});WebSocket transport
WebSocket transport (webSocket(...)) is supported on chains with ws: true in GET /v1/chains, such as on Robinhood Chain (robinhood_mainnet):
import { createPublicClient, webSocket } from "viem";
export const wsClient = createPublicClient({
transport: webSocket(`wss://api.blockvectra.com/v1/robinhood_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
});For connection parameters and subscription types, see the WebSocket subscriptions guide.
wagmi
- Official documentation: wagmi createConfig and wagmi HTTP Transport
- Official repository: wevm/wagmi
In wagmi, pass the BlockVectra RPC URL to the transports map inside createConfig.
Configuration with API key
import { createConfig, http } from "wagmi";
import { mainnet } from "wagmi/chains";
export const config = createConfig({
chains: [mainnet],
transports: {
[mainnet.id]: http(`https://api.blockvectra.com/v1/eth_mainnet/${process.env.BLOCKVECTRA_API_KEY}`),
},
});Configuration with keyless public endpoint
import { createConfig, http } from "wagmi";
import { mainnet } from "wagmi/chains";
export const config = createConfig({
chains: [mainnet],
transports: {
[mainnet.id]: http("https://api.blockvectra.com/v1/eth_mainnet/public"),
},
});Coinbase AgentKit
- Full guide: Use blockchain RPC in Coinbase AgentKit agents
- Official documentation: Coinbase AgentKit Documentation
- Official repository: coinbase/agentkit
Coinbase AgentKit sends onchain actions through a wallet provider, and ViemWalletProvider wraps a viem WalletClient whose transport can be a BlockVectra endpoint.
Configuration with ViemWalletProvider
import { AgentKit, ViemWalletProvider } from "@coinbase/agentkit";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
const client = createWalletClient({
account: privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`),
chain: base,
transport: http("https://api.blockvectra.com/v1/base_mainnet/public"),
});
export const agentKit = await AgentKit.from({ walletProvider: new ViemWalletProvider(client) });For methods outside the chain's public.methods, pass the keyed URL https://api.blockvectra.com/v1/base_mainnet/${process.env.BLOCKVECTRA_API_KEY} to http() as a template string. The guide covers LangChain tool wiring, MCP and errors.
Remote MCP
If your agent connects via the Model Context Protocol (Streamable HTTP MCP), connect to the BlockVectra MCP server endpoint:
https://docs.blockvectra.com/mcp
For client configuration instructions across Claude Code, Cursor, VS Code, Codex, Gemini CLI, OpenAI Responses API, and Windsurf, see Install in your client on the BlockVectra MCP server page.
Next steps
- Connect an AI agent to discover endpoints with MCP, llms.txt, and OpenAPI.
- Follow the programmatic sign-up guide to sign up and create an API key with a wallet signature, or log in to the console to create a key.
- Billing rules to review Compute Unit (CU) metering, rate limits, and non-billed errors.
Last updated:
MCP server
The BlockVectra Model Context Protocol (MCP) server gives developers and AI agents keyless blockchain RPC, chain status, pricing and docs tools, with one-line install for Claude Code, Cursor, VS Code, Codex, Gemini CLI, Antigravity and more.
LangChain
Build a LangChain tool to read Ethereum blockchain data over BlockVectra's keyless public RPC endpoint, then add the docs MCP server and an API key.