Skip to navigation

MCP server

Connect Claude, Cursor, VS Code, or any MCP client to a US Global Mail mailbox with one URL and your API key.

The US Global Mail MCP server lets an AI assistant or coding agent work in a mailbox on the customer’s behalf: read and organize scanned mail, manage folders, request scans, keep shipping and deposit addresses and bank accounts current, follow shipment requests, and read the account profile and virtual mailing address.

It is a thin, stateless proxy in front of the public API. Every tool call becomes a REST call that carries your API key, so the gateway enforces authentication, plan access, rate limits, and the audit log exactly as it does for direct REST calls. There is nothing new to trust.

Setting this up for a customer who is not a developer? The support article Connect US Global Mail to AI apps using MCP walks through the same steps screen by screen.

At a glance

PropertyValue
Endpointhttps://mcp.usglobalmail.com/mcp
TransportMCP Streamable HTTP, stateless: any instance serves any request
AuthenticationAuthorization: Bearer <API key> on every request, the same key as for REST
SandboxSame endpoint. A usgmk_test_… key is routed to your sandbox; a usgmk_live_… key to production
Tools36, listed in the reference below
Limits and auditApplied by the gateway: rate limits, plan checks, audit log

Before you connect

1

Have a plan with API access

Plans that include it list API & webhooks on their plan card. On other plans the API Keys page shows an upgrade banner and the Add API Key button is locked.

2

Create a key for the agent

In the dashboard go to Settings → Developer → API Keys, click Add API Key, name it after the client you are connecting (for example Claude), and copy the key: it is shown once. It starts with usgmk_live_.

3

Optional: get a sandbox key

On the same page, Activate Sandbox gives you a usgmk_test_… key for an isolated test mailbox. See Sandbox for how to seed it with sample mail.

Treat the key like a password: anything the agent can do, the key can do, with the same access as you. Use a dedicated key per agent so you can revoke one without touching the others, and rotate a key the moment it may have leaked.

Connect your client

In every example, replace YOUR_API_KEY with the key you copied.

Claude on the web and Claude Desktop

Claude uses a custom connector, added once to your Claude account and available on the web and in Claude Desktop. Custom connectors exist on every Claude plan; the Free plan allows one.

1

Add the connector

In Claude, open Customize → Connectors, click Add, and choose Add custom connector. Enter US Global Mail as the name and https://mcp.usglobalmail.com/mcp as the remote MCP server URL, then click Continue.

2

Keep No sign-in

Claude probes the server and preselects No sign-in, marked Detected. Leave it selected.

3

Add the header

Under Request headers, click Add header. Name Authorization, value Bearer YOUR_API_KEY (the word Bearer, a space, then the key). Click Add.

4

Switch it on in a chat

Click the + button at the lower left of the message box and enable US Global Mail. On Team and Enterprise plans an Owner adds the connector under Organization settings → Connectors (Add → Custom → Web) and each member then clicks Connect.

Claude Code, Cursor, VS Code, Codex CLI

claude mcp add --transport http usgm \
https://mcp.usglobalmail.com/mcp \
--header "Authorization: Bearer YOUR_API_KEY"

Config file locations: .mcp.json at the project root for Claude Code, .cursor/mcp.json for Cursor, .vscode/mcp.json for VS Code, and ~/.codex/config.toml for Codex CLI. VS Code prompts for the key the first time the server starts and stores it, so it never sits in the file. In Claude Code, /mcp lists usgm as connected once the command has run.

Claude Desktop without a connector

If you prefer to keep the key on the machine instead of in your Claude account, Claude Desktop can run the open-source mcp-remote bridge, which needs Node.js. Open Settings → Developer → Edit Config and add the server to mcpServers:

claude_desktop_config.json
{
"mcpServers": {
"usgm": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.usglobalmail.com/mcp",
"--header",
"Authorization:${USGM_AUTH}"
],
"env": { "USGM_AUTH": "Bearer YOUR_API_KEY" }
}
}
}

The header value lives in an environment variable with no space after the colon on purpose: Claude Desktop on Windows mangles spaces inside args. The first start can take a while because the bridge probes for an OAuth challenge before it connects.

Other clients

Any client that supports remote MCP servers over Streamable HTTP works with the URL above, transport streamableHttp, and an Authorization: Bearer YOUR_API_KEY header. Gemini CLI (httpUrl plus headers), Cline (url, type, headers), and Windsurf (serverUrl plus headers) all accept that shape. ChatGPT’s connectors offer only OAuth or no authentication, so they cannot send the key and cannot connect yet.

Try it with curl

The server speaks plain JSON-RPC over HTTP, so you can exercise it without a client. initialize and tools/list need no key; tools/call forwards the key to the gateway.

curl -s https://mcp.usglobalmail.com/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"account_get","arguments":{}}}'

A successful call returns the tool’s text content. A failed call is not an HTTP error: it is a normal JSON-RPC result with isError: true, so the agent can read and act on it:

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"isError": true,
"content": [
{ "type": "text", "text": "Gateway error 401: Provide your API key as `Authorization: Bearer usgmk_live_...`." }
]
}
}

Sandbox

The sandbox is a separate test mailbox with its own key. Activate it on the API Keys page, then use the usgmk_test_… key with the same MCP endpoint: the server recognizes the prefix and forwards the call to the sandbox gateway. A live key never sees sandbox data and a sandbox key never sees real mail. The sandbox starts empty; one call to the seed endpoint fills it with sample mail, and the sandbox-only REST endpoints let you complete scans and simulate the operator; there are no MCP tools for them.

Tools

Every list tool except folders_list takes limit (max 100) and cursor and returns { data, next_cursor, total_count }; pass next_cursor back as cursor to page, as described in Pagination. folders_list returns { data } with every folder. Ids are the same strings the REST API uses, so a mail id from mails_list works with scans_create, and a folder id with mails_move_to_folder.

Tools carry MCP annotations that well-behaved clients act on: read-only tools never change anything, idempotent tools can be safely retried, destructive tools are hard to reverse, and billable tools say so in their description. The server’s instructions also tell the model to confirm with the user before calling a destructive or billable tool.

Mail

ToolWhat it doesNotes
mails_listList mail with filters: folder, free-text search, status, scan statusread-only, paginated
mails_getOne mail item with its scan detailsread-only
mails_mark_readSet read or unreadidempotent
mails_move_to_folderMove a mail item into a folderidempotent
mails_archiveArchive a mail itemidempotent
mails_unarchiveRestore an archived mail itemidempotent
mails_discardRequest shredding of a mail item; mails_undiscard reverses it within 7 daysdestructive
mails_undiscardCancel a pending discardidempotent

Scans

ToolWhat it doesNotes
scans_listList scan and open-and-scan requests; filter by status, type, mail id, or searchread-only, paginated
scans_getOne scan requestread-only
scans_get_fileShort-lived signed download URL for a completed scanread-only
scans_get_summaryAI label and bullet-point summary of a completed scan; 404 while none exists (not completed yet, or the plan has no AI labeling)read-only
scans_createRequest a scan or open-and-scan of a mail itembillable
scans_cancelCancel a scan request that is still in progressidempotent
scans_deleteDelete a scan request and its stored filedestructive

Folders

ToolWhat it doesNotes
folders_listList foldersread-only, not paginated
folders_getOne folderread-only
folders_createCreate a folder
folders_updateRename or recolor a folderidempotent
folders_deleteDelete a folder; its mail is unfiled, not deleteddestructive

Addresses and bank accounts

ToolWhat it doesNotes
addresses_listList shipping and deposit addressesread-only, paginated
addresses_getOne addressread-only
addresses_get_defaultThe default address for a category (shipping or deposit)read-only
addresses_createCreate a shipping or deposit address
addresses_updatePartially update an addressidempotent
addresses_set_defaultMake an address the default for its categoryidempotent
addresses_deleteDelete an addressdestructive
bank_accounts_listList saved bank accounts; account numbers show the last 4 digits onlyread-only, paginated
bank_accounts_getOne bank account, last 4 digits onlyread-only
bank_accounts_createSave a bank account for check deposits
bank_accounts_updateUpdate a saved bank accountidempotent
bank_accounts_deleteDelete a saved bank accountdestructive

Shipments and account

ToolWhat it doesNotes
shipments_listList shipment requests: forwarding, check deposit, return to sender, pickupread-only, paginated
shipments_getOne shipment request with its detail fieldsread-only
account_getThe customer’s account profileread-only
account_get_mailing_addressThe customer’s US Global Mail virtual mailing addressread-only

Creating shipments is not available through MCP yet; use the REST API.

Errors

A tool error wraps the gateway’s problem+json response as Gateway error <status>: <text>. The text is the REST problem’s detail, or its title when it has no detail, followed by each entry of errors as field: message. A response that is not problem+json (a load-balancer error page) reads gateway responded <status>. The common cases:

StatusMeaning for an agent
401No key; a malformed, mistyped or revoked key; a key for the other environment; or an account whose plan does not include API access or whose subscription is inactive. The gateway answers 401 for all of these, and the detail names the key prefix it expects.
404The id does not exist or belongs to another customer; also scans_get_summary while no summary exists.
422Validation failed. The text names each invalid field with its message, for example Your request parameters did not validate. name: Too small: expected string to have >=1 characters.
429Rate limited. The text reads Rate limit exceeded.; back off and retry. The Retry-After header is on the REST response, not in the tool text.
503Authentication is temporarily unavailable; retry shortly.
0The gateway was unreachable or timed out; retry.

Other statuses (400, 403, 409, 502, 504) pass through from the service that owns the resource; the text is that service’s detail when it provides one, else the problem title.

Rate limits are the REST limits, keyed by API key, so an agent shares its budget with any other client using the same key. One key per agent keeps the budgets separate.

Safety and good practice

  • Keep tool approval on. Where your client can ask before each tool runs, leave that on for this server, at least until you trust the agent with the mailbox.
  • The risky tools say so. Shredding, deleting, and paid scans carry the destructive or billable annotation, and the server’s instructions tell the model to confirm with you first; honour both when you build your own client.
  • One key per agent, rotate on suspicion. Revoke or rotate under Settings → Developer → API Keys; a revoked or rotated key stops working immediately.
  • Everything is audited. Settings → Developer → Audit Logs records every change made through the API, with the key that made it, so you can see exactly what an agent did.
  • Know what the agent sees. Scan summaries, scan files, and mail metadata go to the AI client you connected and are handled under its privacy terms. Bank account numbers are never exposed beyond the last four digits.
  • Keys are all-or-nothing. A key has the same access as the account owner; there are no scoped keys and no OAuth consent flow. The sandbox is the place to let an agent loose.

How it works

  • Stateless proxy. Each request builds a fresh MCP server bound to the caller’s Authorization header, forwards tool calls to the gateway over a pooled HTTP client, and discards everything when the response ends. No sessions, no caching, no stored keys.
  • One endpoint, two gateways. The production server holds a client for the live gateway and one for the sandbox gateway, and picks by key prefix per request: usgmk_test_ goes to the sandbox, everything else to production. The gateways themselves are unchanged and still reject a key that does not belong to them.
  • Versioning. initialize reports usgm-public-api-mcp and its version; tool additions are announced through tools/list, and listChanged is advertised.

Troubleshooting

SymptomWhat to check
Every tool fails with Gateway error 401The header must be Authorization: Bearer <key> with a space after Bearer; the key must be active; and the plan must include API access (the API Keys page shows an upgrade banner when it does not).
The agent sees an empty mailboxEither no mail has arrived yet, or the client is using a sandbox key (usgmk_test_…); use the live key for real mail.
The server does not appear in the clientRestart the client after editing its config; in Claude Code run /mcp; in Claude enable it via +.
Claude Desktop local setup fails on WindowsKeep the no-space Authorization:${USGM_AUTH} form with the value in env.
Connection fails on a corporate networkSome networks block outside MCP servers; allow mcp.usglobalmail.com.

Limitations

  • API-key passthrough only; there is no OAuth flow yet, so clients that cannot send a custom header (ChatGPT’s connectors, for example) are not supported.
  • Shipments are read-only through MCP.
  • Tool results are text; binary scan files are fetched through the signed URL from scans_get_file.