---
title: "Connect Lob to Claude: Manage Mail Campaigns & Custom Templates"
slug: connect-lob-to-claude-manage-mail-campaigns-custom-templates
date: 2026-09-04
author: Roopendra Talekar
categories: ["AI & Agents"]
excerpt: "Learn how to connect Lob to Claude using Truto's managed MCP server. Automate direct mail, address verification, and custom HTML templates with AI agents."
tldr: "Connect Lob to Claude via MCP to automate direct mail campaigns, verify addresses, and issue checks. This guide covers MCP server generation, Claude setup, and real-world tool execution workflows."
canonical: https://truto.one/blog/connect-lob-to-claude-manage-mail-campaigns-custom-templates/
---

# Connect Lob to Claude: Manage Mail Campaigns & Custom Templates


If your team needs to connect Lob to Claude to automate direct mail campaigns, manage custom HTML letter templates, or verify physical mailing addresses, 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 critical translation layer between Claude's JSON-RPC tool calls and Lob's specialized REST APIs. You can either construct and host this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a [secure, authenticated MCP server URL](https://truto.one/managed-mcp-for-claude-full-saas-api-access-without-security-headaches/). If your team uses ChatGPT, check out our guide on [connecting Lob to ChatGPT](https://truto.one/connect-lob-to-chatgpt-automate-direct-mail-address-verification/) or explore our broader architectural overview on [connecting Lob to AI Agents](https://truto.one/connect-lob-to-ai-agents-orchestrate-print-mail-identity-checks/).

Giving a Large Language Model (LLM) read and write access to a physical-world API like Lob is an engineering challenge. You are not just pushing bits - you are printing postcards, issuing checks, and mailing compliance letters. You must handle strict address validation schemas, time-sensitive cancellation windows, and financial compliance workflows. Every time Lob updates its template engine or modifies its verification payloads, your server code must adapt.

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

> Want to give your AI agents secure, authenticated access to Lob and 100+ other SaaS APIs? Let's talk about [managed MCP architecture](https://truto.one/managed-mcp-for-claude-full-saas-api-access-without-security-headaches/).
>
> [Talk to us](https://truto.one/book-a-demo/)

## The Engineering Reality of the Lob 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, the reality of implementing it against specialized APIs is painful. Lob bridges the digital and physical worlds, and its API design reflects the strict constraints of the postal system and financial networks.

If you decide to build a custom Lob MCP server, here are the specific integration challenges you will face:

**Strict Address Verification Schemas**
Lob will reject mail pieces if the destination address is invalid. However, their verification endpoints (`create_a_lob_us_verification` or `create_a_lob_intl_verification`) enforce strict payload rules. You can provide an address as discrete components (`primary_line`, `city`, `state`, `zip_code`) or as a single-line `address` string - but never both. If an LLM hallucinates a payload containing both formats, the API throws a 422 error. Your MCP tool definitions must strictly guide the model to choose one format.

**Time-Sensitive State Mutations**
Unlike a typical database record that can be deleted at any time, a Lob postcard or letter enters a physical production pipeline. You can only cancel a mail piece using `delete_a_lob_postcard_by_id` if the `send_date` has not yet passed. An LLM interacting with Lob must understand this temporal state. A managed MCP server exposes clear schema descriptions that warn the model to check the `send_date` before attempting a cancellation.

**Financial Compliance and Micro-Deposits**
If you use Lob to print and mail checks, you cannot simply pass a routing number and print money. Bank accounts must be verified via micro-deposits. The `lob_bank_accounts_verify` endpoint requires either an array of exact deposit amounts (in cents) or a 6-character SM-prefixed `descriptor_code`, depending on the account's specific `microdeposit_type`. Building an abstraction that allows an LLM to navigate this two-step, conditional verification process requires carefully structured tool descriptions.

**Rate Limits and Upstream Quotas**
Lob enforces strict rate limits depending on your tier. It is critical to understand how Truto handles these limits. Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Lob API returns an HTTP 429, 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 - in this case, the LLM framework or agent orchestrator - is responsible for handling the retry and backoff logic. Do not expect the MCP server to absorb rate limit errors.

## Generating the Lob MCP Server

Truto dynamically generates MCP tools based on Lob's API documentation and OpenAPI specifications. Rather than hand-coding JSON-RPC handlers for every Lob endpoint, Truto derives them on the fly. When a client requests tools, the server iterates through the available Lob resources, applies any requested filters, and serves a flat input namespace where query and body parameters are explicitly defined.

You can generate an MCP server for Lob using either the Truto UI or the API.

### Method 1: Via the Truto UI

1. Log into your Truto account and navigate to the **Integrated Accounts** page.
2. Select your connected Lob account.
3. Click the **MCP Servers** tab.
4. Click **Create MCP Server**.
5. Select your desired configuration (e.g., restrict to read-only methods, filter by specific tool tags, or set an expiration date).
6. Copy the generated MCP server URL (e.g., `https://api.truto.one/mcp/a1b2c3d4...`).

### Method 2: Via the Truto API

For teams orchestrating AI infrastructure programmatically, you can generate temporary or scoped MCP servers via the Truto API. This is ideal for assigning a unique MCP server to a specific agent session.

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

The API returns a secure token URL. The random hex token is hashed before storage in Truto's edge KV, ensuring that even internal systems do not store the raw access token.

## Connecting the MCP Server to Claude

Once you have your MCP URL, you can connect it to Claude Desktop or any other MCP-compatible client.

### Method 1: Via the Claude UI

If you are using Claude Desktop:

1. Open Claude Desktop.
2. Navigate to **Settings** -> **Integrations** -> **Add MCP Server**.
3. Paste the Truto MCP URL.
4. Click **Add**. Claude will automatically perform the protocol handshake and list the available Lob tools.

*(Note: If you are using ChatGPT Enterprise or Pro, the flow is similar: Settings -> Apps -> Advanced settings -> Enable Developer mode -> Add custom connector.)*

### Method 2: Via Manual Configuration File

If you prefer to configure Claude Desktop manually, you can edit the `claude_desktop_config.json` file. Truto's MCP servers communicate over standard HTTP POST using JSON-RPC, but you can bridge this using the `@modelcontextprotocol/server-sse` package.

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

Restart Claude Desktop. The application will initialize the connection, and Claude will immediately have access to the defined Lob endpoints.

## Hero Tools for Lob MCP

When you connect Lob via Truto, Claude gains access to a vast array of endpoints. Here are the highest-leverage operations for direct mail automation.

### 1. Create a Lob Postcard (`create_a_lob_postcard`)

This tool allows the agent to generate and schedule a physical postcard. It requires sender and recipient addresses, artwork (HTML or URL), and a `use_type` (e.g., promotional, operational). 

> "Design and schedule a promotional postcard to [Customer ID 12345]. Use the front artwork from 'https://example.com/promo-front.pdf' and back artwork from 'https://example.com/promo-back.pdf'. Set the mail type to usps_first_class."

### 2. Verify a US Address (`create_a_lob_us_verification`)

Before sending high-volume mail, agents must ensure addresses are deliverable. This tool checks a US address against USPS data and returns delivery metrics.

> "Verify the address '185 Berry St, Suite 6100, San Francisco, CA 94107'. Let me know if it requires a secondary line update or if it is fully deliverable."

### 3. Manage HTML Template Versions (`create_a_lob_template_version`)

Lob allows you to store HTML templates with merge variables (e.g., `{{name}}`). This tool lets Claude inject new HTML markup to update an existing template version programmatically.

> "Create a new template version for template ID 'tmpl_8675309'. Update the HTML to include a new promotional header that reads 'Spring Sale 2026' and save the version description as 'Spring Campaign update'."

### 4. Create a Bank Account (`create_a_lob_bank_account`)

To automate physical check mailing, the agent must first register the funding source. This tool provisions a new bank account record within Lob.

> "Create a new corporate bank account in Lob for our vendor payouts. Use routing number XXXXXX and account number YYYYYY. Set the signatory name to 'Jane Doe'."

### 5. Verify a Bank Account (`lob_bank_accounts_verify`)

Bank accounts in live mode cannot issue checks until verified. This custom method tool allows the agent to submit the exact micro-deposit amounts or the SM-prefixed descriptor code to activate the account.

> "Verify the bank account ID 'bank_09876' using the descriptor code 'SM-AB12CD'."

### 6. Cancel a Scheduled Letter (`delete_a_lob_letter_by_id`)

Mistakes happen. If a campaign was triggered in error, this tool allows the agent to pull it from the production queue, provided the send date has not passed.

> "Cancel the letter with ID 'ltr_5551234'. Confirm that it has been removed from production and that we will not be charged."

To explore the full inventory of available tools - including bulk verification, self-mailers, Informed Delivery campaigns, and QR code analytics - visit the [Lob integration page](https://truto.one/integrations/detail/lob).

## Workflows in Action

AI agents excel at orchestrating multi-step API processes that require logic and conditional branching. Here are two real-world direct mail workflows powered by Claude and the Lob MCP server.

### Workflow 1: The Intelligent Mail Recovery Campaign

Marketing teams often deal with bounced direct mail. In this workflow, Claude takes a potentially flawed customer address, validates it, fixes it if possible, and automatically dispatches a recovery postcard.

> "We have an incomplete address for a high-value lead: '123 Main Street, Apt B, Brooklyn NY'. Run this through Lob's verification. If it resolves to a deliverable address, immediately send them a postcard using template 'tmpl_abc123' to re-engage them. If it fails, let me know so we can email them instead."

**Execution Steps:**
1.  **`create_a_lob_us_verification`**: Claude calls the verification tool using the single-line `address` parameter.
2.  **Analyze payload**: Claude inspects the `deliverable` flag and the normalized `components` returned by Lob (e.g., standardizing 'Apt B' to 'Apt B', 'Brooklyn NY' to '11201').
3.  **`create_a_lob_postcard`**: Seeing a successful verification, Claude extracts the normalized address and executes the postcard creation tool, passing the correct `to` object and the specified `front_template_id`.

```mermaid
sequenceDiagram
    participant User
    participant Claude
    participant LobAPI as Upstream API (Lob)

    User->>Claude: Verify address and send postcard
    Claude->>LobAPI: Call create_a_lob_us_verification
    LobAPI-->>Claude: Return normalized components & deliverable: true
    Claude->>LobAPI: Call create_a_lob_postcard (with normalized address)
    LobAPI-->>Claude: Return postcard object (id, expected_delivery_date)
    Claude-->>User: Postcard scheduled! Expected delivery: Nov 12.
```

### Workflow 2: Vendor Payment Orchestration

Operations teams need to onboard vendors and issue physical checks securely. This workflow handles the setup, verification, and disbursement in a single conversational thread.

> "We need to pay ACME Corp $1,500 for Q3 consulting. First, create a new Lob bank account using routing XXXXXX and account YYYYYY. We already received the micro-deposits of $0.12 and $0.15. Verify the account, then issue a check to ACME Corp at their verified HQ address with the memo 'Q3 Consulting'."

**Execution Steps:**
1.  **`create_a_lob_bank_account`**: Claude submits the routing, account, and signatory data. Lob returns a `bank_id`.
2.  **`lob_bank_accounts_verify`**: Claude immediately calls the verification tool, passing the `bank_id` and the `amounts` array `[12, 15]`.
3.  **`create_a_lob_check`**: With the account active, Claude calls the check creation tool, inputting the verified `bank_account`, the `amount` of 1500, the `memo`, and the required recipient address.

```mermaid
sequenceDiagram
    participant User
    participant Claude
    participant LobAPI as Upstream API (Lob)

    User->>Claude: Create bank, verify (12c, 15c), send $1500 check
    Claude->>LobAPI: Call create_a_lob_bank_account
    LobAPI-->>Claude: Return bank_id (pending verification)
    Claude->>LobAPI: Call lob_bank_accounts_verify (amounts: [12, 15])
    LobAPI-->>Claude: Return verified status
    Claude->>LobAPI: Call create_a_lob_check (amount: 1500)
    LobAPI-->>Claude: Return check_id and expected_delivery_date
    Claude-->>User: Bank verified and check #1001 mailed.
```

## Security and Access Control

Exposing an API that can spend real money and ship physical objects requires strict governance. Truto provides robust security controls when generating MCP servers:

*   **Method Filtering:** Limit the server to specific operation types. For a reporting agent, pass `methods: ["read"]` to allow `list` and `get` operations while strictly blocking `create`, `update`, or `delete`.
*   **Tag Filtering:** Restrict tools by functional domain. You can configure a server to only expose tools tagged with `addresses` or `verifications`, hiding all financial and printing endpoints.
*   **`expires_at` Parameter:** Define a precise ISO datetime for server expiration. Truto's edge infrastructure automatically schedules cleanup alarms, invalidating the token instantly when time expires.
*   **`require_api_token_auth`:** By default, the cryptographically secure MCP URL is sufficient for access. For enterprise environments, setting this flag to `true` adds a secondary authentication layer, requiring the client to pass a valid Truto API token in the Authorization header.

## Strategic Wrap-Up

Direct mail and physical compliance are no longer relegated to legacy CSV uploads and manual processing. By connecting Lob to Claude via a managed MCP server, you transform physical logistics into an intelligent, programmable interface. Your AI agents can now audit addresses, manage HTML templates, provision financial accounts, and orchestrate complex print-and-mail workflows securely.

Skip the boilerplate of managing OAuth tokens, tracking API breaking changes, and mapping JSON-RPC to REST. Use Truto to generate secure, production-ready MCP servers in seconds, and let your models handle the physical world.

> Ready to automate your direct mail and financial workflows with Claude? Talk to our engineering team about building with Truto's managed MCP architecture.
>
> [Talk to us](https://truto.one/book-a-demo/)
