# Clover MCP Server

MCP server for [Clover POS](https://www.clover.com/) API integration. Access orders, inventory, customers, payments, and merchant data.

## Setup

```bash
npm install
npm run build
```

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `CLOVER_API_KEY` | Yes | OAuth access token or API token |
| `CLOVER_MERCHANT_ID` | Yes | 13-character merchant ID |
| `CLOVER_SANDBOX` | No | Set to `"true"` for sandbox environment |
| `CLOVER_REGION` | No | `"US"` (default), `"EU"`, or `"LA"` |

## API Endpoints

- **Production US/Canada:** `https://api.clover.com`
- **Production Europe:** `https://api.eu.clover.com`
- **Production LATAM:** `https://api.la.clover.com`
- **Sandbox:** `https://apisandbox.dev.clover.com`

## Tools

### Orders
- **list_orders** - List orders with optional filtering by state
- **get_order** - Get order details including line items and payments
- **create_order** - Create new orders (supports atomic orders with line items)

### Inventory
- **list_items** - List products/menu items available for sale
- **get_inventory** - Get stock counts for items

### Customers & Payments
- **list_customers** - List customer database entries
- **list_payments** - List payment transactions

### Merchant
- **get_merchant** - Get merchant account information

## Usage with Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "clover": {
      "command": "node",
      "args": ["/path/to/mcp-servers/clover/dist/index.js"],
      "env": {
        "CLOVER_API_KEY": "your-api-token",
        "CLOVER_MERCHANT_ID": "your-merchant-id",
        "CLOVER_SANDBOX": "true"
      }
    }
  }
}
```

## Authentication

Clover uses OAuth 2.0. You need either:
1. **Test API Token** - Generate in Clover Developer Dashboard for sandbox testing
2. **OAuth Access Token** - Obtained through OAuth flow for production apps

See [Clover Authentication Docs](https://docs.clover.com/dev/docs/use-oauth) for details.

## Examples

List open orders:
```
list_orders(filter: "state=open", limit: 10)
```

Get order with line items:
```
get_order(order_id: "ABC123", expand: "lineItems,payments")
```

Create an order with items:
```
create_order(
  title: "Table 5",
  line_items: [
    { item_id: "ITEM123", quantity: 2 },
    { name: "Custom Item", price: 999 }
  ]
)
```
