# How to integrate Shipengine MCP with Claude Agent SDK

```json
{
  "title": "How to integrate Shipengine MCP with Claude Agent SDK",
  "toolkit": "Shipengine",
  "toolkit_slug": "shipengine",
  "framework": "Claude Agent SDK",
  "framework_slug": "claude-agents-sdk",
  "url": "https://composio.dev/toolkits/shipengine/framework/claude-agents-sdk",
  "markdown_url": "https://composio.dev/toolkits/shipengine/framework/claude-agents-sdk.md",
  "updated_at": "2026-05-12T10:25:50.365Z"
}
```

## Introduction

This guide walks you through connecting Shipengine to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working Shipengine agent that can generate shipping label for new order, track status of outgoing packages, validate customer address before shipping through natural language commands.
This guide will help you understand how to give your Claude Agent SDK agent real control over a Shipengine account through Composio's Shipengine MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Shipengine with

- [OpenAI Agents SDK](https://composio.dev/toolkits/shipengine/framework/open-ai-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/shipengine/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/shipengine/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/shipengine/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/shipengine/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/shipengine/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/shipengine/framework/cli)
- [Google ADK](https://composio.dev/toolkits/shipengine/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/shipengine/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/shipengine/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/shipengine/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/shipengine/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/shipengine/framework/crew-ai)

## TL;DR

Here's what you'll learn:
- Get and set up your Claude/Anthropic and Composio API keys
- Install the necessary dependencies
- Initialize Composio and create a Tool Router session for Shipengine
- Configure an AI agent that can use Shipengine as a tool
- Run a live chat session where you can ask the agent to perform Shipengine operations

## What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.
Key features include:
- Native MCP Support: Built-in support for Model Context Protocol servers
- Permission Modes: Control tool execution permissions
- Streaming Responses: Real-time response streaming for interactive applications
- Context Manager: Clean async context management for sessions

## What is the Shipengine MCP server, and what's possible with it?

The Shipengine MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Shipengine account. It provides structured and secure access to your shipping operations, so your agent can perform actions like generating shipping labels, tracking packages, validating addresses, and managing carrier integrations on your behalf.
- Automated label creation and management: Instantly generate, purchase, and void shipping labels across multiple carriers, letting your agent streamline fulfillment without manual entry.
- Real-time package tracking: Ask your agent to track shipments by carrier or tracking number to get up-to-date delivery statuses and shipment histories.
- Address validation and correction: Have your agent validate and standardize shipment addresses to prevent delivery errors and reduce returns.
- Carrier rate comparison: Enable your agent to fetch and compare real-time shipping rates from all connected carriers, helping you save on delivery costs.
- Shipping manifest and batch processing: Let your agent generate manifests or process batches of shipments in a single command, making high-volume shipping fast and efficient.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `SHIPENGINE_ADD_TAG_TO_SHIPMENT` | Add Tag to Shipment | Tool to add a tag to a shipment for organization and filtering. Use when you need to categorize or label a shipment. |
| `SHIPENGINE_ADD_TO_BATCH` | Add to Batch | Tool to add shipments or rate IDs to an existing batch. Use when you need to add items to a batch after the batch has been created. At least one of shipment_ids or rate_ids must be provided. |
| `SHIPENGINE_CANCEL_SHIPMENT` | Cancel Shipment | Tool to cancel a shipment by ID. Use when you need to cancel a shipment that has been created but not yet shipped. Note that once a shipment is in transit, it may not be cancellable depending on carrier policies. |
| `SHIPENGINE_CONNECT_LTL_CARRIER` | Connect LTL Carrier | Tool to connect an LTL carrier account to ShipEngine. Use when you need to add an LTL carrier connection for freight shipping. For sandbox testing, use carrier codes TEST, WARN, or FAIL with empty credentials {}. |
| `SHIPENGINE_CONNECT_SHIPSURANCE` | Connect Shipsurance Account | Tool to connect a Shipsurance insurance account to ShipEngine. Use when you need to integrate a Shipsurance policy for insurance coverage on shipments. |
| `SHIPENGINE_CREATE_ACCOUNT_IMAGE` | Create Account Image | Tool to create a new account image in ShipEngine. Use when uploading a logo or image for use on shipping labels. |
| `SHIPENGINE_CREATE_PACKAGE_TYPE` | Create Package Type | Tool to create a custom package type definition in ShipEngine. Use when defining new package types with specific codes and optional dimensions. |
| `SHIPENGINE_CREATE_TAG` | Create Tag | Tool to create a new tag in ShipEngine. Use after determining the desired tag name for shipments. |
| `SHIPENGINE_CREATE_TAG2` | Create Tag 2 | Tool to create a new tag for organizing shipments. Use when you need to create a tag by specifying the tag name in the URL path. |
| `SHIPENGINE_CREATE_WAREHOUSE` | Create Warehouse | Tool to create a new warehouse. Use when adding a new inventory location after verifying its full address details. |
| `SHIPENGINE_CREATE_WEBHOOK` | Create Webhook | Tool to create a ShipEngine webhook. Use when you need to register a webhook for specific events. Use after confirming your event-handling endpoint is ready. |
| `SHIPENGINE_DELETE_ACCOUNT_IMAGE_BY_ID` | Delete Account Image by ID | Tool to delete a ShipEngine account image by its ID. Use when you need to remove an image from account settings. The image will be permanently removed from the account. |
| `SHIPENGINE_DELETE_BATCH` | Delete Batch | Tool to delete a batch by ID. Use when you need to remove a batch from ShipEngine. Note that this operation is destructive and cannot be undone. |
| `SHIPENGINE_DELETE_PACKAGE` | Delete Package | Tool to delete a custom package type by ID. Use when removing package types that are no longer needed. |
| `SHIPENGINE_DELETE_WAREHOUSE` | Delete Warehouse | Tool to delete a warehouse from your ShipEngine account. Use when you need to remove a warehouse that is no longer needed. The warehouse will be permanently removed from your account. |
| `SHIPENGINE_DELETE_WEBHOOK` | Delete Webhook | Tool to delete a ShipEngine webhook subscription. Use when you need to remove a webhook that is no longer needed. The webhook will be permanently removed and will no longer receive event notifications. |
| `SHIPENGINE_DISCONNECT_CARRIER` | Disconnect Carrier | Tool to disconnect a carrier account from ShipEngine. Use when you need to remove a carrier connection from your ShipEngine account. |
| `SHIPENGINE_DISCONNECT_SHIPSURANCE` | Disconnect Shipsurance | Tool to disconnect a Shipsurance insurance account from ShipEngine. Use when you need to remove the Shipsurance integration. |
| `SHIPENGINE_DOWNLOAD_FILE` | Download File | Tool to download a file from ShipEngine. Use when you need to retrieve a label PDF or other document from the ShipEngine downloads endpoint. |
| `SHIPENGINE_GET_ACCOUNT_IMAGE_BY_ID` | Get Account Image by ID | Tool to retrieve account image settings by label image ID. Use when you need to fetch image data for labels or display account branding information. |
| `SHIPENGINE_GET_BATCH_BY_EXTERNAL_ID` | Get Batch by External ID | Tool to retrieve batch details using an external batch ID. Use when you need to look up a batch by its client-assigned external identifier rather than ShipEngine's internal batch ID. |
| `SHIPENGINE_GET_BATCH_BY_ID` | Get Batch by ID | Tool to retrieve detailed information about a specific batch by its ID. Use when you need to check batch status, download labels, or view errors. |
| `SHIPENGINE_GET_BATCH_ERRORS` | Get Batch Errors | Tool to retrieve errors that occurred during batch processing. Use when you need to investigate or troubleshoot issues with a specific batch. |
| `SHIPENGINE_GET_BULK_RATES` | Get Bulk Rates | Tool to get shipping rates for multiple shipments in a single request. Use when you need to compare rates across multiple carriers or shipments efficiently. The request is processed asynchronously - use the returned rate_request_id to retrieve the actual rates once processing is complete. |
| `SHIPENGINE_GET_INSURANCE_BALANCE` | Get Insurance Balance | Tool to retrieve the current Shipsurance insurance funds balance. Use when you need to check available insurance balance before purchasing shipment insurance. |
| `SHIPENGINE_GET_LTL_CARRIER_CREDENTIAL_REQUIREMENTS` | Get LTL Carrier Credential Requirements | Tool to retrieve credential requirements for connecting an LTL carrier. Use when you need to discover what credentials (e.g., account number, username, password) are required before connecting a specific LTL carrier. |
| `SHIPENGINE_GET_LTL_CARRIER_FEATURES` | Get LTL Carrier Features | Tool to retrieve features supported by an LTL carrier. Use when you need to discover what capabilities (e.g., tracking, quotes, scheduled pickups) are available for a specific LTL carrier before creating shipments. |
| `SHIPENGINE_GET_LTL_CARRIER_OPTIONS` | Get LTL Carrier Options | Tool to list available options/accessorials for an LTL carrier. Use when you need to discover what accessorial services (e.g., hazardous material, inside pickup, lift gate) are available for a specific LTL carrier connection. |
| `SHIPENGINE_GET_LTL_CARRIER_PACKAGES` | Get LTL Carrier Packages | Tool to list available package/handling unit types for an LTL (Less Than Truckload) carrier. Use when you need to find valid package codes for LTL freight shipments. |
| `SHIPENGINE_GET_LTL_CARRIER_SERVICES` | Get LTL Carrier Services | Tool to list available services for an LTL carrier. Use when you need to discover what shipping services (e.g., standard, guaranteed morning/noon) are available for a specific LTL carrier connection. |
| `SHIPENGINE_GET_PACKAGE_BY_ID` | Get Package by ID | Tool to get details of a specific custom package type by ID. Use when you need to retrieve package specifications. |
| `SHIPENGINE_GET_SHIPMENT_BY_EXTERNAL_ID` | Get Shipment by External ID | Tool to retrieve shipment details using an external shipment ID. Use when you need to look up a shipment by its client-assigned external identifier rather than ShipEngine's internal shipment ID. |
| `SHIPENGINE_GET_SHIPMENT_BY_ID` | Get Shipment by ID | Tool to retrieve a shipment by ID. Use when you need detailed shipment information after creation. |
| `SHIPENGINE_GET_SHIPMENT_RATES` | Get Shipment Rates | Tool to retrieve shipping rates for an existing shipment. Use when you need to get rate quotes for a shipment that has already been created. |
| `SHIPENGINE_GET_TRACKING_INFO` | Get Tracking Information | Tool to retrieve tracking information for a shipment. Use when you need to track the status and location of a package using its tracking number and carrier code. |
| `SHIPENGINE_GET_WAREHOUSE_BY_ID` | Get Warehouse by ID | Tool to retrieve details of a specific warehouse by ID. Use when you need warehouse information including addresses and default status. |
| `SHIPENGINE_GET_WEBHOOK_BY_ID` | Get Webhook by ID | Tool to retrieve details of a specific webhook by ID. Use when you need to view the configuration of an existing webhook. |
| `SHIPENGINE_LIST_ACCOUNT_IMAGES` | List Account Images | Tool to list all account images. Use when you need to retrieve all images configured for the ShipEngine account, such as logos or branding images used on shipping labels. |
| `SHIPENGINE_LIST_ACCOUNT_SETTINGS` | List Account Settings | Tool to list all account settings for the ShipEngine account. Use when you need to retrieve account configuration, preferences, or settings information. |
| `SHIPENGINE_LIST_BATCHES2` | List Batches (v2) | Tool to list all batches with comprehensive filtering options. Use when you need to retrieve batches with filters for status, creation/processing dates, batch number, or pagination. |
| `SHIPENGINE_LIST_CARRIER_PACKAGE_TYPES` | List Carrier Package Types | Tool to list all available package types for a specific carrier. Use when you need to find valid package_code values before creating shipments. |
| `SHIPENGINE_LIST_LABELS2` | List Labels (Extended) | Tool to list all shipping labels with comprehensive filtering options. Use when you need to retrieve labels with filters like status, carrier, tracking number, batch, or date ranges. Supports sorting and pagination. |
| `SHIPENGINE_LIST_LTL_CARRIERS` | List LTL Carriers | Tool to list all LTL (Less-Than-Truckload) carrier accounts connected to your ShipEngine account. Use when you need to discover available LTL carriers, their services, container types, and accessorial services before creating LTL shipments. |
| `SHIPENGINE_LIST_MANIFESTS2` | List Manifests (Advanced) | Tool to list all manifests with optional filtering by warehouse and carrier. Use when you need to retrieve manifests with advanced filtering options. |
| `SHIPENGINE_LIST_PACKAGES` | List Packages | Tool to list all package types. Use when selecting package options before shipment creation. |
| `SHIPENGINE_LIST_PICKUPS` | List Scheduled Pickups | Tool to list all scheduled pickups with optional filters. Use when you need to retrieve scheduled pickups with pagination support. |
| `SHIPENGINE_LIST_SHIPMENTS2` | List Shipments (v2) | Tool to list all shipments with optional filtering parameters. Use when you need to retrieve shipments with filters like status, batch, tags, or date ranges. |
| `SHIPENGINE_LIST_TAGS2` | List Tags (v2) | Tool to list all tags in your account. Use when you need to retrieve all available tags for display or selection purposes. |
| `SHIPENGINE_LIST_WAREHOUSES` | List Warehouses | Tool to list all warehouses. Use when you need to retrieve warehouse locations with pagination. Call after creating or updating warehouses. |
| `SHIPENGINE_LIST_WEBHOOK_EVENTS` | List Webhook Events | Retrieve a list of available webhook event types supported by ShipEngine. Returns static documentation of all supported webhook events that can be used when creating webhooks. Always call this before SHIPENGINE_CREATE_WEBHOOK to obtain valid event type names — unsupported or mistyped event names result in no callbacks being received. Note: This is based on ShipEngine's documented event types as there is no API endpoint for listing events. |
| `SHIPENGINE_LIST_WEBHOOKS` | List Webhooks | Tool to list all webhooks configured on your account. Use when you need to view all registered webhooks. |
| `SHIPENGINE_PARSE_ADDRESS` | Parse Address | Tool to parse unstructured address text and extract structured address components. Use when you have raw address text and need to extract individual fields like street, city, state, and postal code. |
| `SHIPENGINE_PROCESS_BATCH_LABELS` | Process Batch Labels | Tool to process a batch to create and purchase shipping labels for all shipments in the batch. Use after creating a batch with shipments. The API returns HTTP 204 on success. |
| `SHIPENGINE_REMOVE_FROM_BATCH` | Remove From Batch | Tool to remove shipments or rate IDs from a batch. Use when you need to modify batch contents by removing specific shipments or rates. At least one of shipment_ids or rate_ids must be provided. |
| `SHIPENGINE_REMOVE_TAG_FROM_SHIPMENT` | Remove Tag from Shipment | Tool to remove a tag from a shipment. Use when you need to un-categorize or remove a specific tag from an existing shipment. |
| `SHIPENGINE_START_TRACKING` | Start Tracking Package | Tool to subscribe to tracking updates for a package via webhooks. Use when you need to start monitoring a shipment's status. The package tracking information will be sent to configured webhooks when updates occur. |
| `SHIPENGINE_STOP_TRACKING` | Stop Tracking Package | Tool to unsubscribe from tracking updates for a package. Use when you no longer need to receive tracking notifications for a specific shipment. Once stopped, you will not receive further tracking updates for this package. |
| `SHIPENGINE_TRACK_LTL_SHIPMENT` | Track LTL Shipment | Tool to track an LTL shipment using carrier code and PRO number. Use when you need to retrieve real-time tracking information for an LTL shipment, including current status, delivery dates, and event history. |
| `SHIPENGINE_UPDATE_ACCOUNT_IMAGE_BY_ID` | Update Account Image By ID | Tool to update an account image by ID in ShipEngine. Use when modifying image properties like name or default status. |
| `SHIPENGINE_UPDATE_LTL_CONNECTION` | Update LTL Connection | Tool to update LTL carrier connection credentials in ShipEngine. Use when you need to modify authentication credentials for an existing LTL carrier connection without disconnecting and reconnecting. You must provide all credential properties for the carrier, not just the property you wish to update. |
| `SHIPENGINE_UPDATE_PACKAGE` | Update Package Type | Tool to update an existing custom package type definition. Use when modifying package details such as name, code, description, or dimensions. |
| `SHIPENGINE_UPDATE_SHIPMENT` | Update Shipment | Tool to update an existing shipment's details. Use when you need to modify shipment information such as addresses, packages, weight, or carrier options before creating a label. |
| `SHIPENGINE_UPDATE_SHIPMENTS_TAGS` | Update Shipments Tags | Tool to update tags on one or more shipments in bulk. Use when you need to assign existing tags to shipments. Tags must be created before assignment using the Create Tag action. |
| `SHIPENGINE_UPDATE_WAREHOUSE` | Update Warehouse | Tool to update an existing warehouse's details and address. Use when modifying warehouse information such as name, origin address, return address, or default status. |
| `SHIPENGINE_UPDATE_WEBHOOK` | Update Webhook | Tool to update a ShipEngine webhook. Use when you need to modify webhook URL, name, headers, or store association. Returns success on 204 status code. |
| `SHIPENGINE_VALIDATE_ADDRESS` | Validate Address | Tool to validate and normalize shipping addresses. Use after collecting raw addresses to ensure they are correct and standardized before shipping. |

## Supported Triggers

None listed.

## Creating MCP Server - Stand-alone vs Composio SDK

The Shipengine MCP server is an implementation of the Model Context Protocol that connects your AI agent to Shipengine. It provides structured and secure access so your agent can perform Shipengine operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before starting, make sure you have:
- Composio API Key and Claude/Anthropic API Key
- Primary know-how of Claude Agents SDK
- A Shipengine account
- Some knowledge of Python

### 1. Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
- Go to the [Anthropic Console](https://console.anthropic.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models.
- Keep the API key safe.
Composio API Key
- Log in to the [Composio dashboard](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

No description provided.
```python
pip install composio-anthropic claude-agent-sdk python-dotenv
```

```typescript
npm install @anthropic-ai/claude-agent-sdk @composio/core dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's happening:
- COMPOSIO_API_KEY authenticates with Composio
- USER_ID identifies the user for session management
- ANTHROPIC_API_KEY authenticates with Anthropic/Claude
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
```

### 4. Import dependencies

No description provided.
```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

dotenv.config();
```

### 5. Create a Composio instance and Tool Router session

No description provided.
```python
async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Shipengine
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["shipengine"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")
```

```typescript
async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });

  // Create Tool Router session for Shipengine
  const session = await composio.create(USER_ID, {
    toolkits: ['shipengine'],
  });
  const mcpUrl = session?.mcp.url;
```

### 6. Configure Claude Agent with MCP

No description provided.
```python
# Configure remote MCP server for Claude
options = ClaudeAgentOptions(
    permission_mode="bypassPermissions",
    mcp_servers={
        "composio": {
            "type": "http",
            "url": url,
            "headers": {
                "x-api-key": os.getenv("COMPOSIO_API_KEY")
            }
        }
    },
    system_prompt="You are a helpful assistant with access to Shipengine tools via Composio.",
    max_turns=10
)
```

```typescript
const options: Options = {
  permissionMode: 'bypassPermissions',
  mcpServers: {
    composio: {
      type: 'http',
      url: mcpUrl,
      headers: { 'x-api-key': COMPOSIO_API_KEY }
    }
  },
  systemPrompt: 'You are a helpful assistant with access to Shipengine tools via Composio.',
  maxTurns: 10,
};
```

### 7. Create client and start chat loop

No description provided.
```python
# Create client with context manager
async with ClaudeSDKClient(options=options) as client:
    print("\nChat started. Type 'exit' or 'quit' to end.\n")

    # Main chat loop
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit"}:
            print("Goodbye!")
            break

        # Send query
        await client.query(user_input)

        # Receive and print response
        print("Claude: ", end="", flush=True)
        async for message in client.receive_response():
            if hasattr(message, "content"):
                for block in message.content:
                    if hasattr(block, "text"):
                        print(block.text, end="", flush=True)
        print()
```

```typescript
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}
```

### 8. Run the application

No description provided.
```python
if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Complete Code

```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()

async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Shipengine
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["shipengine"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")

    # Configure remote MCP server for Claude
    options = ClaudeAgentOptions(
        permission_mode="bypassPermissions",
        mcp_servers={
            "composio": {
                "type": "http",
                "url": url,
                "headers": {
                    "x-api-key": os.getenv("COMPOSIO_API_KEY")
                }
            }
        },
        system_prompt="You are a helpful assistant with access to Shipengine tools via Composio.",
        max_turns=10
    )

    # Create client with context manager
    async with ClaudeSDKClient(options=options) as client:
        print("\nChat started. Type 'exit' or 'quit' to end.\n")

        # Main chat loop
        while True:
            user_input = input("You: ").strip()
            if user_input.lower() in {"exit", "quit"}:
                print("Goodbye!")
                break

            # Send query
            await client.query(user_input)

            # Receive and print response
            print("Claude: ", end="", flush=True)
            async for message in client.receive_response():
                if hasattr(message, "content"):
                    for block in message.content:
                        if hasattr(block, "text"):
                            print(block.text, end="", flush=True)
            print()

if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });
  const session = await composio.create(USER_ID, {
    toolkits: ['shipengine']
  });
  const mcp_url = session?.mcp.url;

  const options: Options = {
    permissionMode: 'bypassPermissions',
    mcpServers: {
      composio: {
        type: 'http',
        url: mcp_url,
        headers: { 'x-api-key': COMPOSIO_API_KEY }
      }
    },
    systemPrompt: 'You are a helpful assistant with access to Shipengine tools via Composio.',
    maxTurns: 10,
  };

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Conclusion

You've successfully built a Claude Agent SDK agent that can interact with Shipengine through Composio's Tool Router.
Key features:
- Native MCP support through Claude's agent framework
- Streaming responses for real-time interaction
- Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

## How to build Shipengine MCP Agent with another framework

- [OpenAI Agents SDK](https://composio.dev/toolkits/shipengine/framework/open-ai-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/shipengine/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/shipengine/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/shipengine/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/shipengine/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/shipengine/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/shipengine/framework/cli)
- [Google ADK](https://composio.dev/toolkits/shipengine/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/shipengine/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/shipengine/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/shipengine/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/shipengine/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/shipengine/framework/crew-ai)

## Related Toolkits

- [Addresszen](https://composio.dev/toolkits/addresszen) - Addresszen is a real-time address autocomplete and verification service. It helps capture accurate, deliverable addresses with instant suggestions and validation.
- [Asin data api](https://composio.dev/toolkits/asin_data_api) - Asin data api gives you detailed, real-time product data from Amazon, including price, rank, and reviews. Perfect for e-commerce pros and data-driven marketers who need instant marketplace insights.
- [Baselinker](https://composio.dev/toolkits/baselinker) - BaseLinker is an all-in-one e-commerce management platform connecting stores, marketplaces, carriers, and more. It streamlines order processing, inventory control, and automates your sales operations.
- [Bestbuy](https://composio.dev/toolkits/bestbuy) - Best Buy is a leading retailer offering APIs for product, store, and recommendation data. Instantly access up-to-date retail insights for smarter shopping and decision-making.
- [Btcpay server](https://composio.dev/toolkits/btcpay_server) - BTCPay Server is a free, open-source, self-hosted Bitcoin payment processor. It lets merchants accept Bitcoin payments directly, cutting out middlemen and boosting privacy.
- [Cdr platform](https://composio.dev/toolkits/cdr_platform) - Cdr platform is an API for purchasing carbon dioxide removal services. It enables businesses to offset emissions by accessing verified carbon removal projects.
- [Cloudcart](https://composio.dev/toolkits/cloudcart) - CloudCart is an e-commerce platform for building and managing online stores. It helps businesses streamline product listings, orders, and customer engagement.
- [Countdown api](https://composio.dev/toolkits/countdown_api) - Countdown API gives you real-time, structured eBay product data, reviews, and seller feedback. Perfect for powering price monitoring, product research, or marketplace analytics workflows.
- [Dpd2](https://composio.dev/toolkits/dpd2) - Dpd2 is a robust email management platform for handling, sorting, and automating email workflows. Streamline your communications and boost productivity with advanced sorting, labeling, and response tools.
- [Finerworks](https://composio.dev/toolkits/finerworks) - FinerWorks is an online platform for fine art and photo printing services. Artists and photographers use it to order custom prints and manage print inventory efficiently.
- [Fingertip](https://composio.dev/toolkits/fingertip) - Fingertip is a business management platform for selling, booking, and customer engagement—all from a single link. It helps businesses streamline operations and connect with customers across social channels.
- [Fraudlabs pro](https://composio.dev/toolkits/fraudlabs_pro) - FraudLabs Pro is an online payment fraud detection service for e-commerce and merchants. It helps minimize chargebacks and revenue loss by detecting and preventing fraudulent transactions.
- [Gift up](https://composio.dev/toolkits/gift_up) - Gift Up! is a digital platform for selling, managing, and redeeming gift cards online. It streamlines promotions and gift card transactions for businesses and their customers.
- [Goody](https://composio.dev/toolkits/goody) - Goody is a gifting platform that lets users send gifts and physical products without handling logistics. It streamlines gifting by managing delivery, fulfillment, and recipient experience.
- [Gumroad](https://composio.dev/toolkits/gumroad) - Gumroad is a platform for selling digital products, physical goods, and memberships with a simple checkout and marketing tools. It streamlines creator payouts and helps you grow your audience effortlessly.
- [Instacart](https://composio.dev/toolkits/instacart) - Instacart is an online grocery delivery and pickup service platform. It lets you discover local retailers and create shoppable lists and recipes with ease.
- [Junglescout](https://composio.dev/toolkits/junglescout) - Junglescout is an Amazon product research and analytics platform for sellers. It delivers sales estimates, competitive insights, and optimization tools to boost your Amazon business.
- [Ko fi](https://composio.dev/toolkits/ko_fi) - Ko-fi is a platform that lets creators receive donations, memberships, and sales from fans. It helps creators monetize their work and grow their audience with minimal friction.
- [Lemon squeezy](https://composio.dev/toolkits/lemon_squeezy) - Lemon Squeezy is a payments and subscription platform built for software companies. It makes managing payments, taxes, and customer subscriptions effortless.
- [Loyverse](https://composio.dev/toolkits/loyverse) - Loyverse is a point-of-sale (POS) platform for small businesses, offering tools for sales, inventory, and customer loyalty. It helps streamline retail operations and boost customer engagement.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Shipengine MCP?

With a standalone Shipengine MCP server, the agents and LLMs can only access a fixed set of Shipengine tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Shipengine and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Claude Agent SDK?

Yes, you can. Claude Agent SDK fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Shipengine tools.

### Can I manage the permissions and scopes for Shipengine while using Tool Router?

Yes, absolutely. You can configure which Shipengine scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Shipengine data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
