# @mcpengine/intercom

Model Context Protocol (MCP) server for Intercom API integration.

## Features

- ✅ **Contacts** - Create, read, update, delete, search, and list contacts
- ✅ **Conversations** - Create, reply, assign, close, search conversations
- ✅ **Companies** - Manage companies and their relationships with contacts
- ✅ **Articles** - Create and manage help center articles
- ✅ **Help Center** - Collections, sections, and help center management
- ✅ **Tickets** - Create, update, search tickets and ticket types
- ✅ **Tags** - Create, list, and delete tags
- ✅ **Segments** - List and retrieve segments
- ✅ **Events** - Submit custom events
- ✅ **Messages** - Send in-app, email, and push messages
- ✅ **Teams & Admins** - List and retrieve teams and admins

## Installation

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

## Configuration

Create a `.env` file:

```bash
cp .env.example .env
```

Add your Intercom access token:

```
INTERCOM_ACCESS_TOKEN=your_access_token_here
```

Get your access token from the [Intercom Developer Hub](https://app.intercom.com/a/apps/_/settings/developer-hub).

## Usage

### Standalone

```bash
npm start
```

### As MCP Server

Add to your MCP client configuration (e.g., Claude Desktop):

```json
{
  "mcpServers": {
    "intercom": {
      "command": "node",
      "args": ["/path/to/dist/main.js"],
      "env": {
        "INTERCOM_ACCESS_TOKEN": "your_access_token_here"
      }
    }
  }
}
```

## Available Tools

### Contacts

- `contacts_create` - Create a new contact (user or lead)
- `contacts_get` - Retrieve a contact by ID
- `contacts_update` - Update contact details
- `contacts_delete` - Delete a contact
- `contacts_list` - List all contacts (cursor pagination)
- `contacts_search` - Search contacts with filters

### Conversations

- `conversations_create` - Start a new conversation
- `conversations_get` - Retrieve conversation details
- `conversations_list` - List conversations
- `conversations_search` - Search conversations
- `conversations_reply` - Reply to a conversation
- `conversations_close` - Close a conversation
- `conversations_assign` - Assign to admin or team

### Companies

- `companies_create` - Create a company
- `companies_get` - Retrieve company details
- `companies_list` - List companies
- `companies_update` - Update company data

### Articles

- `articles_create` - Create a help article
- `articles_get` - Get article by ID
- `articles_list` - List all articles
- `articles_update` - Update article
- `articles_delete` - Delete article

### Help Center

- `help-center_list` - List help centers
- `help-center_collections_list` - List collections
- `help-center_collections_create` - Create collection

### Tickets

- `tickets_create` - Create a ticket
- `tickets_get` - Get ticket by ID
- `tickets_list` - List tickets
- `tickets_search` - Search tickets
- `tickets_types_list` - List ticket types

### Tags

- `tags_create` - Create a tag
- `tags_list` - List all tags
- `tags_delete` - Delete a tag

### Segments

- `segments_list` - List segments
- `segments_get` - Get segment by ID

### Events

- `events_submit` - Submit a custom event

### Messages

- `messages_send` - Send in-app, email, or push message

### Teams & Admins

- `teams_list` - List all teams
- `teams_get` - Get team by ID
- `admins_list` - List all admins
- `admins_get` - Get admin by ID

## API Reference

This server uses Intercom API v2.11. For detailed API documentation, visit:
https://developers.intercom.com/docs/build-an-integration/

## Rate Limiting

The server automatically handles rate limiting (429 responses) with exponential backoff and retry logic.

## Development

```bash
# Type check
npm run typecheck

# Build
npm run build

# Watch mode
npm run dev
```

## License

MIT
