# n8n MCP Client

## Use Crypto APIs MCP in n8n Workflows

Connect any Crypto APIs MCP server to n8n's **AI Agent** node via the built-in **MCP Client Tool**. This lets the AI agent autonomously call blockchain tools — fetching balances, estimating fees, looking up transactions, and more — as part of your automated workflows.

### How It Works

MCP (Model Context Protocol) is an open standard that lets AI agents discover and call tools dynamically. Each Crypto APIs MCP server exposes a set of blockchain tools over HTTP. n8n's MCP Client connects to these servers so the AI Agent can use them on demand.

### Setup

**1. Start the MCP server in HTTP mode:**

```bash
npx @cryptoapis-io/mcp-market-data --transport http --api-key YOUR_API_KEY --port 3000
```

**2. Wire it into your n8n workflow:**

- Add an **AI Agent** node
- Under the agent's **Tools** section, click **+ Tool** and select **MCP Client**
- Set the **SSE URL** to `http://localhost:3000/mcp`

The AI Agent will automatically discover all available tools and call them as needed.

### Using Multiple MCP Servers

Each server defaults to port 3000. Assign different ports when running several at once:

```bash
npx @cryptoapis-io/mcp-market-data --transport http --api-key YOUR_API_KEY --port 3000
npx @cryptoapis-io/mcp-blockchain-fees --transport http --api-key YOUR_API_KEY --port 3001
npx @cryptoapis-io/mcp-transactions-data --transport http --api-key YOUR_API_KEY --port 3002
```

Add a separate **MCP Client Tool** in n8n for each server, pointing to its respective port.

### Remote MCP Server — No Self-Hosting Required

Crypto APIs provides an official remote MCP endpoint that aggregates all tools behind a single URL:

```
https://ai.cryptoapis.io/mcp
```

Set this as the MCP Client URL in n8n and pass your API key via the `x-api-key` header. No local servers to run or manage.

You can also connect to a **single product** by appending the product name. This gives the AI agent only the tools it needs — faster discovery and less noise in the context:

```
https://ai.cryptoapis.io/mcp/market-data
https://ai.cryptoapis.io/mcp/address-latest
https://ai.cryptoapis.io/mcp/blockchain-fees
```

Available products: `address-latest`, `address-history`, `block-data`, `transactions-data`, `blockchain-fees`, `simulate`, `prepare-transactions`, `broadcast`, `market-data`, `contracts`, `hd-wallet`, `blockchain-events`, `utils`.

For most n8n workflows a scoped endpoint is the better choice — for example, a fee alert workflow only needs `/mcp/blockchain-fees`, and a portfolio tracker only needs `/mcp/market-data` and `/mcp/address-latest` (one MCP Client Tool per product).

### Example Workflow Ideas

- **Portfolio tracker** — Use *Market Data* + *Address Latest* to fetch token balances and live prices on a schedule, then send a summary via email or Slack.
- **Transaction monitor** — Use *Blockchain Events* to set up a webhook for incoming transactions, trigger an n8n workflow on each event, and log details to a Google Sheet.
- **Fee alerts** — Use *Blockchain Fees* on a cron to check gas prices and notify you when fees drop below a threshold.
- **Automated transfers** — Chain *Prepare Transactions* → *Signer* (local) → *Broadcast* to build, sign, and send transactions end-to-end.

### Notes

- The **Signer** package is stdio-only (local signing) and does **not** support HTTP — use it as a standalone CLI step.
- For production, run MCP servers as persistent processes (pm2, systemd, Docker) rather than `npx`.
- Get your API key at [cryptoapis.io](https://cryptoapis.io).

---

Documentation page: https://developers.cryptoapis.io/v-2.2024-12-12-175/RESTapis/ai-compatibility/n8n-mcp-client
