---
title: MCP Server Integration
description: Connect AI assistants to X402-enabled APIs using the Agnic MCP server
---

# 🔌 MCP Server Integration

A hosted MCP server that gives AI assistants (Claude, n8n, etc.) the power to automatically discover and access X402-enabled APIs using your Agnic Wallet.

---

## MCP Server Address

```
https://mcp.agnic.ai/sse
```

Use this URL when connecting to the Agnic MCP server from any MCP client.

---

## What is This MCP Server?

The Agnic MCP server is a hosted remote service that connects your AI tools to the X402 protocol. Think of it as a bridge between your AI assistant and X402-enabled APIs.

**X402** is a new HTTP status code (like 404 for "Not Found") that means "Payment Required". When an API responds with 402, our MCP server automatically:

1. **Detects** the authorization requirement and price
2. **Signs** the authorization using your Agnic Wallet
3. **Retries** the request with the authorization proof
4. **Returns** the API response to your AI

<Callout type="tip">
  No installation needed. No blockchain knowledge required. Just add the server URL and your API key.
</Callout>

---

## How to Connect (3 Steps)

### Step 1: Create Your Wallet & Get API Key

Sign up at [app.agnic.ai](https://app.agnic.ai), add USDC to your wallet, then generate an API token from your dashboard.

Your API token will look like:

```
agnic_tok_sk_live_abc123...
```

### Step 2: Add MCP Server to Your AI Client

In your MCP client (n8n, Claude Desktop, etc.), add the Agnic MCP server with these details:

| Setting | Value |
|---------|-------|
| **Server URL** | `https://mcp.agnic.ai/sse` |
| **Server Type** | HTTP/SSE |
| **Authentication** | `Bearer <your-api-token>` |

### Step 3: Start Using AI Tools

Your AI can now access X402 APIs automatically. The MCP server handles all transactions in the background!

---

## Available MCP Tools

Your AI assistant gets access to these powerful tools when connected to our MCP server:

### 🌐 make_x402_request

Automatically fetch data from any X402-enabled API. If authorization is required, handles it seamlessly.

**Parameters:** `url`, `method`, `headers`, `body`

### 💰 check_balance

Check your Agnic Wallet balance across different networks (Base, Solana).

**Parameters:** `network` (optional)

### 📜 get_transaction_history

View complete transaction history with timestamps, amounts, and transaction hashes for full transparency.

**Parameters:** `limit`, `startDate`, `network`

### 🔍 discover_apis

Browse and search through available X402-enabled APIs. Check pricing, categories, and popularity.

**Parameters:** `category`, `search`, `maxPrice`, `sort`

### 💸 fund_wallet

Get instructions on how to fund your Agnic Wallet with USDC.

**Parameters:** `network` (optional)

### 📧 check_agent_email

Check your agent's email inbox. Returns recent inbound and outbound messages.

**Parameters:** `limit` (optional, default: 20), `offset` (optional)

### ✉️ send_agent_email

Send an email from your agent's address (`agent-{id}@agent.agnic.ai`).

**Parameters:** `to` (required), `subject` (required), `body` (required)

### 💬 reply_agent_email

Reply to a message in your agent's inbox. Maintains email threading.

**Parameters:** `messageId` (required), `body` (required)

### 🪪 get_agent_card

Fetch an A2A-compatible Agent Card for any Agnic-registered agent. No authentication required.

**Parameters:** `agentId` (required)

<Callout type="info">
  **Works with Any X402 API** - These tools work with any API that supports the X402 protocol. Your AI can access weather data, market data, premium datasets, and more—all with automatic authorization.
</Callout>

---

## Example: Connecting in n8n

In your n8n workflow, add an MCP Client node:

```javascript
// 1. Add MCP Client node configuration
{
  "serverType": "HTTP/SSE",
  "serverUrl": "https://mcp.agnic.ai/sse",
  "authHeader": "Authorization: Bearer agnic_tok_sk_live_..."
}

// 2. Use the make_x402_request tool
{
  "tool": "make_x402_request",
  "parameters": {
    "url": "https://api.example.com/data",
    "method": "POST",
    "body": {
      "prompt": "Generate a summary"
    }
  }
}

// The MCP server handles authorization automatically!
```

That's it! Your n8n workflow can now access X402 APIs. The MCP server handles authorization automatically.

---

## Claude Desktop Configuration

Add Agnic to your Claude Desktop config (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "agnicpay": {
      "url": "https://mcp.agnic.ai/sse",
      "transport": "sse",
      "headers": {
        "Authorization": "Bearer agnic_tok_sk_live_..."
      }
    }
  }
}
```

---

## Perfect For

| Use Case | Description |
|----------|-------------|
| **🤖 AI Agent Developers** | Building autonomous agents that need to access APIs without human intervention |
| **🔄 n8n Workflow Creators** | Creating automation workflows that consume multiple X402 APIs for data enrichment |
| **💼 Business Analysts** | Using Claude or other AI assistants to gather data from premium sources automatically |
| **📊 Data Scientists** | Accessing paid datasets through AI without manual API key management |

---

## Security Best Practices

1. **Use dedicated tokens** - Create a token specifically for MCP use
2. **Set spending limits** - Configure daily/monthly limits on your token
3. **Monitor usage** - Check your transaction history regularly
4. **Rotate tokens** - Periodically rotate your MCP token

---

## Next Steps

<Cards>
  <Card title="N8N Integration" href="/docs/agnicpay-features/n8n">
    Automate workflows with N8N
  </Card>
  <Card title="API Tokens" href="/docs/authentication/api-tokens">
    Generate and manage API tokens via dashboard
  </Card>
  <Card title="X402 Fetch" href="/docs/x402/x402-fetch">
    Learn about the X402 protocol
  </Card>
</Cards>
