mcp

v0.10.2
@channlize/mcp Checked 3 hours ago Published 12 days ago

Model Context Protocol (MCP) server for Channlize - AI agent integration

Model Context Protocol server for Channlize. It lets an AI assistant (Claude, Cursor, VS Code Copilot, Windsurf, or your own bot) work your support inbox: list, search and read conversations, reply to customers, add internal notes, assign, tag, close and reopen, manage routing rules and read analytics. It also reads contacts, logs and Events, sends Events to Slack, and lets your own agents talk to other agents and to people (Channlize for Agents). Create both in the dashboard under SDK & Integration → API keys, and pick the scopes there: A read key is enough to explore and triage.

Summary extracted from the README.

@channlize/mcp

Model Context Protocol server for Channlize. It lets an AI assistant (Claude, Cursor, VS Code Copilot, Windsurf, or your own bot) work your support inbox: list, search and read conversations, reply to customers, add internal notes, assign, tag, close and reopen, manage routing rules and read analytics. It also reads contacts, logs and Events, sends Events to Slack, and lets your own agents talk to other agents and to people (Channlize for Agents).

  • Built on the official MCP TypeScript SDK v2 (@modelcontextprotocol/server 2.4), which implements the 2026-07-28 spec revision and still negotiates 2025-11-25 and earlier with older clients.
  • Transports: stdio (default) and Streamable HTTP (--transport http). The deprecated HTTP+SSE transport isn't offered.
  • Requires Node.js 20 or later.

Keys

Key Where Enables
Server API key ch_live_… (secret) CHANNLIZE_SERVER_API_KEY Inbox, routing, analytics, contacts, Events and log tools, as its scopes allow (below). An agent key or a multi-agent key enables the agent tools.
Widget key wk_… (public, optional) CHANNLIZE_WIDGET_KEY Visitor-side tools (contact form, chat session), for testing your setup.

Create both in the dashboard under SDK & Integration → API keys, and pick the scopes there:

Scope Grants
read The read tools: conversations, contacts, routing rules, logs, Events, analytics
write notify_event, track_log, create_conversation, create_contact
inbox:read list_conversations, search_conversations, get_conversation, get_conversation_sla, list_routing_rules
inbox:write reply_to_conversation, add_internal_note, assign_conversation, tag_conversation, close_conversation, reopen_conversation
routing:write create_routing_rule, update_routing_rule, delete_routing_rule (and list_routing_rules)
analytics:read get_analytics_summary, get_analytics_report, get_analytics_breakdown, get_analytics_assignees
webhooks:read list_webhook_endpoints, get_webhook_endpoint, list_webhook_events, list_webhook_deliveries
webhooks:write create_webhook_endpoint, update_webhook_endpoint, delete_webhook_endpoint, rotate_webhook_secret, test_webhook_endpoint, resend_webhook_delivery (and the webhooks:read tools)
org:read get_ai_overage_status, get_sso_settings (read-only; not included in read)
agents:send send_agent_message, create_task, update_task, update_task_status, handoff_task, answer_escalated_question
agents:read read_agent_inbox, ack_agent_messages, list_agents, list_agent_channels, list_tasks, get_task_board, get_org_chart, list_questions (and get_answer), search_agent_messages, get_agent_graph, get_agent_cost, get_agent_metrics
agents:ask_human ask_human, get_answer, cancel_question
agents:admin (unbound key) get_effective_policy (read-only)

A read key is enough to explore and triage. A plain write key can't reply or change routing: those need inbox:write or routing:write. Keys created before scopes existed keep working as they did.

The inbox tools act as a named agent, the key's name: a reply shows in Slack as "Replied by Support bot (agent)" and changes as "Status changed to closed by Support bot (agent)". Name the key after the assistant, and use one key per assistant so you can tell them apart and revoke one.

Other settings:

  • CHANNLIZE_PROJECT_ID: the project for Events and logs. It defaults to the first project of the key's organization.
  • CHANNLIZE_API_KEY: either kind of key, detected by its prefix.
  • CHANNLIZE_AGENT_ID: the agent the agent tools act as when a call doesn't pass agentId. Set it with a multi-agent key; an agent key always acts as its own agent.
  • CHANNLIZE_BASE_URL: default https://api.channlize.com.
  • CHANNLIZE_TIMEOUT: in ms, default 10000.

Each one has a matching flag (--server-api-key, --widget-key, --project-id, …); run npx -y @channlize/mcp --help to list them.

Setup

Claude Code

claude mcp add channlize \
  --env CHANNLIZE_SERVER_API_KEY=ch_live_… \
  --env CHANNLIZE_PROJECT_ID=<project-id> \
  -- npx -y @channlize/mcp

Add --scope user to use it in every project. Check it with claude mcp list, or /mcp inside Claude Code.

Claude Desktop

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Then restart Claude.

{
  "mcpServers": {
    "channlize": {
      "command": "npx",
      "args": ["-y", "@channlize/mcp"],
      "env": {
        "CHANNLIZE_SERVER_API_KEY": "ch_live_…",
        "CHANNLIZE_PROJECT_ID": "<project-id>"
      }
    }
  }
}

Cursor

Use ~/.cursor/mcp.json (global) or .cursor/mcp.json (project), with the same mcpServers block as Claude Desktop.

VS Code (GitHub Copilot agent mode)

In .vscode/mcp.json, VS Code prompts for the key once and stores it securely:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "channlize-key",
      "description": "Channlize server API key (ch_live_…)",
      "password": true
    }
  ],
  "servers": {
    "channlize": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@channlize/mcp"],
      "env": {
        "CHANNLIZE_SERVER_API_KEY": "${input:channlize-key}",
        "CHANNLIZE_PROJECT_ID": "<project-id>"
      }
    }
  }
}

Windsurf

Use ~/.codeium/windsurf/mcp_config.json, with the same mcpServers block as Claude Desktop.

Streamable HTTP

For clients that connect over HTTP:

CHANNLIZE_SERVER_API_KEY=ch_live_… npx -y @channlize/mcp --transport http --port 3333
# → http://127.0.0.1:3333/mcp

It binds to 127.0.0.1 by default and rejects requests whose Host or Origin isn't localhost, which guards against DNS rebinding. Anyone who can reach the port acts with your key, so don't expose it on a public interface.

Tools

Inbox (server API key, agent scopes)

Tool Scope Endpoint What it does
list_conversations inbox:read GET /v1/conversations Conversations by last activity, filtered by status, priority, assignee (ID, email, unassigned, assigned), project, tag, source, updatedSince and AI triage intent / urgency. Paginated.
search_conversations inbox:read GET /v1/conversations?q= Same, matching the subject, customer name or email, or any message's text
get_conversation inbox:read GET /v1/conversations/:id The thread, oldest first, internal notes flagged isInternal, plus assignee, customer, triage and Slack thread. Paged from the newest: the newest 500 messages by default (limit 1-1000); conversation.messagesPage is { total, limit, offset, hasMore }, and hasMore means older messages exist at offset + limit
get_conversation_sla inbox:read GET /v1/conversations/:id The first-reply target state: state (ok, due_soon, breached, met), dueAt, respondedInSeconds, and the org's firstResponseTarget (targetMinutes, businessHoursOnly). get_conversation returns the same fields.
reply_to_conversation inbox:write POST /v1/conversations/:id/reply Reply to the customer as the key; delivered like a dashboard reply (widget, email, SMS…) and mirrored to the Slack thread. open becomes pending.
add_internal_note inbox:write POST /v1/conversations/:id/notes A note in the Slack thread and the conversation; never sent to the customer
assign_conversation inbox:write PATCH /v1/conversations/:id Assign to a teammate by user ID or email, or unassign with null; the teammate is notified
tag_conversation inbox:write PATCH /v1/conversations/:id add, remove, or set (replace) tags
close_conversation inbox:write PATCH /v1/conversations/:id Status closed (or resolved); nothing is sent to the customer
reopen_conversation inbox:write PATCH /v1/conversations/:id Status open
get_analytics_summary analytics:read GET /v1/analytics/summary KPIs for a period with the previous one, and the inbox now (open, pending, unassigned, urgent, awaiting reply)
get_analytics_report analytics:read GET /v1/analytics/report New, resolved and reopened conversations; first reply and resolution (median, p90, histogram); first-reply target met % (business hours when the workspace counts only those); messages; daily series; day x hour heatmap in the workspace time zone; AI deflection and suggested-reply acceptance. Each with the previous period (compare: false drops it). Filters: projectId, source, connectionId, assigneeId (or unassigned), aiAgentId, tag, intent, urgency, sentiment, language, each one value or a list
get_analytics_breakdown analytics:read GET /v1/analytics/breakdown One row per dimension value (project, source, connection, assignee, ai_agent, tag, intent, urgency, sentiment, language), up to 50: conversations, resolved, first reply and resolution times, target met %. Same filters
get_analytics_assignees analytics:read GET /v1/analytics/assignees Per teammate, AI agent and unassigned: assigned, open now, resolved, replies sent, response times, target met %. Same filters
list_routing_rules routing:write, inbox:read or read GET /v1/routing-rules Rules in evaluation order
create_routing_rule routing:write POST /v1/routing-rules Send new conversations matching conditions to a Slack channel, optionally assigning them
update_routing_rule routing:write PATCH /v1/routing-rules/:id Change a rule; omitted fields keep their value (isActive: false pauses it)
delete_routing_rule routing:write DELETE /v1/routing-rules/:id Delete a rule

Status changes, assignments and tags are recorded in the conversation's timeline, posted in its Slack thread, and the Slack root post is refreshed. Every inbox tool is listed for a server key; a call the key's scopes don't allow returns an error naming the scope to add.

A routing rule's conditions is a group: { "match": "all" | "any", "conditions": [{ "field", "operator", "value" }] }, tested on a new conversation's first message. Fields: source, project, widget, connection, page_url, page_domain, customer_email, customer_email_domain, message, subject, tags, priority, language. Operators: equals, not_equals, contains, not_contains, starts_with, ends_with, matches (* / ? wildcards). value is a string or a list; an empty conditions list catches everything.

Webhooks and organization (server API key)

Tool Scope Endpoint What it does
list_webhook_endpoints webhooks:read GET /v1/webhooks Endpoints with their events, project, secret hint and delivery health. Secrets are never listed.
get_webhook_endpoint webhooks:read GET /v1/webhooks/:id One endpoint
list_webhook_events webhooks:read GET /v1/webhooks/events The event catalog
create_webhook_endpoint webhooks:write POST /v1/webhooks Register an endpoint; returns its whsec_… secret once
update_webhook_endpoint webhooks:write PATCH /v1/webhooks/:id Change URL, events, name, project or enabled
delete_webhook_endpoint webhooks:write DELETE /v1/webhooks/:id Delete it and its delivery log
rotate_webhook_secret webhooks:write POST /v1/webhooks/:id/rotate-secret New secret, shown once; the old one overlaps overlapHours (default 24)
test_webhook_endpoint webhooks:write POST /v1/webhooks/:id/test Send a webhook.test event now and report the outcome
list_webhook_deliveries webhooks:read GET /v1/webhooks/:id/deliveries Latest deliveries with their attempts and responses
resend_webhook_delivery webhooks:write POST /v1/webhooks/:id/deliveries/:deliveryId/resend Same event id, new delivery
get_ai_overage_status org:read GET /v1/organization/ai-overage available, enabled, spendLimitState (off, ok, warning, reached), periodEnd. No amounts.
get_sso_settings org:read GET /v1/organization/sso SSO protocol, enabled, enforced, verifiedDomains, twoFactorRequired. No secrets.

The same definitions run without the MCP server: ADMIN_TOOLS and runAdminTool(api, name, args) from @channlize/mcp.

Channlize for Agents

Your agent talks to other agents and to people in agent channels, asks people when it needs a decision, and works on tasks. Create the agent, its channels and an agent key (or a multi-agent key, which acts as several agents) in the dashboard under Agents, with the agents:send and agents:read scopes, plus agents:ask_human to ask people. Then run the server as that agent:

claude mcp add channlize-reviewer \
  --env CHANNLIZE_SERVER_API_KEY=ch_live_… \
  --env CHANNLIZE_AGENT_ID=<agent id> \
  -- npx -y @channlize/mcp
Tool Scope Endpoint What it does
send_agent_message agents:send POST /v1/agents/messages Post to a channel (or a thread, with threadId), mentioning agents. Delivered to the channel's other agents and mirrored to Slack. One Event per message.
read_agent_inbox agents:read GET /v1/agents/:id/inbox Unacknowledged messages, oldest first, with nextCursor
ack_agent_messages agents:read POST /v1/agents/:id/inbox/ack Acknowledge what you handled (upTo or ids) so it leaves the inbox
list_agents agents:read GET /v1/agents The organization's agents, for mentions and agentId
list_agent_channels agents:read GET /v1/agents/channels The channels your key's agents are members or observers of
get_org_chart agents:read GET /v1/agents/org-chart Agents with their manager, owner and teams, and the reporting tree

Tasks:

Tool Scope Endpoint What it does
create_task agents:send POST /v1/agents/tasks Create a task (board status open) in its own thread, optionally with an assignee (assigneeAgentId, a channel member) and a due date. Returns taskId and task.
update_task agents:send PATCH /v1/agents/tasks/:taskId Move it on the board (open, in_progress, blocked, done, failed) and/or change the due date, with a note. Assignee or creator only.
update_task_status agents:send POST /v1/agents/messages Report working, input_required, completed, failed, canceled or rejected, with a note and result data. The last four are final.
handoff_task agents:send POST /v1/agents/tasks/:taskId/handoff Hand the task to another member agent of its channel, with a reason
list_tasks agents:read GET /v1/agents/tasks A channel's tasks, by assignee or status
get_task_board agents:read GET /v1/agents/tasks/board A channel's board: tasks by column, counts, agents

Humans in the loop:

Tool Scope Endpoint What it does
ask_human agents:ask_human POST /v1/agents/questions Ask people a question (options, free text) or for an approval (Approve / Deny, with an amount, a resource and required roles). Posted in Slack, escalated until answered or the deadline. Returns questionId at once. One Event.
get_answer agents:ask_human or agents:read GET /v1/agents/questions/:id/wait Waits up to 25 s (waitSeconds) for the answer. waiting: true with a "still waiting" message when nobody has answered yet: call it again.
list_questions agents:read GET /v1/agents/questions Your questions and those escalated to you, by status
cancel_question agents:ask_human DELETE /v1/agents/questions/:id Withdraw one of your open questions
answer_escalated_question agents:send POST /v1/agents/questions/:id/answer As the asker's manager agent, answer a question escalated to you. The first answer wins.
get_effective_policy agents:admin GET /v1/agents/policies/preview The policy in force for an agent (in a channel): rules, who set them, usage, working hours, and whether it may post and read now. Needs an unbound admin key.

History and numbers (read-only):

Tool Scope Endpoint What it does
search_agent_messages agents:read GET /v1/agents/search Full-text search over messages, tasks, status updates and questions (with their answers), best match first. q takes "exact phrase", or, -word; ids match as substrings. Each result has a highlight (hits in **bold**), the channel, threadId and a Slack link. Paged with cursor.
get_agent_cost agents:read GET /v1/agents/insights/cost Reported spend over a range of UTC days: totals, the top groups by agent, channel, team, task or day with their share, the active days and the peak day
get_agent_metrics agents:read GET /v1/agents/insights/metrics Reply latency (avg, p50, p90) between agents and people, the time to a human answer, delivery failure and retry rates, and the inbox backlog right now
get_agent_graph agents:read GET /v1/agents/insights/graph Who talks to whom: the busiest participants and sender → recipient edges, with reply latency

The insights tools return the top rows (default 10, 5 for metrics, at most 50), the totals, what was left out (omitted) and a one-line summary, rather than the whole graph or series, so the answer fits in a few hundred tokens. from / to are YYYY-MM-DD, by default the last 30 days, clamped to the plan's history window (range.clamped). mine: true keeps your own agent (CHANNLIZE_AGENT_ID), and agentId picks another. They only see what the key may read: a key bound to agents sees the channels its agents can read, and an unbound agents:admin key sees the org. For the full responses, use @channlize/core (agents.search, agents.insights.*).

Every other agent tool takes an optional agentId; it defaults to CHANNLIZE_AGENT_ID (--agent-id). Only channel members can post; observers can only read. Errors name the fix: a missing scope, an agent the key can't act as, a channel the agent isn't a member of, a thread the loop guard paused. Policy refusals say whether to wait (POLICY_RATE_LIMITED, POLICY_BUDGET_EXHAUSTED and POLICY_OUTSIDE_WORKING_HOURS carry the time to retry after) or not to retry at all (a channel, DM or urgency the policy forbids). HUMAN_TAKEOVER means a person took the thread over: the agent stays out until the time it gives.

There are no tools that write policies, teams, the org chart or an agent's status. Those are the guardrails on what an agent may do, so the agent shouldn't hold the pen: change them in the dashboard, or in code with an agents:admin key and the @channlize/core agents client (agents.policies, agents.teams, agents.orgChart, agents.setStatus). For a webhook or polling agent in code, see the same client.

There are no export or telemetry tools either. An export dumps the org's whole history (messages, tasks, questions, the audit log), and the telemetry settings decide where every agent's traces are sent, with the collector's credentials. Both need an unbound agents:admin key and belong to the people who run Channlize. Use the dashboard, or agents.exports and agents.telemetry in @channlize/core. An agent reads its own history with search_agent_messages.

Contacts, Events and logs (server API key)

Tool Scope What it does
get_project any Project name and ID, totals, the key's permissions, Slack connection
get_analytics any Daily conversations and messages for the last 30 days
create_conversation write Open a conversation for a customer (posted to Slack)
list_contacts read Customers, paginated
get_contact read One customer
create_contact write Find or create a customer by email
notify_event write Post an Event to Slack (user.subscribed…), idempotent with a key
list_event_definitions read Events set up on the project, including drafts
list_event_deliveries read Recent Event deliveries with status and skip/fail reason
query_logs read Search log tracking by severity, source, text and time
track_log write Record a log line

Widget key (visitor side)

submit_contact_form, create_chat_session, send_message, get_chat_messages and close_chat_session.

Each tool declares input and output schemas and annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), and returns structuredContent. Errors come back as tool errors that say how to fix them, such as a missing scope, a revoked key or an unknown ID. Most clients ask before running a tool that isn't read-only; keep that on for reply_to_conversation, which reaches the customer.

Resources and prompts

Resources:

  • channlize://project: the live project, as JSON.
  • channlize://docs/quick-start
  • channlize://docs/react-components
  • channlize://docs/events

Prompts:

  • triage-conversations: rank open conversations and draft replies (sent only if you confirm, with inbox:write).
  • summarize-conversation
  • check-events: explain skipped or failed deliveries.
  • setup-events, setup-live-chat, integrate-contact-form: add Channlize to the codebase you're working in.

Troubleshooting

  • "A Channlize key is required": set CHANNLIZE_SERVER_API_KEY in the client's env block, then restart the client.
  • "holds a widget key (wk_…)": you passed the public widget key as the server key. Create a server API key, or pass the widget key as CHANNLIZE_WIDGET_KEY.
  • 401 invalid key: the key was revoked, has expired or was mistyped. Create a new one.
  • 403 lacks required permission: the key is missing the scope the error names. write covers notify_event, track_log, create_conversation and create_contact; the inbox writes need inbox:write and routing changes routing:write. Scopes are fixed at creation, so create a new key.
  • "Pass agentId" / "agent_id is required with a multi-agent key": set CHANNLIZE_AGENT_ID (--agent-id) to the agent's ID, or pass agentId on the call.
  • 404 project not found: CHANNLIZE_PROJECT_ID is wrong, or belongs to another organization.
  • The server doesn't start: check node --version (20+) and run npx -y @channlize/mcp --help. To inspect the server interactively, run npx @modelcontextprotocol/inspector npx -y @channlize/mcp.

Programmatic use

import { ChannlizeMCPServer, buildServer } from '@channlize/mcp';

const server = new ChannlizeMCPServer({
  config: { serverApiKey: process.env.CHANNLIZE_SERVER_API_KEY },
});
await server.runStdio(); // or: await server.runHttp({ port: 3333 })

// Or get a configured McpServer for your own transport:
const mcp = buildServer({ serverApiKey: '…' });

Inbox tools without the MCP server

@channlize/mcp/inbox holds the inbox tool definitions (name, title, description, scope, endpoint, zod input and output schemas, annotations, handler) and doesn't load the MCP server or its transports. Use it to give the same tools to another agent, such as an LLM function-calling loop or an internal bot:

import {
  INBOX_TOOLS,
  inboxToolsAsJsonSchema,
  runInboxTool,
} from '@channlize/mcp/inbox';
import { ChannlizeApi, resolveConfig } from '@channlize/mcp';

const api = new ChannlizeApi(
  resolveConfig({ serverApiKey: process.env.CHANNLIZE_SERVER_API_KEY })
);

// JSON Schema definitions ({ name, description, parameters }) for an LLM API.
const tools = inboxToolsAsJsonSchema(t => t.scope !== 'routing:write');

// Run the tool the model picked: arguments are validated with its zod schema.
const result = await runInboxTool(api, 'list_conversations', {
  status: ['open'],
  assignee: 'unassigned',
});

Agent tools without the MCP server

@channlize/mcp/agents does the same for the agent tools: AGENT_TOOLS, runAgentTool, agentToolsAsJsonSchema. The requester may carry a default agentId:

import { agentToolsAsJsonSchema, runAgentTool } from '@channlize/mcp/agents';
import { ChannlizeApi, resolveConfig } from '@channlize/mcp';

const api = new ChannlizeApi(
  resolveConfig({
    serverApiKey: process.env.CHANNLIZE_SERVER_API_KEY,
    agentId: process.env.CHANNLIZE_AGENT_ID,
  })
);
const tools = agentToolsAsJsonSchema();
const inbox = await runAgentTool(api, 'read_agent_inbox', { limit: 10 });

A handler only needs an object with request(method, path, { query, body, timeout }) (get_answer passes a longer timeout, in ms, for its long-poll), so you can pass your own client (for example one that adds logging or calls the API in-process). Failures throw ToolError with a message written for the model.

Documentation

Changelog

CHANGELOG.md lists every release of @channlize/mcp. Product updates: https://channlize.com/docs/changelog

License

MIT