> ## Documentation Index
> Fetch the complete documentation index at: https://pay3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Your AI Assistant to Pay3: MCP Setup Guide

> Step-by-step guide to configure Claude Desktop, Cursor, and custom agents to connect to Pay3 and start making autonomous AI-driven payments.

Connecting your AI assistant to Pay3 takes less than five minutes. You install nothing permanently — the MCP server runs on demand via `npx` each time your AI client starts. All you need is a Pay3 account, an active session, and the MCP auth token that session generates.

## Prerequisites

Before you configure any AI client, make sure you have the following ready:

* **A Pay3 account.** Sign up at [pay3.finance](https://pay3.finance) if you haven't already.
* **An active AI session with an MCP auth token.** Open the Pay3 Dashboard, navigate to **Sessions**, create a new session, and copy the `PAY3_MCP_AUTH_TOKEN`.

> [!WARNING]
>
> Your `PAY3_MCP_AUTH_TOKEN` is shown **only once** when you create the session. Copy it immediately and store it somewhere safe — you cannot retrieve it again. If you lose it, you'll need to create a new session.

> [!NOTE]
>
> Pay3 has two environments. Use the correct `API_BASE_URL` for your environment:
>
> * **Testnet (sandbox):** `https://api-testnet.pay3.finance`
> * **Production:** `https://api.pay3.finance`

## MCP server configuration

Every MCP client uses the same underlying JSON configuration block. Fill in your token and target environment, then paste it into the location your client expects.

```json theme={null}
{
  "mcpServers": {
    "pay3": {
      "command": "npx",
      "args": ["-y", "@pay3/mcp-server"],
      "env": {
        "PAY3_MCP_AUTH_TOKEN": "<your-mcp-auth-token>",
        "API_BASE_URL": "https://api.pay3.finance"
      }
    }
  }
}
```

Replace `<your-mcp-auth-token>` with the token you copied from the Sessions dashboard.

## Client setup

**Claude Desktop**

Claude Desktop reads its MCP server list from a single JSON config file on your machine. Follow these steps:

**1. Locate the config file**

Open (or create) the Claude Desktop config file at the path for your operating system:

```text macOS theme={null}
~/Library/Application Support/Claude/claude_desktop_config.json
```

```text Windows theme={null}
%APPDATA%\Claude\claude_desktop_config.json
```

**2. Add the Pay3 MCP server**

If the file already contains a `mcpServers` object, merge the `pay3` entry into it. If the file is empty or doesn't exist, paste the full block below:

```json claude_desktop_config.json theme={null}
{
  "mcpServers": {
    "pay3": {
      "command": "npx",
      "args": ["-y", "@pay3/mcp-server"],
      "env": {
        "PAY3_MCP_AUTH_TOKEN": "<your-mcp-auth-token>",
        "API_BASE_URL": "https://api.pay3.finance"
      }
    }
  }
}
```

**3. Restart Claude Desktop**

Quit Claude Desktop completely and reopen it. When it starts, it will launch the Pay3 MCP server in the background. You should now see Pay3 tools available when you click the **tool** icon in the Claude chat interface.

**4. Verify the connection**

Type the following in a new Claude conversation to confirm everything is working:

```text theme={null}
What is my Pay3 USDC balance?
```

Claude will call `get_balance` and return your current balance.

**Cursor**

Cursor has a built-in MCP Servers panel in its settings. No manual file editing is required.

**1. Open MCP Settings**

In Cursor, press `Cmd + ,` (macOS) or `Ctrl + ,` (Windows/Linux) to open **Settings**, then navigate to the **MCP Servers** section.

**2. Add a new MCP server**

Click **Add MCP Server** and enter the following values:

| Field | Value |
| - | - |
| Name | `pay3` |
| Command | `npx` |
| Args | `-y @pay3/mcp-server` |
| `PAY3_MCP_AUTH_TOKEN` | Your token from the Sessions dashboard |
| `API_BASE_URL` | `https://api.pay3.finance` |

Alternatively, switch to **JSON mode** in the MCP panel and paste the config block directly:

```json theme={null}
{
  "mcpServers": {
    "pay3": {
      "command": "npx",
      "args": ["-y", "@pay3/mcp-server"],
      "env": {
        "PAY3_MCP_AUTH_TOKEN": "<your-mcp-auth-token>",
        "API_BASE_URL": "https://api.pay3.finance"
      }
    }
  }
}
```

**3. Restart Cursor**

Save your settings and restart Cursor. The Pay3 MCP server will start automatically on the next launch and the three Pay3 tools will be available to the Cursor AI agent.

**Custom Agent (LangChain / AutoGen / CrewAI)**

If you're building your own agent with LangChain, AutoGen, CrewAI, or any framework that supports the MCP TypeScript SDK, connect via a stdio transport client.

**1. Install the MCP SDK**

Add the official MCP client SDK to your project:

```bash theme={null}
npm install @modelcontextprotocol/sdk
```

**2. Set environment variables**

Export your Pay3 credentials before launching your agent process, or load them from a `.env` file:

```bash .env theme={null}
PAY3_MCP_AUTH_TOKEN=<your-mcp-auth-token>
API_BASE_URL=https://api.pay3.finance
```

**3. Connect via stdio transport**

Spawn the Pay3 MCP server as a child process and attach a stdio client:

```typescript theme={null}
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const transport = new StdioClientTransport({
  command: "npx",
  args: ["-y", "@pay3/mcp-server"],
  env: {
    PAY3_MCP_AUTH_TOKEN: process.env.PAY3_MCP_AUTH_TOKEN!,
    API_BASE_URL: process.env.API_BASE_URL!,
  },
});

const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);

// List available tools
const { tools } = await client.listTools();
console.log(tools.map((t) => t.name));
// → ["get_balance", "transfer", "get_transaction_history"]
```

**4. Call a tool**

Invoke any Pay3 tool directly from your agent logic:

```typescript theme={null}
const result = await client.callTool({
  name: "get_balance",
  arguments: { asset: "USDC" },
});

console.log(result.content);
```

> [!TIP]
>
> Pass the `client` instance to your LangChain `MCPToolkit`, AutoGen tool adapter, or CrewAI tool wrapper to expose `get_balance`, `transfer`, and `get_transaction_history` as native agent tools.

## Next steps

Now that your AI client is connected, explore what each tool can do:

> **[MCP Tools Reference](https://pay3.mintlify.site/mcp/tools.md)**
>
> See every parameter, execution outcome, and example AI prompt for all three Pay3 tools.

> **[Sessions Dashboard](https://pay3.finance/dashboard/sessions)**
>
> Manage your active sessions, set spending policies, and approve pending transactions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.