---
title: "Connect Mercury to ChatGPT: Sync Accounts and Send Money"
slug: connect-mercury-to-chatgpt-sync-accounts-and-send-money
date: 2026-07-07
author: Nachi Raman
categories: ["AI & Agents"]
excerpt: "Learn how to connect Mercury to ChatGPT using a managed MCP server. Automate corporate card issuance, internal treasury transfers, and AP approval workflows."
tldr: "Connecting Mercury to ChatGPT requires translating LLM tool calls into banking API requests. This guide shows how to deploy a managed MCP server to safely automate treasury operations, card controls, and invoicing."
canonical: https://truto.one/blog/connect-mercury-to-chatgpt-sync-accounts-and-send-money/
---

# Connect Mercury to ChatGPT: Sync Accounts and Send Money


If you need to connect Mercury to ChatGPT to automate corporate card issuance, internal treasury transfers, or Accounts Receivable invoicing, you need a [Model Context Protocol (MCP) server](https://truto.one/what-is-mcp-and-mcp-servers-and-how-do-they-work/). This server acts as the translation layer between ChatGPT's tool calls and Mercury's banking APIs. If your team uses Claude, check out our guide on [connecting Mercury to Claude](https://truto.one/connect-mercury-to-claude-control-cards-and-ar-invoices/) or explore our broader architectural overview on [connecting Mercury to AI Agents](https://truto.one/connect-mercury-to-ai-agents-automate-treasury-and-operations/).

Giving a Large Language Model (LLM) read and write access to your corporate bank accounts is an engineering challenge with zero margin for error. You have to handle strict idempotency rules to prevent duplicate wires, manage OAuth 2.0 token lifecycles, map massive JSON schemas to MCP tool definitions, and deal with Mercury's specific pagination cursors. Every time Mercury updates an endpoint or deprecates a field, you have to update your server code, redeploy, and test the integration.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Mercury, connect it natively to ChatGPT, and execute complex financial workflows using natural language.

## The Engineering Reality of the Mercury API

A custom MCP server is a self-hosted integration layer. While the open [MCP standard](https://truto.one/what-is-mcp-and-mcp-servers-and-how-do-they-work/) provides a predictable way for models to discover tools, implementing it against financial APIs is painful. If you decide to build a custom MCP server for Mercury, you own the entire API lifecycle. 

Here are the specific integration challenges that break standard CRUD assumptions when working with Mercury:

**Strict Idempotency for Money Movement**
When dealing with financial transactions, network failures happen. If your LLM requests a $50,000 internal transfer and the connection drops before the response arrives, the LLM might assume the call failed and retry it. Mercury strictly requires an `idempotencyKey` for all state-changing endpoints (like `create_a_mercury_send_money_request` or `create_a_mercury_internal_transfer`). Your AI agent must be explicitly instructed to generate a unique UUID for the initial request and reuse that exact same UUID for any retries. If your custom server fails to enforce this, you risk double-paying vendors.

**Two-Tier Approval State Machines**
Moving money in Mercury is rarely a synchronous, one-step process. When an LLM calls the endpoint to send money, it actually creates a Send Money Request. The API does not immediately execute the transfer; it returns a record with a `status` of `pending_approval` or `pending_review`. Your LLM needs the context to understand that a successful HTTP 201 Created response does not mean the money has moved - it means the transaction is sitting in an approval queue awaiting a human quorum.

**Rate Limits and 429 Error Handling**
Mercury enforces rate limits across its API. When an upstream API returns an HTTP 429, the LLM must handle it gracefully. **Factual note on rate limits:** Truto does not retry, throttle, or apply backoff on rate limit errors. When the Mercury API returns an HTTP 429 Too Many Requests, Truto passes that error directly to the caller. Truto normalizes upstream rate limit info into standardized headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`) per the IETF spec. The caller - whether that is a custom agent framework or ChatGPT - is responsible for reading these headers and executing its own retry and exponential backoff logic.

## Generating the Managed Mercury MCP Server

Instead of building a JSON-RPC server from scratch, you can use Truto to dynamically generate a secure MCP server URL. Truto derives the tool definitions directly from the integration's documented API schema. There are two ways to create this server.

### Method 1: Via the Truto UI

For administrators who want a quick, click-to-deploy workflow:

1. Log into your Truto dashboard and navigate to the integrated account page for your connected Mercury instance.
2. Click the **MCP Servers** tab.
3. Click **Create MCP Server**.
4. Configure the server name, allowed methods (e.g., limit to `read` for safety), and an optional expiration date.
5. Click Save and copy the generated MCP server URL (it will look like `https://api.truto.one/mcp/a1b2c3d4e5f6...`).

### Method 2: Via the REST API

For engineering teams embedding AI capabilities programmatically, you can provision MCP servers on the fly using the Truto API. This validates that the integration has tools available, generates a secure cryptographic token, and returns a ready-to-use URL.

Make an authenticated `POST` request to the `/integrated-account/:id/mcp` endpoint:

```bash
curl -X POST https://api.truto.one/integrated-account/YOUR_MERCURY_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer YOUR_TRUTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mercury Treasury Agent",
    "config": {
      "methods": ["read", "write", "custom"]
    },
    "expires_at": "2026-12-31T23:59:59Z"
  }'
```

The API returns a JSON response containing the server ID and the endpoint URL:

```json
{
  "id": "mercury-mcp-987",
  "name": "Mercury Treasury Agent",
  "config": { "methods": ["read", "write", "custom"] },
  "expires_at": "2026-12-31T23:59:59Z",
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f67890"
}
```

## Connecting the MCP Server to ChatGPT

Once you have the Truto MCP URL, connecting it to your AI environment takes less than a minute. The URL contains an encoded token that automatically authenticates requests to the specific Mercury account.

### Method 1: Via the ChatGPT UI

If you are using ChatGPT Plus, Team, or Enterprise, you can connect the server directly through the interface:

1. In ChatGPT, navigate to **Settings -> Apps -> Advanced settings**.
2. Enable **Developer mode** to expose MCP connector options.
3. Under the Custom Connectors or MCP servers section, click **Add new server**.
4. Give the connector a name (e.g., "Mercury Finance Ops").
5. Paste the Truto MCP URL into the Server URL field.
6. Click **Add** and save your settings.

ChatGPT will immediately ping the server, complete the JSON-RPC handshake, and load the available Mercury tools into the prompt context.

### Method 2: Via Local Configuration File

If you are running a custom AI agent framework or using a desktop client that relies on file-based MCP configurations, you can use the official `@modelcontextprotocol/server-sse` transport wrapper.

Add the following configuration to your `mcp_config.json` file:

```json
{
  "mcpServers": {
    "mercury_finance": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/a1b2c3d4e5f67890"
      ]
    }
  }
}
```

Restart your agent framework. It will spawn the SSE transport layer, connect to the Truto endpoint, and fetch the generated tools.

## Hero Tools for Mercury

When your AI agent connects to the Mercury MCP server, it gains access to the endpoints defined in the integration's schema. Here are the highest-leverage tools available for automating treasury and operations workflows.

### list_all_mercury_account

Retrieves a paginated list of all Mercury accounts associated with the organization, including their current balances, routing numbers, and operational status.

**Usage Note:** Crucial for initial context-gathering. The LLM must call this tool first to obtain the `id` of the specific checking or savings account it needs to operate on.

> "List all of our active Mercury accounts and give me a summary of the available balances across our checking and treasury reserves."

### create_a_mercury_internal_transfer

Executes an immediate transfer of funds between two Mercury accounts within the same organization.

**Usage Note:** Requires `sourceAccountId`, `destinationAccountId`, `amount`, and `idempotencyKey`. The amount must be formatted correctly (minimum $0.01). If the LLM generates a duplicate idempotency key across separate sessions, the request will fail.

> "Move $25,000 from our main operating checking account to the payroll clearing account. Generate a unique idempotency key for this transaction."

### create_a_mercury_send_money_request

Initiates a payment to an external recipient via ACH, Wire, or Check. 

**Usage Note:** This does not bypass your organization's security controls. It creates a request that enters a `pending_approval` state. An authorized team member must log into Mercury to approve the payment. 

> "Draft a send money request for $4,500 to the recipient ID rec_12345 using our main checking account. Add a memo for 'Q3 Legal Retainer'."

### create_a_mercury_card

Issues a new virtual or physical corporate card and assigns it to an existing organization user.

**Usage Note:** You must pass the target `userId`, define the `kind` (virtual or physical), and set a `spendLimit`. This is highly useful for automating contractor onboarding flows.

> "Issue a new virtual card for user ID usr_987. Set the spend limit to $500 monthly and name the card 'Marketing Ad Spend'."

### update_a_mercury_card_by_id

Modifies an existing corporate card. This is primarily used to adjust spending limits, update the nickname, or apply freezes.

**Usage Note:** If an employee loses a card or a contractor goes over budget, the LLM can immediately adjust the limit or alter the state of the card. At least one updatable field (like `spendLimit` or `nickname`) must be provided.

> "Find the card named 'Contractor AWS Expenses' and reduce its monthly spend limit to $150 immediately."

### list_all_mercury_transaction

Queries the transaction ledger across accounts to find historical spending, wire fees, and deposits.

**Usage Note:** Returns detailed objects including counterparties, attachments, and categories. When pulling large date ranges, the LLM must explicitly handle the `next_cursor` property returned by the API to paginate through the ledger.

> "Pull the last 50 transactions for our main checking account and categorize the largest outbound wires from the past week."

### create_a_mercury_invoice

Generates a new Accounts Receivable invoice in Mercury to request payment from a customer.

**Usage Note:** Requires detailed arrays for `lineItems`, as well as `dueDate` and `customerId`. If you want to enable credit card payments on the invoice, your Mercury account must be connected to Stripe, and you must pass `creditCardEnabled: true`.

> "Draft a new AR invoice for customer ID cust_555. Include one line item for 'Annual Platform Subscription' at $12,000. Set the due date to Net 30."

For the complete tool inventory, including webhook management, customer directory endpoints, and statement PDF retrieval schemas, visit the [Mercury integration page](https://truto.one/integrations/detail/mercury).

## Workflows in Action

Exposing Mercury to ChatGPT transforms manual finance operations into automated, natural language workflows. Here are concrete examples of how an AI agent orchestrates these tools.

### Scenario 1: Automated Card Issuance and Spend Control

IT and Finance teams waste hours manually issuing virtual cards for one-off software subscriptions or contractor expenses. An IT administrator can ask ChatGPT to handle the provisioning.

> "We just hired a new contractor. Find their Mercury user profile by searching for their email, issue them a virtual card with a $200 monthly limit named 'Contractor SaaS Tools', and verify the card was created."

**Step-by-step execution:**
1. **`list_all_mercury_user`**: The agent queries the organization's user directory to find the contractor's email and extracts their `userId`.
2. **`list_all_mercury_account`**: The agent pulls the account list to determine which checking account should back the virtual card.
3. **`create_a_mercury_card`**: The agent calls the creation tool, passing the `userId`, setting `kind: "virtual"`, `spendLimit: 200`, and `nameOnCard: "Contractor SaaS Tools"`.

**Outcome:** ChatGPT confirms the card was successfully created and provides the last four digits and status metadata to the administrator.

```mermaid
sequenceDiagram
  participant Admin as IT Admin
  participant ChatGPT as ChatGPT
  participant Truto as Truto MCP
  participant Mercury as Mercury API
  
  Admin->>ChatGPT: "Issue virtual card for contractor..."
  ChatGPT->>Truto: call list_all_mercury_user()
  Truto->>Mercury: GET /users
  Mercury-->>Truto: Return user array
  Truto-->>ChatGPT: Provide userId context
  ChatGPT->>Truto: call create_a_mercury_card(userId, limit)
  Truto->>Mercury: POST /cards
  Mercury-->>Truto: Return 201 Created (Card Data)
  Truto-->>ChatGPT: Card issued successfully
```

### Scenario 2: Routing AP Approvals

A Founder needs to pay an urgent vendor invoice but does not want to log into the banking dashboard to draft the wire.

> "I need to pay Acme Corp $8,500 for their Q2 consulting invoice. Find their recipient profile, check if we have enough funds in the main operating account, and draft a payment request for my approval."

**Step-by-step execution:**
1. **`list_all_mercury_recipient`**: The agent searches the recipient directory for "Acme Corp" to grab the existing `recipientId` and verify routing details are on file.
2. **`list_all_mercury_account`**: The agent pulls balances to ensure the main operating account has at least $8,500 available.
3. **`create_a_mercury_send_money_request`**: The agent generates a unique UUID for the idempotency key and submits the payment draft. 

**Outcome:** ChatGPT informs the Founder that the request is queued. The money has not moved yet - the Founder simply opens their Mercury app and clicks "Approve" on the pending transaction.

### Scenario 3: Treasury Rebalancing

Finance teams frequently need to rebalance funds between operating accounts and higher-yield treasury reserves.

> "Check the balance of our primary checking account. If it is over $500,000, transfer exactly $100,000 into our Treasury reserve account."

**Step-by-step execution:**
1. **`list_all_mercury_account`**: The agent fetches all accounts and parses the `availableBalance` of the primary checking account.
2. **Logic Evaluation**: The agent determines the checking account holds $650,000, satisfying the condition.
3. **`create_a_mercury_internal_transfer`**: The agent identifies the `id` of both the checking account and the treasury account, generates an idempotency key, and executes the internal transfer for $100,000.

**Outcome:** ChatGPT confirms the internal ledger transfer is complete and outputs the transaction metadata.

## Security and Access Control

Providing an LLM with access to corporate banking APIs demands strict governance. Truto MCP servers include built-in security controls that allow you to lock down what the AI agent can do.

* **Method Filtering (`methods`)**: You can restrict an MCP server to specific operation types. Setting `methods: ["read"]` ensures the LLM can only query balances and ledger histories, completely blocking it from creating transactions or issuing cards. You can also specify exact endpoints, like `methods: ["list", "get", "update"]` to prevent deletions.
* **Tag Filtering (`tags`)**: Mercury endpoints are logically grouped. You can configure the MCP server to only expose tools tagged with `cards` or `invoices`, ensuring an agent built for Accounts Receivable cannot accidentally interact with treasury functions.
* **Expiration Limits (`expires_at`)**: For temporary automation tasks or contractor access, you can set a strict ISO datetime. Once the timestamp passes, the server automatically invalidates the token, shuts down the connection, and cleans up the underlying KV storage.
* **Secondary Authentication (`require_api_token_auth`)**: By default, possessing the MCP URL grants access to the tools. If you enable `require_api_token_auth`, the client must also inject a valid Truto API token into the HTTP Authorization header. This guarantees that even if the MCP URL is leaked in a log file, the attacker cannot execute banking tools without also possessing your core API credentials.

> Stop writing boilerplate code to handle financial API rate limits and idempotency keys. Let Truto generate secure, compliant MCP servers for your AI agents.
>
> [Talk to us](https://cal.com/truto/partner-with-truto)

Connecting Mercury to ChatGPT turns a conversational interface into a powerful treasury command line. By offloading the API translation, token management, and schema generation to a managed MCP layer, your engineering team can focus on designing reliable agentic workflows instead of fighting with REST architectures.
