Skip to main content
Glama
Mattheinrichs

target-cart-mcp

README.md
# target-cart-mcp

An MCP server for searching Target products and generating [Shopping Cart Share](https://shoppingcartshare.com/) links from a list of TCINs.

Forked from [`@striderlabs/mcp-target`](https://www.npmjs.com/package/@striderlabs/mcp-target) (MIT). The upstream package exposes browser-session tools (login, add-to-cart, checkout, orders) that are unnecessary for agent-driven cart building and tend to confuse LLM agents into attempting them. This fork removes those tools, patches the browser automation layer for container stability, and adds a native `create_share_a_cart_link` tool backed by the Shopping Cart Share Firebase API.

## Tools

| Tool | Description |
|---|---|
| `search_products` | Search Target products by keyword, category, price range, or sort order |
| `get_product` | Get detailed product info (price, description, availability) by URL or TCIN |
| `check_store_availability` | Check in-store availability for a TCIN at a given zip code |
| `create_share_a_cart_link` | Build a Shopping Cart Share link from a list of TCINs — returns a `shoppingcartshare.com/shared/cart/XXXXX` URL |

## Changes from upstream

- **Removed tools**: `status`, `login`, `logout`, `add_to_cart`, `view_cart`, `clear_cart`, `checkout`, `get_orders`, `track_order`
- **Added tool**: `create_share_a_cart_link` — POSTs to the Shopping Cart Share Firebase backend and returns a shareable cart URL
- **Browser patches**: removed `channel: "chrome"` launch arg (crashes in containers without real Chrome), added dead-browser detection + automatic reset on crash, added memory-saving Chromium flags for low-memory containers, 45s idle close timer

## Usage

### Docker Compose

```yaml
services:
  target-cart-mcp:
    image: target-cart-mcp:latest
    build: .
    container_name: target-cart-mcp
    volumes:
      - ./data/.striderlabs:/root/.striderlabs
    restart: unless-stopped
    shm_size: '256m'
    deploy:
      resources:
        limits:
          memory: 2G
```

The server exposes a [Streamable HTTP MCP endpoint](https://modelcontextprotocol.io/) at `http://localhost:8000/mcp`.

### MCP client config (openclaw / Claude Desktop)

```json
{
  "mcp": {
    "servers": {
      "target": {
        "url": "http://target-cart-mcp:8000/mcp",
        "transport": "streamable-http"
      }
    }
  }
}
```

### Using `create_share_a_cart_link`

The returned URL (`shoppingcartshare.com/shared/cart/XXXXX`) opens a cart preview page. Clicking **Use Cart** with the [Shopping Cart Share browser extension](https://shoppingcartshare.com/plugins) installed will import the items into your Target cart.

```json
{
  "tool": "create_share_a_cart_link",
  "arguments": {
    "items": [
      { "tcin": "12345678", "title": "Product Name", "quantity": 2, "image": "https://..." }
    ],
    "cart_title": "Weekly Groceries"
  }
}
```

## Building

```bash
docker compose build
docker compose up -d
```

## License

MIT — derived from [`@striderlabs/mcp-target`](https://www.npmjs.com/package/@striderlabs/mcp-target) (MIT).