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

# Terminal49 MCP server quickstart

> Set up the Terminal49 MCP server in Claude, ChatGPT, Cursor, Copilot, or any MCP client to query live shipment and container tracking data from your AI tool.

This guide covers everything you need to connect an MCP client to Terminal49's container tracking data.

> [!NOTE]
>
> Just want to get started fast? See the per-tool setup guides for [Claude](https://terminal49.com/docs/mcp/setup/claude.md), [Claude Code](https://terminal49.com/docs/mcp/setup/claude-code.md), [ChatGPT](https://terminal49.com/docs/mcp/setup/chatgpt.md), [Cursor](https://terminal49.com/docs/mcp/setup/cursor.md), [Microsoft Copilot](https://terminal49.com/docs/mcp/setup/microsoft-copilot.md), [VS Code](https://terminal49.com/docs/mcp/setup/vs-code.md), [Gemini](https://terminal49.com/docs/mcp/setup/gemini.md), and [Antigravity](https://terminal49.com/docs/mcp/setup/antigravity.md), or the [MCP Overview](https://terminal49.com/docs/mcp/home.md) for a 5-minute setup.

## Prerequisites

Before you begin, make sure you have:

> [card] Terminal49 account
>
> You sign in with your Terminal49 credentials during the OAuth flow — no API key needed

> [card] API key (optional)
>
> Only needed for clients without OAuth support or the local stdio server — create one in the [developer portal](https://app.terminal49.com/developers/api-keys)

> [card] Node.js 24.x
>
> Required if running the MCP server locally

> [card] MCP client
>
> Claude, ChatGPT, Cursor, Microsoft Copilot, VS Code, Gemini, Antigravity, or any MCP-compatible client

**Technical Details:**

* **MCP SDK**: `@modelcontextprotocol/sdk ^1.29.0`
* **TypeScript SDK**: `@terminal49/sdk 0.3.0`
* **Sentry MCP Monitoring**: `@sentry/node ^10.55.0` (optional)
* **Runtime**: Node.js 24.x

***

## Transports

| Transport | Endpoint | Best For |
| - | - | - |
| HTTP (streamable) | `POST https://mcp.terminal49.com` | Serverless, short-lived requests |

**Authentication**: OAuth 2.1 (recommended) or API key.

* **OAuth 2.1** – no API key needed. Add `https://mcp.terminal49.com` to your client; it discovers the authorization server (`https://auth.terminal49.com`) via protected resource metadata, registers itself with Dynamic Client Registration, and opens your browser so you can sign in with your Terminal49 credentials. Tokens are stored and refreshed by the client.
* **API key** – for clients that can't run a browser OAuth flow, pass `Authorization: Token YOUR_API_KEY`. Use the `Token` scheme for API keys; the `Bearer` scheme is used for OAuth access tokens, which OAuth clients obtain automatically.

Only the [local stdio server](#local-stdio-development) reads the `T49_API_TOKEN` environment variable instead of a header.

> [!TIP]
>
> For hosted production usage, connect to `https://mcp.terminal49.com`. The root origin is the canonical connector URL and OAuth resource identifier.

***

## Observability

The MCP server supports optional [Sentry MCP Monitoring](https://docs.sentry.io/ai/monitoring/mcp/). Set `SENTRY_DSN` to capture MCP server connections, tool executions, resource access, prompts, performance spans, and errors in Sentry.

```bash theme={null}
SENTRY_DSN=___PUBLIC_DSN___
SENTRY_TRACES_SAMPLE_RATE=1.0
SENTRY_MCP_RECORD_INPUTS=false
SENTRY_MCP_RECORD_OUTPUTS=false
SENTRY_SEND_DEFAULT_PII=false
```

> [!WARNING]
>
> `SENTRY_MCP_RECORD_INPUTS` and `SENTRY_MCP_RECORD_OUTPUTS` are disabled by default because MCP payloads can include shipment identifiers, references, and customer data. Enable them only if your Sentry project is approved for that data.

***

## Configure your MCP client

### OAuth setup (recommended)

Most clients connect with just the server URL and a browser sign-in — no API key. Follow the guide for your tool:

* [Claude](https://terminal49.com/docs/mcp/setup/claude.md) – claude.ai and Claude Desktop
* [Claude Code](https://terminal49.com/docs/mcp/setup/claude-code.md) – one `claude mcp add` command
* [ChatGPT](https://terminal49.com/docs/mcp/setup/chatgpt.md) – install from the ChatGPT Plugins Directory
* [Cursor](https://terminal49.com/docs/mcp/setup/cursor.md) – `mcp.json` or Cursor Settings → MCP
* [Microsoft Copilot](https://terminal49.com/docs/mcp/setup/microsoft-copilot.md) – Copilot Studio agent tools
* [VS Code](https://terminal49.com/docs/mcp/setup/vs-code.md) – GitHub Copilot agent mode
* [Gemini](https://terminal49.com/docs/mcp/setup/gemini.md) – Gemini app custom apps (personal Google accounts)
* [Antigravity](https://terminal49.com/docs/mcp/setup/antigravity.md) – Google Antigravity
* [Agent plugins](https://terminal49.com/docs/mcp/setup/agent-plugins.md) – Terminal49 plugin for Claude Code, Cursor, Codex, and GitHub Copilot CLI
* [Other MCP clients](https://terminal49.com/docs/mcp/setup/other-clients.md) – generic configuration

The manual configurations below use an API key instead. Use them for clients or environments where the browser OAuth flow isn't practical.

> [!WARNING]
>
> claude.ai and Claude Desktop cannot send a static API-key header — they always authenticate through the OAuth connector flow. Follow the [Claude setup guide](https://terminal49.com/docs/mcp/setup/claude.md) to connect them. For API-key-based local development in Claude Desktop, use the [local stdio server](#local-stdio-development) below instead.

### Cursor IDE (manual, API key)

Add to `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` for all projects):

```json theme={null}
{
  "mcpServers": {
    "terminal49": {
      "url": "https://mcp.terminal49.com",
      "headers": {
        "Authorization": "Token YOUR_API_KEY"
      }
    }
  }
}
```

### Local stdio (development)

`@terminal49/mcp` is a private workspace in this repository. Build it from a clone when you want a local stdio process instead of the hosted server. Use Node.js 24.22.1 or a newer Node 24 release (`.tool-versions` pins `24.22.1`).

```bash theme={null}
git clone https://github.com/Terminal49/API.git
cd API
npm ci
npm run build --workspace @terminal49/sdk
npm run build --workspace @terminal49/mcp
```

The stdio entrypoint is `packages/mcp/dist/index.js`. It reads `T49_API_TOKEN` and exits if that variable is unset. Create the key in the [developer portal](https://app.terminal49.com/developers/api-keys).

```json theme={null}
{
  "mcpServers": {
    "terminal49": {
      "command": "node",
      "args": ["/absolute/path/to/API/packages/mcp/dist/index.js"],
      "env": {
        "T49_API_TOKEN": "YOUR_API_KEY"
      }
    }
  }
}
```

The MCP server depends on the workspace package `@terminal49/sdk`. The build above compiles that package first.

***

## Test your setup

Once configured, verify everything works:

**1. Restart your MCP client**

Close and reopen Claude Desktop or Cursor to load the new config.

**2. Ask Claude to list tools**

> "List the tools available in the Terminal49 MCP server."

Claude should respond with a list of 31 tools including `search_container`, `track_container`, the list tools, and the trade intelligence tools.

**3. Search for a test container**

> "Using the Terminal49 MCP server, search for container TCLU1234567 and summarize its status."

If configured correctly, Claude will call `search_container` and return container details.

**4. Try a multi-step query**

> "Using Terminal49, find container CAIU1234567, check its demurrage risk, and tell me if I need to pick it up urgently."

Claude should chain multiple tools together to answer.

> [!NOTE]
>
> Need test container numbers? See [Test Numbers](https://terminal49.com/docs/api-docs/useful-info/test-numbers.md) for containers you can use during development.

***

## Troubleshooting

| Symptom | Likely Cause | How to Fix |
| - | - | - |
| "Cannot connect to MCP server" | Wrong URL or config path | Confirm URL is `https://mcp.terminal49.com` and config file path matches your OS |
| `401 Unauthorized` | Expired OAuth session, or missing/invalid API key | Disconnect and reconnect the connector to re-run the OAuth sign-in. If using an API key, create a new one in the [developer portal](https://app.terminal49.com/developers/api-keys) and ensure the `Authorization: Token YOUR_API_KEY` header is set |
| `429 Too Many Requests` | Rate limit exceeded | See [Rate Limiting](https://terminal49.com/docs/api-docs/in-depth-guides/rate-limiting.md); use webhooks instead of polling |
| Tools list is empty | Config not loaded | Restart Claude/Cursor; check MCP inspector for errors |
| "Tool not found" | Typo in tool name | Use exact names: `search_container`, `get_container`, etc. |
| Slow responses | Large data requests | Use `include` parameter to load only what you need |

> [accordion] Check MCP server logs
>
> If using the hosted server, check your Terminal49 dashboard for API logs.
>
> If running locally, from the repository root after the build above:
>
> ```bash theme={null}
> printf '%s\n' \
>   '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"1.0"}}}' \
>   '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
>   '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
>   | T49_API_TOKEN=YOUR_API_KEY node packages/mcp/dist/index.js
> ```

***

## MCP capabilities

### Tools

| Tool | Description | Parameters |
| - | - | - |
| `search_container` | Find containers by number, BL, booking, or ref | `query: string` |
| `track_container` | Start tracking a container | `number`, `numberType?`, `scac?`, `refNumbers?` |
| `identify_tracking_number` | Predict a number's type and carrier, and check whether it is already tracked, without tracking it | `number: string` |
| `get_container` | Get container with optional includes | `id: uuid`, `include?: ['shipment', 'pod_terminal', 'transport_events', 'custom_fields', 'party_roles']` |
| `get_shipment_details` | Get shipment and containers | `id: uuid`, `include_containers?: boolean`, `include_custom_fields?: boolean`, `include_party_roles?: boolean` |
| `get_container_transport_events` | Get event timeline | `id: uuid` |
| `get_supported_shipping_lines` | List carriers with SCAC codes | `search?: string` |
| `get_container_route` | Get ports in route order with ETAs and the current vessel (paid feature) | `id: uuid` |
| `get_location` | Get a port, terminal, or metro area | `kind` (`port`, `terminal`, or `metro_area`), `id` (UUID, or a UN/LOCODE for a port or metro area) |
| `get_vessel` | Get a vessel's position and, optionally, its projected arrival at a port (projection is a paid feature) | `id: uuid`, `eta_to?: { port_id, previous_port_id, latitude?, longitude? }` |
| `list_shipments` | List shipments with filters + pagination | `number?`, `tracking_stopped?`, `actively_tracked?`, `voyage_status?`, `pod_code?`, `pol_code?`, `pod_arrival?`, `created_at?`, `tags?`, `advanced_filters?`, `include_stopped_tracking?`, `sort?`, `include_containers?`, `page?`, `page_size?` |
| `list_containers` | List containers with filters + pagination | `number?`, `current_status?`, `pod_code?`, `pol_code?`, `shipping_line_scac?`, `has_holds?`, `has_fees?`, `requires_attention?`, `actively_tracked?`, `arrival?`, `pickup_lfd?`, `tags?`, `advanced_filters?`, `include_stopped_tracking?`, `sort?`, `include?: ['shipment', 'pod_terminal']`, `view?`, `page?`, `page_size?` |
| `summarize_containers` | Count containers grouped by one dimension | `group_by` (`pod_terminal`, `current_status`, `shipping_line`, `port_of_discharge`, `hold_type`, `pickup_lfd_date`, or `pod_arrival_date`), plus the `list_containers` filters except `sort`, `include`, `view`, `page`, and `page_size` |
| `list_parties` | Find parties by company name, or read one by ID | `id?`, `search?`, `limit?` (default 25, maximum 50) |
| `list_custom_field_definitions` | List the account's custom fields, their types, and enum options | `entity_type?` (`container` or `shipment`), `include_archived?: boolean` |
| `list_tracking_requests` | List tracking requests with filters | `request_number?`, `status?` (`pending`, `created`, `failed`, or `cancelled`), `scac?`, `page?`, `page_size?` |
| `get_tracking_request` | Get one tracking request's status, failure reason, and shipment | `id: uuid`, `include_custom_fields?: boolean` |
| `list_documents` | Find documents such as Bills of Lading and arrival notices; rows never include extracted data or file links | `filename?`, `reference?`, `document_types?`, `sort?`, `page?`, `page_size?`, `include_types?: boolean` |
| `get_document` | Get one document, with opt-in extracted data and source email (both labeled untrusted) and a download link returned as a `resource_link` | `id: uuid`, `include_extracted_data?: boolean`, `include_source_email?: boolean`, `include_download_url?: boolean` |
| `search_docs` | Search the public Terminal49 documentation | `query: string`, `limit?` (1-10, default 5) |
| `whoami` | Identify the credential, its account, available features, and the session's toolsets | none |

The `operations` toolset adds `set_party_role` and `set_custom_field` and is in the default toolsets. Send `X-T49-MCP-Toolsets: core,documents,trade` to leave them out. The `tracking_lifecycle` toolset adds `stop_shipment_tracking`, `resume_shipment_tracking` and `cancel_tracking_request`; a deployment serves it only when `T49_MCP_TOOLSETS` lists it.

| Tool | Description | Parameters |
| - | - | - |
| `stop_shipment_tracking` | Stop updates for a shipment and its containers. Asks you to approve a preview first. | `shipment_id: uuid`, `confirmation_token?: string` |
| `resume_shipment_tracking` | Start tracking a stopped shipment again | `shipment_id: uuid` |
| `cancel_tracking_request` | Cancel a pending tracking request. Asks you to approve a preview first. It cannot be undone. | `tracking_request_id: uuid`, `confirmation_token?: string` |
| `set_party_role` | Attach, replace, or detach a party on up to 50 containers or shipments. `add` runs at once; `remove`, and a `replace` that detaches another party, ask you to approve a preview of every record that changes. | `container_ids?` or `shipment_ids?` (1 to 50), `role`, `party_id: uuid`, `action` (`add`, `replace`, or `remove`), `confirmation_token?: string` |
| `set_custom_field` | Set or clear a custom field on up to 50 containers or shipments. Filling empty fields runs at once; overwriting or clearing a value asks you to approve a preview of every record that changes. | `entity` (`container` or `shipment`), `ids` (1 to 50), `api_slug`, `value` (string, number, boolean, string array, or `null` to clear), `confirmation_token?: string` |

See [Write tools](https://terminal49.com/docs/mcp/home.md#write-tools) for how you approve a preview, in a client that asks you directly or with a confirmation token.

### Prompts

| Prompt | Description | Arguments |
| - | - | - |
| `track-shipment` | Quick tracking workflow | `container_number`, `carrier?` |
| `check-demurrage` | Demurrage risk analysis | `container_id` |
| `analyze-delays` | Journey delay analysis | `container_id` |

### Resources

| URI | Description |
| - | - |
| `terminal49://container/{id}` | Container data as resource |
| `terminal49://docs/milestone-glossary` | Event/milestone reference |
| `terminal49://docs/mcp-query-guidance` | Playbooks that map common container questions to tools and output shape |
| `terminal49://docs/list-display-columns` | Column catalog for `list_containers`, `list_shipments`, and `list_tracking_requests` results. The list tools point to it through `column_catalog_resource`. |

For detailed examples and response formats, see [MCP Overview → Tools Reference](https://terminal49.com/docs/mcp/home.md#tools-reference).

***

## SDK usage

The TypeScript SDK provides the same capabilities as MCP tools, plus additional APIs not yet exposed via MCP.

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

```typescript theme={null}
import { Terminal49Client } from '@terminal49/sdk';

const client = new Terminal49Client({
  apiToken: process.env.T49_API_TOKEN!,
  defaultFormat: 'mapped'
});

// Get container with shipment and terminal
const container = await client.containers.get(
  'container-uuid',
  ['shipment', 'pod_terminal']
);

// Search for containers
const results = await client.search('CAIU1234567');

// List shipments still on the vessel to Los Angeles
const shipments = await client.shipments.list({
  voyage_status: 'on_ship',
  pod_code: 'USLAX'
});
```

### Response formats

| Format | Description |
| - | - |
| `raw` | JSON:API response with `data`, `attributes`, `relationships` |
| `mapped` | Simplified, camelCase objects with IDs resolved |
| `both` | `{ raw, mapped }` for debugging |

> [accordion] Raw vs Mapped example
>
> **Raw format:**
>
> ```json theme={null}
> {
>   "data": {
>     "type": "container",
>     "id": "abc-123",
>     "attributes": {
>       "number": "CAIU1234567",
>       "available_for_pickup": true
>     }
>   }
> }
> ```
>
> **Mapped format (abridged):**
>
> ```json theme={null}
> {
>   "id": "abc-123",
>   "number": "CAIU1234567",
>   "location": {
>     "availableForPickup": true
>   }
> }
> ```

***

## Deployment

### Vercel (production)

The `vercel.json` configures the MCP server (excerpt):

```json theme={null}
{
  "installCommand": "npm ci",
  "buildCommand": "npm run build --workspace @terminal49/sdk && npm run build --workspace @terminal49/mcp",
  "functions": {
    "api/mcp.ts": { "maxDuration": 30 }
  },
  "rewrites": [
    { "source": "/mcp", "destination": "/api/mcp" },
    { "source": "/", "destination": "/api/mcp" }
  ]
}
```

### Environment variables

| Variable | Required | Description |
| - | - | - |
| `T49_API_TOKEN` | For local stdio | Terminal49 API key. The hosted HTTP endpoint authenticates callers via the `Authorization` header instead |
| `T49_API_BASE_URL` | No | Override API URL (default: `https://api.terminal49.com/v2`) |
| `T49_MCP_ALLOWED_HOSTS` | No | Comma-separated host allowlist for request Host validation |
| `T49_MCP_ALLOWED_ORIGINS` | No | Comma-separated origin allowlist for request Origin validation |
| `T49_MCP_TOOLSETS` | No | Comma-separated toolsets the server allows; defaults to `core,documents,operations,trade`. An unknown name or a value made only of commas stops stdio and fails HTTP requests |
| `T49_MCP_READ_ONLY` | No | Serves only read-only tools when set to `true` or `1`; defaults to `false` |
| `T49_MCP_ALLOW_SHARED_TOKEN_WRITES` | No | Serves toolsets other than `core` and `trade` when callers share `T49_API_TOKEN`; defaults to `false` |
| `T49_MCP_CONFIRMATION_SECRET` | For write tools over HTTP | Signs the preview approvals that `stop_shipment_tracking`, `cancel_tracking_request`, and a destructive `set_party_role` or `set_custom_field` call need, on both the elicitation and the token channel. Use at least 32 random characters. Without it, those tools change nothing over HTTP. Local stdio makes a random secret when it is unset |
| `SENTRY_DSN` | No | Enables Sentry MCP Monitoring |
| `SENTRY_ENVIRONMENT` | No | Sentry environment name; defaults to `NODE_ENV` |
| `SENTRY_RELEASE` | No | Sentry release identifier; defaults to `VERCEL_GIT_COMMIT_SHA` |
| `SENTRY_TRACES_SAMPLE_RATE` | No | Trace sampling rate from `0` to `1`; defaults to `1.0` |
| `SENTRY_MCP_RECORD_INPUTS` | No | Records MCP inputs in Sentry when set to `true`; defaults to `false` |
| `SENTRY_MCP_RECORD_OUTPUTS` | No | Records MCP outputs in Sentry when set to `true`; defaults to `false` |
| `SENTRY_SEND_DEFAULT_PII` | No | Enables Sentry default PII behavior; defaults to `false` |

Clients can remove tools per request with the `X-T49-MCP-Toolsets` and `X-T49-MCP-Read-Only` headers. A header can only narrow what the env allows. See [Limit the tools](https://terminal49.com/docs/mcp/home.md#limit-the-tools).

***

## Testing locally

```bash theme={null}
# Build the MCP server from a clone (Node.js 24.22.1 or a newer Node 24 release)
git clone https://github.com/Terminal49/API.git
cd API
npm ci
npm run build --workspace @terminal49/sdk
npm run build --workspace @terminal49/mcp

# initialize, then tools/list, on the built stdio entrypoint
printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"smoke","version":"1.0"}}}' \
  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
  | T49_API_TOKEN=YOUR_API_KEY node packages/mcp/dist/index.js

# Test the hosted endpoint
curl -X POST https://mcp.terminal49.com \
  -H "Authorization: Token $T49_API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2025-06-18" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
```

***

## Related guides

* [MCP Overview](https://terminal49.com/docs/mcp/home.md) — Quick start and tools reference
* Setup guides: [Claude](https://terminal49.com/docs/mcp/setup/claude.md), [Claude Code](https://terminal49.com/docs/mcp/setup/claude-code.md), [ChatGPT](https://terminal49.com/docs/mcp/setup/chatgpt.md), [Cursor](https://terminal49.com/docs/mcp/setup/cursor.md), [Microsoft Copilot](https://terminal49.com/docs/mcp/setup/microsoft-copilot.md), [VS Code](https://terminal49.com/docs/mcp/setup/vs-code.md), [Gemini](https://terminal49.com/docs/mcp/setup/gemini.md), [Antigravity](https://terminal49.com/docs/mcp/setup/antigravity.md), [Agent plugins](https://terminal49.com/docs/mcp/setup/agent-plugins.md), [Other clients](https://terminal49.com/docs/mcp/setup/other-clients.md)
* [Rate Limiting](https://terminal49.com/docs/api-docs/in-depth-guides/rate-limiting.md) — API limits (same for MCP)
* [Test Numbers](https://terminal49.com/docs/api-docs/useful-info/test-numbers.md) — Containers for testing
* [Webhooks](https://terminal49.com/docs/api-docs/in-depth-guides/webhooks.md) — Real-time updates
* [Data Coverage](https://terminal49.com/docs/coverage/home.md) — Data freshness and coverage


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