Skip to main content
This guide shows how to build an agent that uses ACN autonomously — it discovers services, pays for them, and processes results on its own. No registration or API key required to get started.

Two Paths to Agent Integration

MCP (Recommended)

Use ACN’s MCP server for native tool integration with Claude and other MCP-compatible agents. The agent sees ACN services as tools it can call directly.

REST API

Wrap ACN’s REST API as a tool in any agent framework. Works with LangChain, CrewAI, AutoGen, Vercel AI SDK, or custom agents.

Option A: Using the MCP Server

The fastest path for MCP-compatible agents. Your agent gets ACN discovery and execution as native tools — with zero configuration overhead.

1. Scaffold with the CLI

npx acn-agent create my-agent
The interactive wizard will:
  • Ask you to choose a framework (Claude or LangChain)
  • Configure your LLM API key and wallet
  • Set up the ACN and wallet MCP server connections
  • Generate a ready-to-run project

2. Configure MCP

Add ACN’s MCP server to your agent’s configuration. Authentication is optional — start with zero-friction and add identity when you need it:
{
  "mcpServers": {
    "acn": {
      "type": "url",
      "url": "https://mcp.acn.exchange/mcp"
    },
    "acn-wallet": {
      "type": "stdio",
      "command": "npx",
      "args": ["acn-agent", "wallet-server"],
      "env": {
        "WALLET_PRIVATE_KEY": "0xYourPrivateKey",
        "CHAIN_ID": "8453"
      }
    }
  }
}
Never commit your private key or API key to version control. Use environment variables or a secrets manager.

3. Run Your Agent

npx acn-agent run "Find the current price of ETH and send it to user@example.com"
The agent will:
  1. Call acn_discover to find a price data provider
  2. Call acn_discover to find an email provider
  3. Execute the price lookup (paying per-call)
  4. Execute the email send (paying per-call)
  5. Return the results with a cost summary

Option B: Using the REST API

Wrap ACN as a tool in any agent framework:
import { tool } from "your-agent-framework";

const discoverTool = tool({
  name: "acn_discover",
  description: "Search ACN marketplace for services",
  parameters: {
    query: { type: "string", description: "What capability do you need?" }
  },
  execute: async ({ query }) => {
    const res = await fetch("https://api.acn.exchange/v1/discover", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ query })
    });
    return res.json();
  }
});

const executeTool = tool({
  name: "acn_execute",
  description: "Execute a service discovered on ACN",
  parameters: {
    capability: { type: "string", description: "Capability identifier" },
    params: { type: "object", description: "Input parameters" }
  },
  execute: async ({ capability, params }) => {
    const res = await fetch("https://api.acn.exchange/v1/execute", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ capability, params })
    });
    return res.json();
  }
});
See the Agent Frameworks section for complete integration guides for each framework.

Equipping Your Agent with a Wallet

For agents to pay autonomously, they need a wallet. The simplest approach:
# Generate a new wallet (or use an existing private key)
# Fund it with USDC on Base
# Pass the private key as an environment variable
The wallet serves dual purposes:
  • Identity — Your agent’s on-chain identity (even without upfront auth, the wallet from your first payment becomes your identity)
  • Payments — Signs USDC transactions to pay for services
See Equip an Agent with a Wallet for the full guide.

What’s Next?

Build Your First Agent

Complete end-to-end tutorial

MCP Server Docs

Full MCP server reference

Agent Frameworks

Framework-specific integration guides

CLI Reference

All CLI commands and options