npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

chatwoot-mcp-server

v1.0.0

Published

MCP server for Chatwoot API integration - manage conversations, contacts, and messages

Readme

Chatwoot MCP Server

Model Context Protocol (MCP) server for Chatwoot API integration. Enables AI assistants to manage customer conversations, messages, and contacts in Chatwoot.

Features

  • Conversations Management: List, filter, and retrieve conversation details
  • Message Operations: Read message history and send new messages
  • Type-Safe: Built with TypeScript using OpenAPI-generated types
  • Flexible Auth: Supports both API token (recommended) and JWT authentication

Tools Provided

Conversations

  • chatwoot_list_conversations - List conversations with filtering (status, assignee, inbox)
  • chatwoot_get_conversation - Get detailed info for a specific conversation

Messages

  • chatwoot_list_messages - List all messages in a conversation
  • chatwoot_create_message - Send a message or create an internal note

Installation

npm install
npm run build

Configuration

Recommended: API Access Token

The simplest method using your Chatwoot API token (no expiration).

Get your API token:

  1. Log in to your Chatwoot account
  2. Click your avatar → Profile Settings
  3. Scroll to bottom → Copy your "Access Token"

Configure .env:

CHATWOOT_BASE_URL="https://your-chatwoot-instance.com"
CHATWOOT_API_TOKEN="your_api_token_here"

Alternative: JWT Authentication

Use email/password if API tokens don't work on your instance (requires password for token refresh).

CHATWOOT_BASE_URL="https://your-chatwoot-instance.com"
CHATWOOT_EMAIL="[email protected]"
CHATWOOT_PASSWORD="your_password"

Note: JWT tokens expire and require the password for auto-refresh.

Important for Self-Hosted Instances

If using nginx as reverse proxy (e.g., CapRover), add this to nginx config to support API tokens:

server {
    ...
    underscores_in_headers on;  # Required for api_access_token header
    ...
}

Usage

Running the Server

npm start

Development Mode (with auto-reload)

npm run dev

Using with Claude Code

claude mcp add chatwoot \
  -e CHATWOOT_BASE_URL="https://your-instance.com" \
  -e CHATWOOT_API_TOKEN="your_token" \
  -- node /path/to/chatwoot-mcp-server/dist/index.js

Using with Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "chatwoot": {
      "command": "node",
      "args": ["/path/to/chatwoot-mcp-server/dist/index.js"],
      "env": {
        "CHATWOOT_BASE_URL": "https://your-chatwoot-instance.com",
        "CHATWOOT_API_TOKEN": "your_api_token"
      }
    }
  }
}

Example Queries

Once connected, you can ask Claude things like:

  • "Show me all open conversations in account 3"
  • "What are the details of conversation #123?"
  • "List all messages in conversation #456"
  • "Send a reply to conversation #789 saying 'Thank you for contacting us!'"
  • "Add an internal note to conversation #101 about the customer's issue"

Testing

Run integration tests:

npm test

Watch mode:

npm run test:watch

Project Structure

chatwoot-mcp-server/
├── src/
│   ├── index.ts                  # Main server entry point
│   ├── constants.ts              # Shared constants
│   ├── chatwoot-types.ts         # Generated OpenAPI types
│   ├── services/
│   │   ├── chatwoot-client.ts    # API client with auth
│   │   ├── chatwoot-auth.ts      # JWT authentication
│   │   ├── token-cache.ts        # JWT token caching
│   │   └── error-handler.ts      # Error handling utilities
│   ├── schemas/
│   │   └── common.ts             # Shared Zod schemas
│   └── tools/
│       ├── conversations.ts      # Conversation tools
│       └── messages.ts           # Message tools
├── test/                         # Integration tests
├── swagger.json                  # Chatwoot OpenAPI spec
└── package.json

Development

Regenerating Types

If the Chatwoot API changes, regenerate types:

npm run generate-types

Adding New Tools

  1. Create a new file in src/tools/
  2. Define Zod schemas for input validation
  3. Implement the tool function
  4. Register the tool in src/index.ts

Building

npm run build

Builds TypeScript to JavaScript in the dist/ directory.

Troubleshooting

API Token Returns 401

If using a self-hosted instance with nginx, ensure underscores_in_headers on; is set in your nginx config. This is required because api_access_token contains underscores.

JWT Tokens Expire

If using JWT authentication, tokens expire (typically after 2 weeks). Keep CHATWOOT_PASSWORD in .env for automatic refresh, or switch to API token authentication.

Tech Stack

  • TypeScript - Type-safe development
  • openapi-fetch - Type-safe API client
  • openapi-typescript - Generate types from OpenAPI spec
  • Zod - Runtime input validation
  • @modelcontextprotocol/sdk - MCP server framework
  • Vitest - Testing framework

License

MIT

Contributing

Contributions are welcome! Additional tools that could be added:

  • Contact management (create, update, search)
  • Team and agent operations
  • Inbox configuration
  • Labels and custom attributes
  • Reports and analytics
  • Bulk operations