Skip to content
Cargo Marshal
Esc
↑↓navigate↵open⌘Jpreview
On this page

Connect an agent

Let an AI agent search Projects, import Cargo Lines, calculate Load Plans, and share the result through the Cargo Marshal MCP server.

The Cargo Marshal MCP server lets an AI agent in Claude Code, Cursor, or VS Code do what the persistence API does: find a Project, import Cargo Lines, calculate a Load Plan, and mint a Share Link. You connect it by signing in with OAuth, or with an organization API key. Either way it has the same limits as the REST API. This page covers the product server. To search these docs from an agent, use the documentation server at https://docs.cargomarshal.com/mcp.

Before you begin

  • The organization must be on the Enterprise plan. This applies to OAuth and to API keys. Every other plan receives 403 with error: "access_denied" and reason: "plan_required", and the message says to upgrade to Enterprise.
  • To sign in with OAuth, you need a Cargo Marshal account in the organization. Your role decides what the agent may do: Owners, Admins, and Planners can grant Read and Write, and Viewers can grant Read only.
  • To use an API key instead, an owner or admin creates one under Settings → API keys. The secret starts with sc_live_ and is shown once. Read only allows the read tools. Read & write also allows the tools that create or change data.

Every call acts on your real organization. There are no test accounts or test keys, so try a new agent on a throwaway Project.

Endpoint

The server speaks stateless Streamable HTTP at https://www.cargomarshal.com/mcp. A request without credentials answers 401 with a WWW-Authenticate header that points to the server’s protected resource metadata. A client that supports MCP authorization reads it and starts the OAuth sign-in on its own. A client without OAuth support sends an API key on every request:

Authorization: Bearer sc_live_…

A missing, revoked, or expired key or access token answers 401.

Connect with OAuth

  1. Add the server URL to the client without an Authorization header.
  2. The client opens Cargo Marshal in your browser. Sign in.
  3. If you belong to more than one organization, choose the one the agent works in. The connection stays in that organization. The organization you see in the web app does not change.
  4. Review the access the app asks for and allow it. Read allows the read tools. Write also allows the tools that create or change data.

The agent acts as you. The audit log shows its changes under your name and the app’s name, for example “Alex Admin via Claude”, with a Connected app badge. Cargo Marshal checks your membership and your role on every request. If you leave the organization, the agent loses access at its next call. If your role no longer allows editing, the agent keeps only Read. Access tokens last 10 minutes, and the client refreshes them without asking you again.

Add the server to your client

Claude Code

To sign in with OAuth, add the server without a header, then run /mcp in Claude Code and choose the server to authenticate:

claude mcp add --transport http cargo-marshal https://www.cargomarshal.com/mcp

To use an API key, pass it as a header:

claude mcp add --transport http cargo-marshal https://www.cargomarshal.com/mcp \
  --header "Authorization: Bearer sc_live_…"

Run claude mcp list to check that the server connects. Add --scope user to use it in every project. With --scope project the entry is written to .mcp.json, which you share through source control, so do not put the key in it. Pass --header 'Authorization: Bearer ${CARGO_MARSHAL_API_KEY}' in single quotes instead, and Claude Code reads the key from that environment variable when it starts.

Cursor

Add the server to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project you keep out of source control:

{
  "mcpServers": {
    "cargo-marshal": {
      "url": "https://www.cargomarshal.com/mcp",
      "headers": {
        "Authorization": "Bearer ${env:CARGO_MARSHAL_API_KEY}"
      }
    }
  }
}

Export CARGO_MARSHAL_API_KEY before you start Cursor, then restart Cursor. To sign in with OAuth instead, leave out headers.

VS Code

Add the server to .vscode/mcp.json. To sign in with OAuth, give only type and url. To use an API key, VS Code asks for it once and keeps it out of the file:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "cargo-marshal-key",
      "description": "Cargo Marshal API key",
      "password": true
    }
  ],
  "servers": {
    "cargo-marshal": {
      "type": "http",
      "url": "https://www.cargomarshal.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:cargo-marshal-key}"
      }
    }
  }
}

Tools

Tool Scope Does
search_projects Read Finds Projects by name, customer, reference, destination, or Cargo Line name
get_project Read Reads a Project and a header per Load Plan
list_cargo_lines Read Pages through a Project’s Cargo Lines
get_load_plan Read Summarizes a calculated Load Plan
get_calculate_status Read Reads a calculate run
list_equipment Read Lists Equipment Types, built-in Sea and Road included
search_cargo_library Read Searches the Cargo Library
create_project Read & write Creates a Project
import_cargo_lines Read & write Appends Cargo Lines to a Project in one transaction
create_load_plan Read & write Creates a Load Plan on a Project
set_load_plan_equipment Read & write Sets the Equipment Types a Load Plan loads onto
calculate_load_plan Read & write Calculates a Load Plan and replaces the previous result
create_share_link Read & write Mints a view-only Share Link

A read-only key or connection that calls a write tool gets an error before anything changes. Dimensions are in millimetres and weights in grams, as in the REST API. get_load_plan returns a summary per Unit, not the placement of every piece. Read the stored placements through the REST API.

Calculate and wait

calculate_load_plan waits up to about 20 seconds. If the calculate finishes, the tool returns the same summary as get_load_plan. If it is still running, the tool returns a calculate id. Call get_calculate_status with it until the status is completed, then call get_load_plan.

Send expected_revision from get_load_plan or create_load_plan with every change to a Load Plan. A stale revision is rejected, so the agent cannot overwrite work from another person.

Retries and idempotency

Every tool that creates data, and calculate_load_plan, takes an optional idempotency_key. Pass the same idempotency_key on a retry so the call does not run twice, for example so import_cargo_lines does not append the lines again. The rules match the REST API. A replayed create_share_link returns the link with url set to null, because the secret is shown once. Call it again with a new idempotency_key to mint a fresh link.

The server shares the REST API’s rate limits. An API key and an OAuth connection, one app for one person, each get 120 requests per minute and 30 calculates per 10 minutes. After a 429, wait the Retry-After seconds before you retry.

Revoke access

Rotate or revoke the key under Settings → API keys. The agent loses access at once.

An OAuth connection ends when you leave the organization: the agent loses access at its next call, and the app can no longer refresh its token. To stop one app, remove the server from that client.

Was this page helpful?