@channlize/mcp 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/README.md +117 -324
- package/dist/index.d.mts +83 -78
- package/dist/index.d.ts +83 -78
- package/dist/index.js +1091 -1599
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1090 -1600
- package/dist/index.mjs.map +1 -1
- package/dist/server.js +1191 -1706
- package/dist/server.js.map +1 -1
- package/package.json +12 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# @channlize/mcp
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Release every `@channlize/*` package under one shared version. From 0.4.0 on, core, react, mcp and skills always publish together at the same version, so matching versions work together.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 5663cd2: Make `@channlize/core` the single source for what the packages share.
|
|
12
|
+
|
|
13
|
+
- core exports `DEFAULT_BASE_URL`, `DEFAULT_TIMEOUT`, `EVENT_SEVERITIES`, `EVENT_KEY_PATTERN`, `isValidEventKey`, `keyKind` (widget vs. server key), `readChannlizeEnv` (the `CHANNLIZE_*` variables) and `parseApiError` (the API's error shape). `createNotifier`, the client and `@channlize/mcp` use them instead of their own copies.
|
|
14
|
+
- `ChannlizeError` gains `requestId` and `details` (the API's error body, e.g. `limit`, `used` and `resetAt` on a plan-limit 429). When a legacy route puts its human-readable text in `error`, it becomes the message instead of `HTTP <status>`.
|
|
15
|
+
- The chat types document where the API differs from them (ISO string timestamps, session summaries without `messages`).
|
|
16
|
+
- `@channlize/react` and `@channlize/mcp` re-export the error classes as values, so `instanceof` works without importing core.
|
|
17
|
+
- mcp tool errors no longer end with a doubled period when a core error message ends with one.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [5663cd2]
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @channlize/core@0.4.0
|
|
22
|
+
|
|
23
|
+
## 0.3.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- 7e72a95: Rebuild the MCP server on the official MCP TypeScript SDK v2 (`@modelcontextprotocol/server`, `McpServer.registerTool`), with zod input and output schemas, structured content, tool annotations and clear tool errors.
|
|
28
|
+
|
|
29
|
+
- New server-key tools: `get_project`, `get_analytics`, `list_conversations`, `get_conversation`, `create_conversation`, `list_contacts`, `get_contact`, `create_contact`, `list_event_definitions`, `list_event_deliveries`, `query_logs`, `track_log`. `notify_event` now resolves the project from the key when `CHANNLIZE_PROJECT_ID` is unset.
|
|
30
|
+
- Keys: `CHANNLIZE_SERVER_API_KEY` enables the server tools and `CHANNLIZE_WIDGET_KEY` the visitor tools (contact form, chat). `CHANNLIZE_API_KEY` accepts either key and detects it by prefix. A widget key passed as the server key fails at startup with a clear message. Only tools for the configured keys are listed.
|
|
31
|
+
- New Streamable HTTP transport (`--transport http`, localhost-only by default, with Host/Origin checks). stdio stays the default.
|
|
32
|
+
- Rewritten resources (`channlize://project` plus quick-start, React and Events docs) and prompts (`triage-conversations`, `summarize-conversation`, `check-events`, `setup-events`, `setup-live-chat`, `integrate-contact-form`). The `customize-styling` and `handle-webhooks` prompts and the old schema/API-reference resources are removed, since they described APIs that don't exist.
|
|
33
|
+
- Breaking: requires Node.js 20+. `listTools` / `getTool` / `listResources` / `getPrompt` and `setConfig` are no longer exported; use `buildServer(config)` to get a configured `McpServer`.
|
|
34
|
+
|
|
35
|
+
## 0.2.0
|
|
36
|
+
|
|
37
|
+
### Minor Changes
|
|
38
|
+
|
|
39
|
+
- c113208: Add Events: post a Slack message from your server when something happens.
|
|
40
|
+
|
|
41
|
+
- `@channlize/core`: `client.notify(event, data?, { idempotencyKey?, channel? })` and a standalone `createNotifier()` that reads `CHANNLIZE_SERVER_API_KEY` / `CHANNLIZE_API_KEY` and `CHANNLIZE_PROJECT_ID`. Both call `POST /v1/notify` with the server API key (write scope). Event keys and data can be typed with `createNotifier<AppEvents>()` or by augmenting `ChannlizeEvents`. `trackEvent` / `trackServerEvent` are unchanged and now documented as log tracking. Fix: an explicit `baseUrl: undefined` or `timeout: undefined` no longer overrides the defaults.
|
|
42
|
+
- `@channlize/mcp`: new `notify_event` tool, enabled with `--server-api-key` / `CHANNLIZE_SERVER_API_KEY`.
|
|
43
|
+
- `@channlize/react`: docs only. `useChannlizeAnalytics().track` is documented as log tracking.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [c113208]
|
|
48
|
+
- @channlize/core@0.2.0
|
|
49
|
+
|
|
3
50
|
## 0.1.1
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
|
@@ -7,10 +54,11 @@
|
|
|
7
54
|
- 9ddf630: Errors thrown by the client now carry the API's human-readable `message`
|
|
8
55
|
(field messages joined for validation failures) instead of the error code,
|
|
9
56
|
and `ChannlizeError.code` is set from the API's `error` code.
|
|
10
|
-
|
|
57
|
+
|
|
11
58
|
`CreateContactResponse` gains the fields the API actually returns:
|
|
12
59
|
`success`, `conversationId` and `message`. The old `id`, `status` and
|
|
13
60
|
`slackThreadUrl` fields were never returned and are deprecated. The MCP
|
|
14
61
|
`submit_contact_form` tool now reports `conversationId`.
|
|
62
|
+
|
|
15
63
|
- Updated dependencies [9ddf630]
|
|
16
64
|
- @channlize/core@0.1.0
|
package/README.md
CHANGED
|
@@ -1,394 +1,187 @@
|
|
|
1
1
|
# @channlize/mcp
|
|
2
2
|
|
|
3
|
-
Model Context Protocol
|
|
3
|
+
[Model Context Protocol](https://modelcontextprotocol.io) server for [Channlize](https://channlize.com). It lets an AI assistant (Claude, Cursor, VS Code Copilot, Windsurf…) read your support inbox, contacts, logs and Events, and send Events to Slack.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- 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.
|
|
6
|
+
- Transports: **stdio** (default) and **Streamable HTTP** (`--transport http`). The deprecated HTTP+SSE transport isn't offered.
|
|
7
|
+
- Requires Node.js 20 or later.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Keys
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
| Key | Where | Enables |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| Server API key `ch_live_…` (secret) | `CHANNLIZE_SERVER_API_KEY` | Inbox, contacts, Events and log tools. `read` scope for the read tools, `write` scope to send Events and logs and open conversations or contacts. |
|
|
14
|
+
| Widget key `wk_…` (public, optional) | `CHANNLIZE_WIDGET_KEY` | Visitor-side tools (contact form, chat session), for testing your setup. |
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Create both in the dashboard under **SDK & Integration → API keys**. A read-only key is enough to explore and triage; use a `write` key only if the assistant should post to Slack.
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
Other settings:
|
|
19
|
+
|
|
20
|
+
- `CHANNLIZE_PROJECT_ID`: the project for Events and logs. It defaults to the first project of the key's organization.
|
|
21
|
+
- `CHANNLIZE_API_KEY`: either kind of key, detected by its prefix.
|
|
22
|
+
- `CHANNLIZE_BASE_URL`: default `https://api.channlize.com`.
|
|
23
|
+
- `CHANNLIZE_TIMEOUT`: in ms, default 10000.
|
|
24
|
+
|
|
25
|
+
Each one has a matching flag (`--server-api-key`, `--widget-key`, `--project-id`, …); run `npx -y @channlize/mcp --help` to list them.
|
|
26
|
+
|
|
27
|
+
## Setup
|
|
28
|
+
|
|
29
|
+
### Claude Code
|
|
16
30
|
|
|
17
31
|
```bash
|
|
18
|
-
|
|
32
|
+
claude mcp add channlize \
|
|
33
|
+
--env CHANNLIZE_SERVER_API_KEY=ch_live_… \
|
|
34
|
+
--env CHANNLIZE_PROJECT_ID=<project-id> \
|
|
35
|
+
-- npx -y @channlize/mcp
|
|
19
36
|
```
|
|
20
37
|
|
|
21
|
-
|
|
38
|
+
Add `--scope user` to use it in every project. Check it with `claude mcp list`, or `/mcp` inside Claude Code.
|
|
22
39
|
|
|
23
|
-
###
|
|
40
|
+
### Claude Desktop
|
|
24
41
|
|
|
25
|
-
|
|
42
|
+
Edit `claude_desktop_config.json`:
|
|
26
43
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"mcpServers": {
|
|
30
|
-
"channlize": {
|
|
31
|
-
"command": "npx",
|
|
32
|
-
"args": [
|
|
33
|
-
"@channlize/mcp",
|
|
34
|
-
"--api-key",
|
|
35
|
-
"your-widget-key-here",
|
|
36
|
-
"--project-id",
|
|
37
|
-
"your-project-id-here"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
```
|
|
44
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
45
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
Then restart Claude.
|
|
45
48
|
|
|
46
49
|
```json
|
|
47
50
|
{
|
|
48
51
|
"mcpServers": {
|
|
49
52
|
"channlize": {
|
|
50
53
|
"command": "npx",
|
|
51
|
-
"args": ["@channlize/mcp"],
|
|
54
|
+
"args": ["-y", "@channlize/mcp"],
|
|
52
55
|
"env": {
|
|
53
|
-
"
|
|
54
|
-
"CHANNLIZE_PROJECT_ID": "
|
|
55
|
-
"CHANNLIZE_BASE_URL": "https://api.channlize.com"
|
|
56
|
+
"CHANNLIZE_SERVER_API_KEY": "ch_live_…",
|
|
57
|
+
"CHANNLIZE_PROJECT_ID": "<project-id>"
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
```
|
|
61
63
|
|
|
62
|
-
###
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
import { ChannlizeMCPServer } from '@channlize/mcp';
|
|
66
|
-
|
|
67
|
-
const server = new ChannlizeMCPServer({
|
|
68
|
-
name: 'my-channlize-server',
|
|
69
|
-
version: '1.0.0',
|
|
70
|
-
config: {
|
|
71
|
-
apiKey: process.env.CHANNLIZE_API_KEY!,
|
|
72
|
-
projectId: process.env.CHANNLIZE_PROJECT_ID,
|
|
73
|
-
baseUrl: process.env.CHANNLIZE_BASE_URL,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Run with stdio transport (for MCP clients)
|
|
78
|
-
await server.runStdio();
|
|
79
|
-
|
|
80
|
-
// Or get the underlying Server instance for custom transports
|
|
81
|
-
const mcpServer = server.getServer();
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Available Resources
|
|
85
|
-
|
|
86
|
-
Resources provide read-only context about Channlize:
|
|
87
|
-
|
|
88
|
-
| URI | Description |
|
|
89
|
-
|-----|-------------|
|
|
90
|
-
| `channlize://schema/contact-form` | JSON schema for contact form data structure |
|
|
91
|
-
| `channlize://schema/chat-session` | JSON schema for chat session data structure |
|
|
92
|
-
| `channlize://docs/api-reference` | Complete Channlize API reference documentation |
|
|
93
|
-
| `channlize://docs/quick-start` | Quick start guide for using Channlize SDK |
|
|
94
|
-
| `channlize://docs/react-components` | Documentation for React components and hooks |
|
|
95
|
-
|
|
96
|
-
### Example Usage in Claude
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
Can you show me the contact form schema?
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Claude will read the `channlize://schema/contact-form` resource to understand the data structure.
|
|
103
|
-
|
|
104
|
-
## Available Tools
|
|
105
|
-
|
|
106
|
-
Tools allow AI agents to interact with Channlize:
|
|
64
|
+
### Cursor
|
|
107
65
|
|
|
108
|
-
|
|
66
|
+
Use `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project), with the same `mcpServers` block as Claude Desktop.
|
|
109
67
|
|
|
110
|
-
|
|
68
|
+
### VS Code (GitHub Copilot agent mode)
|
|
111
69
|
|
|
112
|
-
|
|
113
|
-
- `name` (string, required): Contact's full name
|
|
114
|
-
- `email` (string, required): Contact's email address
|
|
115
|
-
- `message` (string, required): The message content
|
|
116
|
-
- `subject` (string, optional): Subject line
|
|
117
|
-
- `customFields` (object, optional): Additional custom fields
|
|
118
|
-
- `pageUrl` (string, optional): URL where form was submitted
|
|
119
|
-
- `userAgent` (string, optional): User agent string
|
|
70
|
+
In `.vscode/mcp.json`, VS Code prompts for the key once and stores it securely:
|
|
120
71
|
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
72
|
+
```json
|
|
123
73
|
{
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
74
|
+
"inputs": [
|
|
75
|
+
{
|
|
76
|
+
"type": "promptString",
|
|
77
|
+
"id": "channlize-key",
|
|
78
|
+
"description": "Channlize server API key (ch_live_…)",
|
|
79
|
+
"password": true
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"servers": {
|
|
83
|
+
"channlize": {
|
|
84
|
+
"type": "stdio",
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["-y", "@channlize/mcp"],
|
|
87
|
+
"env": {
|
|
88
|
+
"CHANNLIZE_SERVER_API_KEY": "${input:channlize-key}",
|
|
89
|
+
"CHANNLIZE_PROJECT_ID": "<project-id>"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
130
92
|
}
|
|
131
93
|
}
|
|
132
94
|
```
|
|
133
95
|
|
|
134
|
-
###
|
|
135
|
-
|
|
136
|
-
Create a new real-time chat session.
|
|
137
|
-
|
|
138
|
-
**Parameters:**
|
|
139
|
-
- `metadata` (object, optional): Custom session metadata
|
|
140
|
-
|
|
141
|
-
**Returns:** Session ID and SSE endpoint for real-time updates
|
|
142
|
-
|
|
143
|
-
### send_message
|
|
144
|
-
|
|
145
|
-
Send a message in an existing chat session.
|
|
146
|
-
|
|
147
|
-
**Parameters:**
|
|
148
|
-
- `sessionId` (string, required): The chat session ID
|
|
149
|
-
- `content` (string, required): Message content
|
|
150
|
-
|
|
151
|
-
### get_chat_messages
|
|
152
|
-
|
|
153
|
-
Retrieve messages from a chat session.
|
|
154
|
-
|
|
155
|
-
**Parameters:**
|
|
156
|
-
- `sessionId` (string, required): The chat session ID
|
|
157
|
-
- `limit` (number, optional): Max messages to retrieve (default: 50)
|
|
158
|
-
- `offset` (number, optional): Number of messages to skip (default: 0)
|
|
159
|
-
|
|
160
|
-
### close_chat_session
|
|
161
|
-
|
|
162
|
-
Close an active chat session.
|
|
163
|
-
|
|
164
|
-
**Parameters:**
|
|
165
|
-
- `sessionId` (string, required): The chat session ID to close
|
|
166
|
-
|
|
167
|
-
## Available Prompts
|
|
168
|
-
|
|
169
|
-
Prompts provide templates for common integration scenarios:
|
|
170
|
-
|
|
171
|
-
### integrate-contact-form
|
|
96
|
+
### Windsurf
|
|
172
97
|
|
|
173
|
-
|
|
98
|
+
Use `~/.codeium/windsurf/mcp_config.json`, with the same `mcpServers` block as Claude Desktop.
|
|
174
99
|
|
|
175
|
-
|
|
176
|
-
- `framework` (optional): React framework being used (e.g., Next.js, Vite)
|
|
177
|
-
- `styling` (optional): Styling approach (e.g., Tailwind, CSS Modules)
|
|
100
|
+
### Streamable HTTP
|
|
178
101
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Guide for implementing the Channlize live chat widget.
|
|
182
|
-
|
|
183
|
-
**Arguments:**
|
|
184
|
-
- `placement` (optional): Widget placement (e.g., "page", "popup", "sidebar")
|
|
185
|
-
|
|
186
|
-
### customize-styling
|
|
187
|
-
|
|
188
|
-
Guide for theming and customizing Channlize components.
|
|
189
|
-
|
|
190
|
-
### handle-webhooks
|
|
191
|
-
|
|
192
|
-
Guide for integrating Channlize webhooks into custom workflows.
|
|
193
|
-
|
|
194
|
-
## CLI Usage
|
|
195
|
-
|
|
196
|
-
The standalone server can be run directly from the command line:
|
|
102
|
+
For clients that connect over HTTP:
|
|
197
103
|
|
|
198
104
|
```bash
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
# Or install globally
|
|
203
|
-
npm install -g @channlize/mcp
|
|
204
|
-
channlize-mcp --api-key wk_123abc --project-id proj_456def
|
|
205
|
-
|
|
206
|
-
# Using environment variables
|
|
207
|
-
export CHANNLIZE_API_KEY=wk_123abc
|
|
208
|
-
export CHANNLIZE_PROJECT_ID=proj_456def
|
|
209
|
-
channlize-mcp
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### CLI Options
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
--api-key <key> Channlize API key (widget key) [required]
|
|
216
|
-
--project-id <id> Channlize project ID
|
|
217
|
-
--base-url <url> Channlize API base URL (default: https://api.channlize.com)
|
|
218
|
-
--timeout <ms> Request timeout in milliseconds (default: 10000)
|
|
219
|
-
-h, --help Show help message
|
|
105
|
+
CHANNLIZE_SERVER_API_KEY=ch_live_… npx -y @channlize/mcp --transport http --port 3333
|
|
106
|
+
# → http://127.0.0.1:3333/mcp
|
|
220
107
|
```
|
|
221
108
|
|
|
222
|
-
|
|
109
|
+
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.
|
|
223
110
|
|
|
224
|
-
|
|
225
|
-
- `CHANNLIZE_PROJECT_ID`: Your project ID
|
|
226
|
-
- `CHANNLIZE_BASE_URL`: API base URL (optional)
|
|
227
|
-
- `CHANNLIZE_TIMEOUT`: Request timeout in ms (optional)
|
|
111
|
+
## Tools
|
|
228
112
|
|
|
229
|
-
|
|
113
|
+
Server API key:
|
|
230
114
|
|
|
231
|
-
|
|
115
|
+
| Tool | Scope | What it does |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| `get_project` | any | Project name and ID, totals, the key's permissions, Slack connection |
|
|
118
|
+
| `get_analytics` | any | Daily conversations and messages for the last 30 days |
|
|
119
|
+
| `list_conversations` | read | Recent conversations, filtered by status or priority |
|
|
120
|
+
| `get_conversation` | read | One conversation with its message thread |
|
|
121
|
+
| `create_conversation` | write | Open a conversation for a customer (posted to Slack) |
|
|
122
|
+
| `list_contacts` | read | Customers, paginated |
|
|
123
|
+
| `get_contact` | read | One customer |
|
|
124
|
+
| `create_contact` | write | Find or create a customer by email |
|
|
125
|
+
| `notify_event` | write | Post an Event to Slack (`user.subscribed`…), idempotent with a key |
|
|
126
|
+
| `list_event_definitions` | read | Events set up on the project, including drafts |
|
|
127
|
+
| `list_event_deliveries` | read | Recent Event deliveries with status and skip/fail reason |
|
|
128
|
+
| `query_logs` | read | Search log tracking by severity, source, text and time |
|
|
129
|
+
| `track_log` | write | Record a log line |
|
|
232
130
|
|
|
233
|
-
|
|
131
|
+
Widget key (visitor side): `submit_contact_form`, `create_chat_session`, `send_message`, `get_chat_messages` and `close_chat_session`.
|
|
234
132
|
|
|
235
|
-
|
|
236
|
-
- "What is Channlize and how does it work?"
|
|
237
|
-
- "Show me how to integrate a contact form"
|
|
238
|
-
- "What's the structure of a chat session?"
|
|
133
|
+
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.
|
|
239
134
|
|
|
240
|
-
|
|
241
|
-
- "Submit a contact form with name 'John Doe', email 'john@example.com', and message 'Need help with billing'"
|
|
135
|
+
You can't reply to a conversation or change its status or priority through the API yet. The team does that in the Slack thread or the dashboard.
|
|
242
136
|
|
|
243
|
-
|
|
244
|
-
- "Create a new chat session"
|
|
245
|
-
- "Send a message 'Hello!' to session session_123"
|
|
246
|
-
- "Get messages from session session_123"
|
|
137
|
+
## Resources and prompts
|
|
247
138
|
|
|
248
|
-
|
|
249
|
-
- "Show me how to add a contact form to my Next.js app with Tailwind CSS"
|
|
250
|
-
- "How do I set up webhooks for Channlize?"
|
|
139
|
+
Resources:
|
|
251
140
|
|
|
252
|
-
|
|
141
|
+
- `channlize://project`: the live project, as JSON.
|
|
142
|
+
- `channlize://docs/quick-start`
|
|
143
|
+
- `channlize://docs/react-components`
|
|
144
|
+
- `channlize://docs/events`
|
|
253
145
|
|
|
254
|
-
|
|
146
|
+
Prompts:
|
|
255
147
|
|
|
256
|
-
|
|
148
|
+
- `triage-conversations`: rank open conversations and draft replies.
|
|
149
|
+
- `summarize-conversation`
|
|
150
|
+
- `check-events`: explain skipped or failed deliveries.
|
|
151
|
+
- `setup-events`, `setup-live-chat`, `integrate-contact-form`: add Channlize to the codebase you're working in.
|
|
257
152
|
|
|
258
|
-
|
|
259
|
-
class ChannlizeMCPServer {
|
|
260
|
-
constructor(options?: MCPServerOptions);
|
|
261
|
-
|
|
262
|
-
setConfig(config: ChannlizeMCPConfig): void;
|
|
263
|
-
getServer(): Server;
|
|
264
|
-
runStdio(): Promise<void>;
|
|
265
|
-
close(): Promise<void>;
|
|
266
|
-
}
|
|
267
|
-
```
|
|
153
|
+
## Troubleshooting
|
|
268
154
|
|
|
269
|
-
|
|
155
|
+
- **"A Channlize key is required"**: set `CHANNLIZE_SERVER_API_KEY` in the client's `env` block, then restart the client.
|
|
156
|
+
- **"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`.
|
|
157
|
+
- **401 invalid key**: the key was revoked, has expired or was mistyped. Create a new one.
|
|
158
|
+
- **403 lacks required permission**: the key is read-only. Create a key with the `write` scope for `notify_event`, `track_log`, `create_conversation` and `create_contact`.
|
|
159
|
+
- **404 project not found**: `CHANNLIZE_PROJECT_ID` is wrong, or belongs to another organization.
|
|
160
|
+
- **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`.
|
|
270
161
|
|
|
271
|
-
|
|
272
|
-
interface ChannlizeMCPConfig {
|
|
273
|
-
apiKey: string;
|
|
274
|
-
projectId?: string;
|
|
275
|
-
baseUrl?: string;
|
|
276
|
-
timeout?: number;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
interface MCPServerOptions {
|
|
280
|
-
name?: string;
|
|
281
|
-
version?: string;
|
|
282
|
-
config?: ChannlizeMCPConfig;
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Helper Functions
|
|
287
|
-
|
|
288
|
-
```typescript
|
|
289
|
-
// Resources
|
|
290
|
-
function listResources(): Resource[];
|
|
291
|
-
function getResource(uri: string): Resource | undefined;
|
|
292
|
-
|
|
293
|
-
// Tools
|
|
294
|
-
function listTools(): ToolDefinition[];
|
|
295
|
-
function getTool(name: string): ToolDefinition | undefined;
|
|
296
|
-
|
|
297
|
-
// Prompts
|
|
298
|
-
function listPrompts(): PromptDefinition[];
|
|
299
|
-
function getPrompt(name: string): PromptDefinition | undefined;
|
|
300
|
-
|
|
301
|
-
// Factory
|
|
302
|
-
function createMCPServer(options?: MCPServerOptions): ChannlizeMCPServer;
|
|
303
|
-
```
|
|
162
|
+
## Programmatic use
|
|
304
163
|
|
|
305
|
-
|
|
164
|
+
```ts
|
|
165
|
+
import { ChannlizeMCPServer, buildServer } from '@channlize/mcp';
|
|
306
166
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
```typescript
|
|
310
|
-
import { createMCPServer, listTools, listResources } from '@channlize/mcp';
|
|
311
|
-
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
312
|
-
|
|
313
|
-
// Create server with your config
|
|
314
|
-
const server = createMCPServer({
|
|
315
|
-
config: {
|
|
316
|
-
apiKey: process.env.CHANNLIZE_API_KEY!,
|
|
317
|
-
projectId: process.env.CHANNLIZE_PROJECT_ID,
|
|
318
|
-
},
|
|
167
|
+
const server = new ChannlizeMCPServer({
|
|
168
|
+
config: { serverApiKey: process.env.CHANNLIZE_SERVER_API_KEY },
|
|
319
169
|
});
|
|
170
|
+
await server.runStdio(); // or: await server.runHttp({ port: 3333 })
|
|
320
171
|
|
|
321
|
-
//
|
|
322
|
-
const
|
|
323
|
-
await server.getServer().connect(transport);
|
|
324
|
-
|
|
325
|
-
// List available capabilities
|
|
326
|
-
console.log('Resources:', listResources().map(r => r.uri));
|
|
327
|
-
console.log('Tools:', listTools().map(t => t.name));
|
|
172
|
+
// Or get a configured McpServer for your own transport:
|
|
173
|
+
const mcp = buildServer({ serverApiKey: '…' });
|
|
328
174
|
```
|
|
329
175
|
|
|
330
|
-
##
|
|
331
|
-
|
|
332
|
-
- API keys are required for all tool operations
|
|
333
|
-
- Keys are never exposed in resource responses
|
|
334
|
-
- Webhook signature verification recommended for production
|
|
335
|
-
- Use environment variables for sensitive credentials
|
|
336
|
-
|
|
337
|
-
## Error Handling
|
|
338
|
-
|
|
339
|
-
The server handles and reports errors gracefully:
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
342
|
-
try {
|
|
343
|
-
await client.submitContactForm(data);
|
|
344
|
-
} catch (error) {
|
|
345
|
-
// Error details returned to MCP client
|
|
346
|
-
console.error({
|
|
347
|
-
success: false,
|
|
348
|
-
error: error.message,
|
|
349
|
-
code: error.code,
|
|
350
|
-
statusCode: error.statusCode,
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
## Requirements
|
|
356
|
-
|
|
357
|
-
- Node.js 18+
|
|
358
|
-
- Valid Channlize API key (widget key)
|
|
359
|
-
- Active Channlize project
|
|
360
|
-
|
|
361
|
-
## Related Packages
|
|
176
|
+
## Documentation
|
|
362
177
|
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
|
|
366
|
-
## Contributing
|
|
367
|
-
|
|
368
|
-
See the main [SDK repository](https://github.com/channlize/sdk) for contribution guidelines.
|
|
369
|
-
|
|
370
|
-
## License
|
|
371
|
-
|
|
372
|
-
MIT - see [LICENSE](../../LICENSE) file for details.
|
|
373
|
-
|
|
374
|
-
## Support
|
|
375
|
-
|
|
376
|
-
- Documentation: https://docs.channlize.com
|
|
377
|
-
- GitHub Issues: https://github.com/channlize/sdk/issues
|
|
378
|
-
- Email: support@channlize.com
|
|
178
|
+
- Guide: https://channlize.com/docs/mcp
|
|
179
|
+
- All docs: https://channlize.com/docs (quick start, API keys, troubleshooting)
|
|
379
180
|
|
|
380
181
|
## Changelog
|
|
381
182
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
- MCP server with stdio transport
|
|
385
|
-
- 5 resources (schemas + docs)
|
|
386
|
-
- 5 tools (form submission, chat management)
|
|
387
|
-
- 4 prompts (integration guides)
|
|
388
|
-
- Library and CLI support
|
|
389
|
-
- Full TypeScript support
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
183
|
+
[CHANGELOG.md](./CHANGELOG.md) lists every release of `@channlize/mcp`. Product updates: https://channlize.com/docs/changelog
|
|
393
184
|
|
|
185
|
+
## License
|
|
394
186
|
|
|
187
|
+
MIT
|