Supported Hosts
web3agent works with any AI coding host that supports the Model Context Protocol (MCP) over stdio transport. The web3agent init command handles configuration automatically for the most common hosts.
Supported hosts at a glance
| Host | Auto-configure | Config file written |
|---|---|---|
| Claude Code | npx web3agent init | ~/.claude/claude_desktop_config.json |
| Cursor | npx web3agent init | .cursor/mcp.json (project) or ~/.cursor/mcp.json (global) |
| Windsurf | npx web3agent init | ~/.codeium/windsurf/mcp_config.json |
| OpenCode | npx web3agent init | .opencode/config.json |
| Codex | npx web3agent init --host codex | .codex/config.toml |
| OpenClaw | Agent-mediated self-install | openclaw.json (workspace) |
| Any MCP host | Manual config | See manual setup |
Claude Code
Claude Code discovers MCP servers from its config file. Run the init command and restart Claude Code.
npx web3agent init
web3agent writes an entry to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"web3agent": {
"command": "npx",
"args": ["web3agent"],
"env": {
"CHAIN_ID": "8453"
}
}
}
}
After restarting Claude Code, the web3agent tools appear in the tool list automatically.
Cursor
Cursor supports both project-level and global MCP configuration.
# Project-level (recommended — keeps config in your repo)
npx web3agent init
# Global (applies to all projects)
npx web3agent init --global
The project-level config goes to .cursor/mcp.json:
{
"mcpServers": {
"web3agent": {
"command": "npx",
"args": ["web3agent"]
}
}
}
Cursor picks up the config on the next window reload. No restart required.
Windsurf
npx web3agent init
Windsurf reads MCP config from ~/.codeium/windsurf/mcp_config.json. web3agent writes:
{
"mcpServers": {
"web3agent": {
"command": "npx",
"args": ["web3agent"]
}
}
}
Open Windsurf's MCP settings panel to verify the server appears and shows a green status indicator.
OpenCode
npx web3agent init
OpenCode reads from .opencode/config.json in the project root. The written config:
{
"mcp": {
"web3agent": {
"command": "npx",
"args": ["web3agent"],
"type": "local"
}
}
}
OpenCode picks up the config on the next session start.
Codex
Codex uses a TOML-based config format. Pass --host codex explicitly because Codex can't always be auto-detected.
npx web3agent init --host codex
web3agent writes to .codex/config.toml:
[[mcp_servers]]
name = "web3agent"
command = "npx"
args = ["web3agent"]
Restart Codex after the file is written.
OpenClaw
OpenClaw agents can install web3agent themselves through an agent-mediated self-install flow. The agent calls the web3agent MCP server's init capability, which writes the appropriate entry into the workspace openclaw.json.
For manual setup, add web3agent to the mcp_servers section of your openclaw.json:
{
"mcp_servers": {
"web3agent": {
"command": "npx",
"args": ["web3agent"],
"transport": "stdio"
}
}
}
Restart the OpenClaw service after editing the config.
Manual setup
For any MCP-compatible host not listed above, configure web3agent using the standard stdio transport format. The exact field names vary by host, but the pattern is the same: run npx web3agent as a subprocess and communicate over stdin/stdout.
Generic MCP stdio config:
{
"command": "npx",
"args": ["web3agent"],
"transport": "stdio",
"env": {
"CHAIN_ID": "8453",
"PRIVATE_KEY": "your-private-key-here"
}
}
With a pinned version (recommended for production):
{
"command": "npx",
"args": ["[email protected]"],
"transport": "stdio"
}
Most hosts support an env field in the MCP server config. This is the recommended way to pass PRIVATE_KEY, CHAIN_ID, and API keys. Alternatively, set them in a .env file in your project root and web3agent will load them automatically.
How web3agent init works
The init command does three things:
- Detects your host. It checks for host-specific config files and environment markers to identify which AI host is running.
- Writes the config. It adds a
web3agententry to the appropriate config file, creating the file if it doesn't exist. - Reports what it did. It prints the path of the file it wrote and the exact config it added.
If auto-detection fails or you want to target a specific host, pass --host:
npx web3agent init --host claude # Claude Code
npx web3agent init --host cursor # Cursor
npx web3agent init --host windsurf # Windsurf
npx web3agent init --host opencode # OpenCode
npx web3agent init --host codex # Codex
Verifying the connection
After configuring your host, verify that web3agent is reachable:
npx web3agent tool call server_status --input '{}' --json
A successful response looks like:
{
"ok": true,
"data": {
"version": "0.4.0",
"toolCount": 107,
"defaultChain": "base",
"walletConnected": false
}
}
If the tool count is 0 or the command errors, check that Node.js 22+ is on your PATH and that the config file was written to the correct location.