MCP

MCP 專欄

安全連接 AI 代理:User MCP 用於營運,Developer MCP 用於整合 — 含 profile、confirm、dry-run 與人工審批。

MCP track_package(tracking_number) Tool
RPC tools/list JSON-RPC 2.0
RPC tools/call JSON-RPC 2.0
Documentation

MCP 專欄概覽

本指南是開發者中心的 Superroute MCP 專欄,涵蓋兩個伺服器、代理安全模型,以及來自 UserMcpToolCatalog 的即時工具目錄。

什麼是 MCP?

模型上下文協議(MCP)是一種開放標準,允許 Claude、Cursor 和 ChatGPT 等 AI 助手與外部工具和服務互動。它使您的 AI 能夠在對話中直接執行實際操作,例如追蹤包裹。

透過設定 Superroute MCP 伺服器,您的 AI 助手無需離開工作流程即可使用物流工具。

兩個 MCP 伺服器

依受眾選擇正確的伺服器。不要給無人值守代理使用具完整權限的 Developer 伺服器。

伺服器名稱 端點 受眾 驗證
superroute https://api.superlabel.ca/mcp 營運 / 客服 / 業務代理 Bearer + 可選 profile/scopes(未設定時相容全量)
superroute-developer https://api.superlabel.ca/mcp/developer 整合開發者與編碼代理 優先連線級 Bearer;tool 參數 api_token 將淘汰

快速開始

包裹追蹤等公開工具無需驗證即可使用。將以下設定加入您的 MCP 客戶端:

JSON
{
  "mcpServers": {
    "super-label": {
      "type": "url",
      "url": "https://api.superlabel.ca/mcp"
    }
  }
}
試試看! 設定完成後,詢問您的 AI 助手:「追蹤包裹 SR100012345」

驗證存取

要使用需要使用者權限的工具,請在設定中加入您的 API Bearer 權杖:

務必把權杖放在 MCP 連線標頭,切勿寫入工具參數或提示詞。

JSON
{
  "mcpServers": {
    "super-label": {
      "type": "url",
      "url": "https://api.superlabel.ca/mcp",
      "headers": {
        "Authorization": "Bearer <your-api-token>",
        "X-MCP-Profile": "ops-readonly"
      }
    }
  }
}

如何取得 API 權杖

使用您的憑證呼叫登入端點:

Bash
curl -X POST https://api.superlabel.ca/api/v1/user/login \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your-password"}'

回應將包含您的存取權杖:

JSON Response
{
  "access_token": "eyJ0eXAiOiJKV1Qi...",
  "token_type": "Bearer",
  "expires_at": "2026-02-20 00:00:00"
}

在 MCP 設定的 Authorization 標頭中使用 access_token 值。

代理安全模型

User MCP 面向最小權限代理。建立 token 時選擇 MCP 設定檔(預設營運唯讀),或透過 header 傳遞 profile/scopes。

設定檔(X-MCP-Profile)

命名的權限包。無人值守代理優先 ops-readonly 或 support。

設定檔 名稱 權限範圍
ops-readonly 營運唯讀 orders:read, labels:read, routes:read, drivers:read, analytics:read, address:read, approvals:read
support 客服(客戶服務) orders:read, analytics:read, address:read, approvals:read
ops-write 營運寫入(訂單 + 託運單 + 路線) orders:read, orders:write, labels:read, labels:write, routes:read, routes:write, drivers:read, analytics:read, address:read, approvals:read, approvals:write
wms-readonly WMS 唯讀 wms:read, orders:read
datasets-readonly 資料集唯讀 datasets:read
alliance-readonly 聯盟唯讀 alliance:read
full 完整存取(全部 MCP 工具)— 不適用於無人值守代理 *
.mcp.json — 建議代理設定
{
  "mcpServers": {
    "super-label": {
      "type": "url",
      "url": "https://api.superlabel.ca/mcp",
      "headers": {
        "Authorization": "Bearer <ops-readonly-token>",
        "X-MCP-Profile": "ops-readonly"
      }
    }
  }
}

可選請求頭

標頭 用途
Authorization: Bearer …API Bearer 權杖(連線級)。
X-MCP-Profile命名設定:ops-readonly、support、ops-write、wms-readonly、datasets-readonly、alliance-readonly、full。
X-MCP-Scopes明確逗號分隔 scopes(覆寫 profile)。
X-MCP-Dry-Run: 1預覽寫入且不落庫。
X-MCP-Require-Approval: 1將高風險寫入入佇等待人工批准,而非立即執行。

高風險確認

以下工具在 tools/call 時需要 confirm=true(或使用審批佇列):

人工審批佇列

無人值守代理應提議寫入;由人在應用內或透過 MCP 批准。

  1. 代理:propose_write 或發送 X-MCP-Require-Approval: 1
  2. 人:開啟 Web 的 MCP 審批,或 list_pending_approvals
  3. 人:approve_pending_write(confirm=true)或 reject_pending_write

Web 介面路徑(需登入): /mcp-approvals

Developer MCP 驗證

優先在連線使用 Authorization: Bearer。依工具傳 api_token 已棄用,將於 2026-12-31 後硬切斷。

可用工具

以下工具目前在 MCP 伺服器上可用: 47 個來自伺服器目錄的即時工具

此表在請求時由 UserMcpToolCatalog 產生,與生產環境認證全量 tools/list 保持同步。

工具 驗證 風險 權限 描述
track_package 公開 low Track a package by its tracking number. Returns delivery status, tracking events timeline, and proof of delivery if available.
otep_tracking 公開 low Get the unified OTEP (Open Tracking Event Protocol) timeline for a tracking number — self-delivery, third-party and carrier events normalize...
get_capabilities 公開 low List MCP tools available to the current connection, with risk level, required scopes, and whether confirm=true is needed. Call this first wh...
get_orders 需要 low orders:read List orders with filtering and pagination. Returns order details including status, tracking, and delivery info.
get_order_detail 需要 low orders:read Get full details of a specific order by ID, including address, status, packages, and tracking info.
find_order 需要 low orders:read Fuzzy-find orders across tracking number, external tracking, ref, recipient name, and phone in a single query. Use this instead of get_order...
get_operation_events 需要 low orders:read Get the full audit trail for orders — every status change, who performed it, GPS coordinates, and photos.
create_order 需要 medium orders:write Create a delivery/pickup order. D=delivery (warehouse→customer), P=pickup (customer→warehouse), P2P=peer-to-peer. Returns order ID and track...
cancel_order confirm 需要 high orders:write Cancel an existing order by order ID. Only works for orders not yet delivered.
bulk_create_orders confirm 需要 high orders:write Create up to 100 delivery orders in one call. Returns a per-order success/failure summary; partial failures do not abort the batch unless st...
reroute_to_address confirm 需要 high orders:write Change the delivery address of an order that has not been picked up yet: cancels the original order and recreates it with the new address. R...
update_delivery_instruction 需要 medium orders:write Update only the delivery_instruction field on an existing order (PATCH). Safer than full order rewrite.
update_order_note 需要 medium orders:write Update only the internal note field on an existing order (PATCH).
update_time_window_by_refs 需要 medium orders:write Bulk-update delivery time windows (and optional schedule_date) for orders identified by external refs.
hold_order confirm 需要 high orders:write Put an order on HOLD so it is not dispatched until release_order. HIGH-RISK: requires confirm=true.
release_order confirm 需要 high orders:write Release an order from HOLD back to NEW_ORDER. HIGH-RISK: requires confirm=true.
propose_write 需要 low approvals:read Queue a write/high-risk tool for human approval instead of executing it. Reviewers use list_pending_approvals + approve_pending_write.
list_pending_approvals 需要 low approvals:read List pending MCP write approvals for this business (or mine_only).
approve_pending_write confirm 需要 high approvals:write Approve and execute a pending write proposal. HIGH-RISK: requires confirm=true. Reviewer must have scopes for the underlying tool.
reject_pending_write 需要 medium approvals:write Reject a pending write proposal without executing it.
get_routes 需要 low routes:read List delivery routes with their status, assigned driver, and order count.
get_route_detail 需要 low routes:read Get one route with its stop/order list. Prefer this over get_routes when you already know route_id.
get_drivers 需要 low drivers:read List drivers for the authenticated business (ids, names, capacity defaults). Use driver id with get_driver_routes_today or route tools.
get_driver_routes_today 需要 low routes:read, drivers:read Orders assigned to a driver on a given date (defaults to today). Useful for "what is driver X running today?"
get_build_route_options 需要 low routes:read List routing engines, balance modes, capacity types, and defaults before calling build_route.
build_route confirm 需要 high routes:write Build/optimize a delivery route (POST /api/v3/client/build-route). HIGH-RISK: assigns orders to drivers. Call get_build_route_options first....
order_snapshot 需要 low orders:read One-call order context for support: order detail + operation events + public tracking (when tracking number is known). Pass order_id or trac...
list_exceptions 需要 low orders:read List failed/returned/exception-like orders for a schedule date (default today). Read-only ops triage helper.
get_shipping_methods 需要 low labels:read List available shipping carriers/methods. Returns IDs and names — use the ID for rate/label tools.
get_shipping_rate 需要 low labels:read Get a shipping cost quote. Dry-run — no label created. Returns rate options with pricing and transit time.
create_shipping_label 需要 medium labels:write Book a shipment with a carrier and generate a shipping label with tracking numbers.
quote_and_ship 需要 medium labels:write One-shot: rate across all enabled carriers, pick the best one by strategy, create the shipping label, return tracking number. Saves 3+ tool...
compare_all_carriers 需要 low labels:read Get rate quotes from every enabled carrier for the same shipment, in one call. Returns a sorted comparison (cheapest first) with price + tra...
search_address 需要 low address:read Search and resolve addresses by postal code or free-text query. Returns structured address suggestions.
daily_digest 需要 low analytics:read One-call summary of today's logistics activity: total orders, by status, exceptions (failed/returned), pending pickups. Designed as the firs...
get_orders_summary 需要 low analytics:read Aggregate order metrics over a time window: counts by status, top carriers, on-time rate, exception count. Use period=today|week|month or pa...
get_account_credits 需要 low analytics:read Get the authenticated customer's wallet balance, currency, and recent topup history. Customer (B2C) accounts only — returns an error for cli...
get_warehouses 需要 low wms:read List WMS warehouses available to the authenticated business.
get_inventory 需要 low wms:read Query WMS inventory (POST /api/v1/wms/inventory). Pass filters supported by the inventory API (sku, warehouse_id, etc.).
list_datasets 需要 low datasets:read List custom datasets available to the business.
get_dataset 需要 low datasets:read Get one dataset by id (metadata/columns).
list_dataset_groups 需要 low datasets:read List groups inside a dataset.
search_dataset_records 需要 low datasets:read Search records across groups in a dataset (POST .../search).
list_alliances 需要 low alliance:read List alliances the authenticated business belongs to.
get_alliance 需要 low alliance:read Get one alliance by id.
list_alliance_members 需要 low alliance:read List members of an alliance.
list_accessible_clients 需要 low alliance:read List clients accessible via alliance partnerships.

客戶端設定

選擇您的 AI 客戶端以取得相應的設定說明:

Claude Code

Claude Code 從專案根目錄或主目錄中的 .mcp.json 檔案讀取 MCP 設定。

  1. 在專案根目錄建立 .mcp.json 檔案(或 ~/.claude/.mcp.json 用於全域存取)。
  2. 加入以下設定:
.mcp.json
{
  "mcpServers": {
    "super-label": {
      "type": "url",
      "url": "https://api.superlabel.ca/mcp"
    }
  }
}

要使用驗證工具,請加入 headers 欄位:

.mcp.json (含驗證)
{
  "mcpServers": {
    "super-label": {
      "type": "url",
      "url": "https://api.superlabel.ca/mcp",
      "headers": {
        "Authorization": "Bearer <your-api-token>",
        "X-MCP-Profile": "ops-readonly"
      }
    }
  }
}

Cursor

Cursor 透過內建設定支援 MCP 伺服器。

  1. 在專案根目錄建立 .cursor/mcp.json 檔案。
  2. 加入以下設定:
  3. 重新啟動 Cursor 以載入新的 MCP 伺服器。
.cursor/mcp.json
{
  "mcpServers": {
    "super-label": {
      "type": "url",
      "url": "https://api.superlabel.ca/mcp"
    }
  }
}

Windsurf

Windsurf 使用全域 MCP 設定檔案。

  1. 編輯 ~/.codeium/windsurf/mcp_config.json(如果不存在則建立)。
  2. 加入以下設定:
~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "super-label": {
      "serverUrl": "https://api.superlabel.ca/mcp"
    }
  }
}

ChatGPT

ChatGPT 為 Plus、Pro 和 Team 使用者支援 MCP 連線。

  1. 開啟 ChatGPT 並進入設定。
  2. 導覽至「已連線的應用程式」或「工具」區段。
  3. 新增 MCP 伺服器,使用上方顯示的端點 URL。
ChatGPT 的 MCP 支援可能因您的方案和地區而異。請參閱 OpenAI 文件取得最新說明。

技術細節