# ListMonk MCP Server

This is an MCP (Model Context Protocol) server that wraps the ListMonk API using the Stainless-generated TypeScript SDK.

## Installation

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

## Configuration

Set the following environment variables:

```bash
# ListMonk API Configuration
export LISTMONK_BASE_URL="http://localhost:9000/api"  # Your ListMonk instance
export LISTMONK_USERNAME="admin"                      # Admin username
export LISTMONK_PASSWORD="your-password"              # Admin password
# OR
export LISTMONK_API_KEY="your-api-key"               # If using API key auth
```

Alternatively, you can use the SDK's default environment variable names:
- `LISTMONK_PATIENT_HJ6V_BASE_URL`
- `LISTMONK_PATIENT_HJ6V_USERNAME`
- `LISTMONK_PATIENT_HJ6V_PASSWORD`
- `LISTMONK_PATIENT_HJ6V_API_KEY`

## Usage

### Running the Server

```bash
npm start
```

### Available Tools

#### Lists Management
- `listmonk_list_lists` - Get all lists
- `listmonk_create_list` - Create a new list
- `listmonk_get_list` - Get a specific list
- `listmonk_update_list` - Update a list

#### Subscribers Management
- `listmonk_list_subscribers` - Get all subscribers
- `listmonk_create_subscriber` - Create a new subscriber
- `listmonk_get_subscriber` - Get a specific subscriber
- `listmonk_update_subscriber` - Update a subscriber
- `listmonk_bulk_update_lists` - Bulk update subscriber list memberships

#### Campaigns Management
- `listmonk_list_campaigns` - Get all campaigns
- `listmonk_create_campaign` - Create a new campaign
- `listmonk_get_campaign` - Get a specific campaign
- `listmonk_update_campaign_status` - Update campaign status
- `listmonk_send_test_campaign` - Send test campaign email

#### Templates Management
- `listmonk_list_templates` - Get all templates
- `listmonk_create_template` - Create a new template

#### Import Management
- `listmonk_import_subscribers` - Import subscribers from CSV

#### Media Management
- `listmonk_list_media` - Get all media files
- `listmonk_upload_media` - Upload a media file

#### Settings Management
- `listmonk_update_settings` - Update ListMonk settings

#### Health Check
- `listmonk_health_check` - Check API health status

### Integration with Claude Desktop

Add to your Claude Desktop configuration:

```json
{
  "mcpServers": {
    "listmonk": {
      "command": "node",
      "args": ["/path/to/listmonk-mcp-wrapper/dist/index.js"],
      "env": {
        "LISTMONK_BASE_URL": "http://localhost:9000/api",
        "LISTMONK_USERNAME": "admin",
        "LISTMONK_PASSWORD": "your-password"
      }
    }
  }
}
```

## Development

```bash
# Run in development mode
npm run dev

# Build for production
npm run build
```

## Note

This MCP server uses the Stainless-generated SDK which was created with the name "listmonk-patient-hj6v" but contains the complete ListMonk API implementation.