@respond-io/mcp-server 1.0.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +21 -0
  3. package/README.md +635 -0
  4. package/dist/constants.d.ts +89 -0
  5. package/dist/constants.d.ts.map +1 -0
  6. package/dist/constants.js +143 -0
  7. package/dist/constants.js.map +1 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +40 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/middlewares/TokenVerifier.d.ts +19 -0
  13. package/dist/middlewares/TokenVerifier.d.ts.map +1 -0
  14. package/dist/middlewares/TokenVerifier.js +68 -0
  15. package/dist/middlewares/TokenVerifier.js.map +1 -0
  16. package/dist/protocol/BaseProtocol.d.ts +4 -0
  17. package/dist/protocol/BaseProtocol.d.ts.map +1 -0
  18. package/dist/protocol/BaseProtocol.js +7 -0
  19. package/dist/protocol/BaseProtocol.js.map +1 -0
  20. package/dist/protocol/HttpStreamProtocol.d.ts +36 -0
  21. package/dist/protocol/HttpStreamProtocol.d.ts.map +1 -0
  22. package/dist/protocol/HttpStreamProtocol.js +148 -0
  23. package/dist/protocol/HttpStreamProtocol.js.map +1 -0
  24. package/dist/protocol/StdioProtocol.d.ts +14 -0
  25. package/dist/protocol/StdioProtocol.d.ts.map +1 -0
  26. package/dist/protocol/StdioProtocol.js +32 -0
  27. package/dist/protocol/StdioProtocol.js.map +1 -0
  28. package/dist/protocol/index.d.ts +4 -0
  29. package/dist/protocol/index.d.ts.map +1 -0
  30. package/dist/protocol/index.js +4 -0
  31. package/dist/protocol/index.js.map +1 -0
  32. package/dist/server.d.ts +13 -0
  33. package/dist/server.d.ts.map +1 -0
  34. package/dist/server.js +36 -0
  35. package/dist/server.js.map +1 -0
  36. package/dist/tools/BaseTool.d.ts +38 -0
  37. package/dist/tools/BaseTool.d.ts.map +1 -0
  38. package/dist/tools/BaseTool.js +39 -0
  39. package/dist/tools/BaseTool.js.map +1 -0
  40. package/dist/tools/comment.tool.d.ts +14 -0
  41. package/dist/tools/comment.tool.d.ts.map +1 -0
  42. package/dist/tools/comment.tool.js +43 -0
  43. package/dist/tools/comment.tool.js.map +1 -0
  44. package/dist/tools/contacts.tool.d.ts +17 -0
  45. package/dist/tools/contacts.tool.d.ts.map +1 -0
  46. package/dist/tools/contacts.tool.js +355 -0
  47. package/dist/tools/contacts.tool.js.map +1 -0
  48. package/dist/tools/conversation.tool.d.ts +14 -0
  49. package/dist/tools/conversation.tool.d.ts.map +1 -0
  50. package/dist/tools/conversation.tool.js +77 -0
  51. package/dist/tools/conversation.tool.js.map +1 -0
  52. package/dist/tools/index.d.ts +7 -0
  53. package/dist/tools/index.d.ts.map +1 -0
  54. package/dist/tools/index.js +7 -0
  55. package/dist/tools/index.js.map +1 -0
  56. package/dist/tools/messaging.tool.d.ts +15 -0
  57. package/dist/tools/messaging.tool.d.ts.map +1 -0
  58. package/dist/tools/messaging.tool.js +160 -0
  59. package/dist/tools/messaging.tool.js.map +1 -0
  60. package/dist/tools/workspace.tool.d.ts +15 -0
  61. package/dist/tools/workspace.tool.d.ts.map +1 -0
  62. package/dist/tools/workspace.tool.js +282 -0
  63. package/dist/tools/workspace.tool.js.map +1 -0
  64. package/dist/types.d.ts +351 -0
  65. package/dist/types.d.ts.map +1 -0
  66. package/dist/types.js +2 -0
  67. package/dist/types.js.map +1 -0
  68. package/dist/utils/api.d.ts +127 -0
  69. package/dist/utils/api.d.ts.map +1 -0
  70. package/dist/utils/api.js +340 -0
  71. package/dist/utils/api.js.map +1 -0
  72. package/package.json +108 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## [1.0.0](https://github.com/respond-io/mcp-server/compare/v0.1.0...v1.0.0) (2026-02-11)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * migrate from axios to Respond.io TypeScript SDK
9
+
10
+ ### Bug Fixes
11
+
12
+ * Add .npmrc to package.json and update release-dev workflow to set publishConfig for GitHub Packages ([7a3f0e2](https://github.com/respond-io/mcp-server/commit/7a3f0e235639ae37f149380acc661e95b950372c))
13
+ * Add postbuild script to copy files and update package.json fields ([f437afe](https://github.com/respond-io/mcp-server/commit/f437afe259d9d6a7727d3b181b01f7deda03d93a))
14
+ * Add shebang to index.ts for executable script support ([f638dd8](https://github.com/respond-io/mcp-server/commit/f638dd8a55e9fe7628b7c72e98e51c22f5db8c83))
15
+ * Clean up package.json by removing the config field and update postbuild script to streamline bin entry assignment ([fda7ecc](https://github.com/respond-io/mcp-server/commit/fda7ecc3ecf20e8f0b261484d813968139e1802d))
16
+ * Configure GitHub Packages for [@respond-io](https://github.com/respond-io) in release workflow ([ddfd7a3](https://github.com/respond-io/mcp-server/commit/ddfd7a31c90d06b76777b238a3bf26e4dfbb3d9a))
17
+ * prevent non-JSON output on stdout for MCP stdio transport ([9a35a37](https://github.com/respond-io/mcp-server/commit/9a35a37cdb2aa5330e1ba1bad0c02973a55e0d8c))
18
+ * Remove .config field from package.json in postbuild script ([b959c96](https://github.com/respond-io/mcp-server/commit/b959c969a2531c8ed3ad319cd64e25f9dd87155c))
19
+ * Remove postbuild script and update package.json to streamline build process and dependency management ([9df393d](https://github.com/respond-io/mcp-server/commit/9df393d12352452391814916119ed306f1cc6004))
20
+ * update axios and its dependencies to latest versions in package-lock.json ([535f360](https://github.com/respond-io/mcp-server/commit/535f36083edaff524a51fd6d063456d6e1ad5fc6))
21
+ * update axios and its dependencies to latest versions in package-lock.json ([bde87c6](https://github.com/respond-io/mcp-server/commit/bde87c6e3430ec8af0a86962f793530a32a63f2f))
22
+ * Update release-dev workflow to correctly publish tarball using package name and version ([52e0d0a](https://github.com/respond-io/mcp-server/commit/52e0d0abe8ac867b931cc33486b463a6918e8d5a))
23
+ * Update release-dev workflow to publish tarball to GitHub Packages and set NODE_AUTH_TOKEN environment variable ([1f73931](https://github.com/respond-io/mcp-server/commit/1f7393108ef850dc2f37db85e943f6e02165591f))
24
+ * Update release:dev script to use GitHub Packages registry and remove redundant npmrc override ([021d515](https://github.com/respond-io/mcp-server/commit/021d515bf8a724ca1010224474e82d7b30eea9bd))
25
+
26
+
27
+ ### Code Refactoring
28
+
29
+ * migrate from axios to Respond.io TypeScript SDK ([b0bfdbe](https://github.com/respond-io/mcp-server/commit/b0bfdbed4ab5c62746d765c0f88eee5b16d27c54))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 [Your Name/Organization]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,635 @@
1
+ # Respond.io MCP Server
2
+
3
+ A Model Context Protocol (MCP) server implementation for the Respond.io API, enabling seamless integration with AI assistants, automation tools, and Claude Desktop.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ ### Contact Management
10
+ - ✅ Get, create, update, and delete contacts
11
+ - ✅ Create or update contact (upsert by identifier)
12
+ - ✅ Merge two contacts (primary + secondary)
13
+ - ✅ List contacts with filters and search
14
+ - ✅ Add and remove contact tags
15
+ - ✅ Update contact lifecycle stages
16
+ - ✅ List contact channels (e.g. WhatsApp, Facebook)
17
+
18
+ ### Messaging
19
+ - ✅ Send messages (text, attachments, WhatsApp templates, emails)
20
+ - ✅ Retrieve message details and status
21
+ - ✅ List messages for a contact (with pagination)
22
+ - ✅ Support for multiple channel types
23
+
24
+ ### Conversations
25
+ - ✅ Assign/unassign conversations to users
26
+ - ✅ Open and close conversations
27
+ - ✅ Add closing notes and summaries
28
+
29
+ ### Workspace Management
30
+ - ✅ List users and get user by ID
31
+ - ✅ List, get, and create custom fields
32
+ - ✅ List channels and message templates (e.g. WhatsApp)
33
+ - ✅ List closing notes (for closing conversations)
34
+ - ✅ Create, update, and delete workspace tags
35
+
36
+ ### Comments
37
+ - ✅ Add internal comments to contacts
38
+ - ✅ Mention users in comments
39
+
40
+ ### HTTP/STDIO Dual Mode
41
+ - ✅ Can run as a local subprocess via stdio or as an HTTP server (`/mcp` endpoint)
42
+ - ✅ Health endpoint (`/health`) for monitoring and uptime checks
43
+ - ✅ CORS enabled for HTTP mode
44
+
45
+ ---
46
+
47
+ ## Prerequisites
48
+
49
+ - Node.js 18+
50
+ - npm / yarn / bun
51
+ - Git
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ # Clone the repository
57
+ git clone https://github.com/respond-io/mcp-server.git
58
+ cd mcp-server
59
+
60
+ # Install dependencies (includes Respond.io SDK)
61
+ npm install
62
+
63
+ # Build the project
64
+ npm run build
65
+ ```
66
+
67
+ The project depends on `@respond-io/typescript-sdk`. See [SETUP_GUIDE.md](SETUP_GUIDE.md) for full installation and configuration.
68
+
69
+ ---
70
+
71
+ ## Configuration
72
+
73
+ ### Environment Variables
74
+
75
+ The server is configured using environment variables. Set them in your shell or deployment environment.
76
+
77
+ - `RESPONDIO_API_KEY`: **(Required)** Your Respond.io API key.
78
+ - `RESPONDIO_BASE_URL`: The base URL for the Respond.io API (defaults to `https://api.respond.io/v2`).
79
+ - `MCP_SERVER_MODE`: The server mode, either `stdio` or `http` (defaults to `stdio`).
80
+ - `PORT`: The port for HTTP mode (defaults to `3000`).
81
+
82
+ ---
83
+
84
+ ## Usage with Claude Desktop
85
+
86
+ You can use this server with Claude Desktop in either **STDIO** (local subprocess) or **HTTP** (hosted or local HTTP server) mode.
87
+
88
+ ### 1️⃣ STDIO Mode (Recommended for local Claude Desktop)
89
+
90
+ **Configure Claude Desktop _(For Development Purpose)_:**
91
+ ```json
92
+ {
93
+ "command": "node",
94
+ "args": [
95
+ "/<Your Local Folder Path>/dist/index.js"
96
+ ],
97
+ "env": {
98
+ "RESPONDIO_API_KEY": "your_api_key",
99
+ "MCP_SERVER_MODE": "stdio"
100
+ }
101
+ }
102
+ ```
103
+
104
+ **Configure Claude Desktop _(For Production Usage)_:**
105
+ ```json
106
+ {
107
+ "command": "npx",
108
+ "args": [
109
+ "@respond-io/mcp-server"
110
+ ],
111
+ "env": {
112
+ "RESPONDIO_API_KEY": "your_api_key",
113
+ "MCP_SERVER_MODE": "stdio"
114
+ }
115
+ }
116
+ ```
117
+
118
+ - Launch Claude Desktop and add this MCP server.
119
+ - The server will start as a subprocess and communicate over stdio.
120
+
121
+ **Test:** Try any MCP tool from Claude Desktop, e.g., get a contact or send a message.
122
+
123
+ ---
124
+
125
+ ### 2️⃣ HTTP Mode (For remote/hosted or local HTTP integration)
126
+
127
+ **Start the server in HTTP mode:**
128
+ ```bash
129
+ npm run start:http
130
+ ```
131
+ or (if built):
132
+ ```bash
133
+ export MCP_SERVER_MODE=http
134
+ node dist/index.js
135
+ ```
136
+
137
+ **Configure Claude Desktop:**
138
+ ```json
139
+ {
140
+ "command": "npx",
141
+ "args": [
142
+ "-y",
143
+ "mcp-remote",
144
+ "http://localhost:3000/mcp",
145
+ "--header",
146
+ "Authorization:${AUTH_HEADER}"
147
+ ],
148
+ "env": {
149
+ "AUTH_HEADER": "Bearer your-token-here"
150
+ }
151
+ }
152
+ ```
153
+
154
+ **Test HTTP health:**
155
+ ```bash
156
+ curl http://localhost:3000/health
157
+ # {"status":"ok"}
158
+ ```
159
+
160
+ **Test HTTP MCP endpoint:**
161
+ ```bash
162
+ curl -X POST http://localhost:3000/mcp \
163
+ -H "Content-Type: application/json" \
164
+ -d '{"jsonrpc":"2.0","id":1,"method":"list_tools","params":{}}'
165
+ ```
166
+ You should get a JSON list of available tools.
167
+
168
+ ---
169
+
170
+ ## Usage Examples
171
+
172
+ ### Contact Management
173
+
174
+ #### Get a Contact
175
+ ```typescript
176
+ get_contact({ identifier: "id:12345" })
177
+ get_contact({ identifier: "email:user@example.com" })
178
+ get_contact({ identifier: "phone:+60123456789" })
179
+ ```
180
+
181
+ #### Create a Contact
182
+ ```typescript
183
+ create_contact({
184
+ identifier: "phone:+60123456789",
185
+ firstName: "John",
186
+ lastName: "Doe",
187
+ email: "john.doe@example.com",
188
+ language: "en",
189
+ custom_fields: [
190
+ { name: "Company", value: "Acme Corp" },
191
+ { name: "Order Number", value: 12345 }
192
+ ]
193
+ })
194
+ ```
195
+
196
+ #### List Contacts with Filters
197
+ ```typescript
198
+ list_contacts({
199
+ limit: 50,
200
+ search: "john@example.com",
201
+ timezone: "Asia/Kuala_Lumpur"
202
+ })
203
+ ```
204
+
205
+ #### Add Tags
206
+ ```typescript
207
+ add_contact_tags({
208
+ identifier: "id:12345",
209
+ tags: ["vip", "premium", "sales"]
210
+ })
211
+ ```
212
+
213
+ #### Create or Update Contact (upsert)
214
+ ```typescript
215
+ create_or_update_contact({
216
+ identifier: "email:user@example.com",
217
+ firstName: "John",
218
+ lastName: "Doe",
219
+ email: "user@example.com"
220
+ })
221
+ ```
222
+
223
+ #### Merge Contacts
224
+ ```typescript
225
+ merge_contacts({
226
+ primaryContactId: 1,
227
+ secondaryContactId: 2,
228
+ firstName: "Merged Name"
229
+ })
230
+ ```
231
+
232
+ #### List Contact Channels
233
+ ```typescript
234
+ list_contact_channels({ identifier: "id:12345", limit: 10 })
235
+ ```
236
+
237
+ #### Update Contact Lifecycle
238
+ ```typescript
239
+ update_contact_lifecycle({ identifier: "id:12345", stage: "Lead" })
240
+ // Clear lifecycle: stage: null
241
+ ```
242
+
243
+ ### Messaging
244
+
245
+ #### Send Text Message
246
+ ```typescript
247
+ send_message({
248
+ identifier: "id:12345",
249
+ channelId: null, // Use last interacted channel
250
+ messageType: "text",
251
+ text: "Hello! Thank you for contacting us."
252
+ })
253
+ ```
254
+
255
+ #### Send WhatsApp Template
256
+ ```typescript
257
+ send_message({
258
+ identifier: "phone:+60123456789",
259
+ channelId: 5678,
260
+ messageType: "whatsapp_template",
261
+ templateName: "order_confirmation",
262
+ templateLanguage: "en"
263
+ })
264
+ ```
265
+
266
+ #### Send Email
267
+ ```typescript
268
+ send_message({
269
+ identifier: "email:user@example.com",
270
+ channelId: 1234,
271
+ messageType: "email",
272
+ text: "Your order has been shipped!",
273
+ subject: "Order Shipment Notification"
274
+ })
275
+ ```
276
+
277
+ #### Send Attachment
278
+ ```typescript
279
+ send_message({
280
+ identifier: "id:12345",
281
+ channelId: 5678,
282
+ messageType: "attachment",
283
+ attachmentUrl: "https://example.com/invoice.pdf",
284
+ attachmentType: "file"
285
+ })
286
+ ```
287
+
288
+ #### Get Message
289
+ ```typescript
290
+ get_message({ identifier: "id:12345", messageId: 987654 })
291
+ ```
292
+
293
+ #### List Messages
294
+ ```typescript
295
+ list_messages({
296
+ identifier: "id:12345",
297
+ limit: 20,
298
+ cursorId: undefined // optional, for pagination
299
+ })
300
+ ```
301
+
302
+ ### Conversations
303
+
304
+ #### Assign Conversation
305
+ ```typescript
306
+ assign_conversation({
307
+ identifier: "id:12345",
308
+ assignee: "123"
309
+ })
310
+ assign_conversation({
311
+ identifier: "id:12345",
312
+ assignee: "agent@example.com"
313
+ })
314
+ assign_conversation({
315
+ identifier: "id:12345",
316
+ assignee: "null"
317
+ })
318
+ ```
319
+
320
+ #### Close Conversation
321
+ ```typescript
322
+ update_conversation_status({
323
+ identifier: "id:12345",
324
+ status: "close",
325
+ category: "Resolved",
326
+ summary: "Customer issue resolved successfully"
327
+ })
328
+ ```
329
+
330
+ ### Comments
331
+
332
+ #### Add Comment
333
+ ```typescript
334
+ create_comment({
335
+ identifier: "id:12345",
336
+ text: "Customer requested a callback tomorrow at 2 PM"
337
+ })
338
+ // Mention a user
339
+ create_comment({
340
+ identifier: "id:12345",
341
+ text: "{{@user.456}} please follow up with this customer"
342
+ })
343
+ ```
344
+
345
+ ### Workspace Management
346
+
347
+ #### List Users
348
+ ```typescript
349
+ list_users({ limit: 20 })
350
+ ```
351
+
352
+ #### Get User
353
+ ```typescript
354
+ get_user({ id: 123 })
355
+ ```
356
+
357
+ #### List Custom Fields
358
+ ```typescript
359
+ list_custom_fields({ limit: 10 })
360
+ ```
361
+
362
+ #### Get Custom Field
363
+ ```typescript
364
+ get_custom_field({ id: 1 })
365
+ ```
366
+
367
+ #### Create Custom Field
368
+ ```typescript
369
+ create_custom_field({
370
+ name: "Customer Tier",
371
+ slug: "customer_tier",
372
+ description: "Customer membership tier",
373
+ dataType: "list",
374
+ allowedValues: ["Bronze", "Silver", "Gold", "Platinum"]
375
+ })
376
+ ```
377
+
378
+ #### List Channels
379
+ ```typescript
380
+ list_channels({ limit: 10 })
381
+ ```
382
+
383
+ #### List Closing Notes
384
+ ```typescript
385
+ list_closing_notes({ limit: 10 })
386
+ ```
387
+
388
+ #### List Message Templates (e.g. WhatsApp)
389
+ ```typescript
390
+ list_templates({ channelId: 5678, limit: 10 })
391
+ ```
392
+
393
+ #### Create Tag
394
+ ```typescript
395
+ create_tag({
396
+ name: "VIP",
397
+ description: "VIP customers",
398
+ colorCode: "#FF5733"
399
+ })
400
+ ```
401
+
402
+ #### Update Tag
403
+ ```typescript
404
+ update_tag({
405
+ currentName: "VIP",
406
+ name: "Premium",
407
+ colorCode: "#FFD700"
408
+ })
409
+ ```
410
+
411
+ #### Delete Tag
412
+ ```typescript
413
+ delete_tag({ name: "Old Tag" })
414
+ ```
415
+
416
+ ---
417
+
418
+ ## Available Tools
419
+
420
+ The server exposes **28** MCP tools for contacts, messaging, conversations, comments, and workspace management.
421
+
422
+ **Summary:**
423
+
424
+ - **Contact (11):** `get_contact`, `create_contact`, `update_contact`, `delete_contact`, `list_contacts`, `add_contact_tags`, `remove_contact_tags`, `create_or_update_contact`, `merge_contacts`, `list_contact_channels`, `update_contact_lifecycle`
425
+ - **Messaging (3):** `send_message`, `get_message`, `list_messages`
426
+ - **Conversation (2):** `assign_conversation`, `update_conversation_status`
427
+ - **Comment (1):** `create_comment`
428
+ - **Workspace (11):** `list_users`, `get_user`, `list_custom_fields`, `get_custom_field`, `create_custom_field`, `list_channels`, `list_closing_notes`, `list_templates`, `create_tag`, `update_tag`, `delete_tag`
429
+
430
+ Tool parameters are defined in the server’s tool schemas (see `src/tools/`). Response shapes, rate limits, and API behavior come from the [Respond.io Developer API](https://docs.respond.io) and the [@respond-io/typescript-sdk](https://www.npmjs.com/package/@respond-io/typescript-sdk) used under the hood.
431
+
432
+ ---
433
+
434
+ ## Development
435
+
436
+ ### Testing
437
+
438
+ The project uses [Jest](https://jestjs.io/) for tests. Tests run against an in-memory MCP transport and mock the Respond.io API so no real API key is needed for unit tests.
439
+
440
+ ```bash
441
+ # Run tests once
442
+ npm run test
443
+
444
+ # Run tests in watch mode
445
+ npm run test:watch
446
+
447
+ # Run tests with coverage
448
+ npm run test:coverage
449
+ ```
450
+
451
+ Tests cover:
452
+ - **Server & list_tools**: All 28 tools are exposed; each has name, description, and inputSchema; server name/version and capabilities are reported.
453
+ - **All 28 tools** (with mocked API): contact, messaging, conversation, comment, and workspace tools.
454
+ - **Validation & error scenarios**: Unknown tool name, missing required args, invalid enums, empty arrays where non-empty is required.
455
+
456
+ ### Project Structure
457
+
458
+ ```
459
+ mcp-server/
460
+ ├── src/
461
+ │ ├── index.ts # Main server implementation
462
+ │ ├── server.ts # MCP server factory
463
+ │ ├── middlewares/ # Express middlewares
464
+ │ ├── protocol/ # STDIO / HTTP protocol handlers
465
+ │ ├── utils/ # Utility functions (API client)
466
+ │ └── tools/ # Tool definitions
467
+ ├── dist/ # Compiled JavaScript output
468
+ ├── tests/ # Jest tests
469
+ ├── .env.example # Environment variable template
470
+ ├── README.md # Documentation
471
+ └── SETUP_GUIDE.md # Setup instructions
472
+ ```
473
+
474
+ ### Development Commands
475
+
476
+ ```bash
477
+ # Run in development mode with auto-reload
478
+ npm run dev
479
+
480
+ # Build the project
481
+ npm run build
482
+
483
+ # Run linter
484
+ npm run lint
485
+
486
+ # Fix linting issues
487
+ npm run lint:fix
488
+
489
+ # Format code
490
+ npm run format
491
+
492
+ # Type check
493
+ npm run type-check
494
+ ```
495
+
496
+ ---
497
+
498
+ ## Code Quality
499
+
500
+ - ✅ **TypeScript** - Full type safety
501
+ - ✅ **ESLint** - Code quality and consistency
502
+ - ✅ **Prettier** - Code formatting
503
+ - ✅ **Strict Mode** - TypeScript strict mode enabled
504
+ - ✅ **Error Handling** - Comprehensive error handling
505
+ - ✅ **Modular Design** - Clean separation of concerns
506
+
507
+ ---
508
+
509
+ ## API Rate Limits
510
+
511
+ The Respond.io API has rate limits. The server handles rate limit errors and includes rate limit information in error responses:
512
+
513
+ - `Retry-After` - Seconds until retry is allowed
514
+ - `X-RateLimit-Limit` - Request limit for the endpoint
515
+ - `X-RateLimit-Remaining` - Remaining requests
516
+
517
+ ---
518
+
519
+ ## Error Handling
520
+
521
+ The server provides detailed error messages:
522
+
523
+ ```typescript
524
+ // API errors include status codes and messages
525
+ {
526
+ "error": "API Error 404: Contact not found"
527
+ }
528
+
529
+ // Network errors
530
+ {
531
+ "error": "Network Error: timeout of 30000ms exceeded"
532
+ }
533
+
534
+ // Validation errors
535
+ {
536
+ "error": "API Error 400: Validation error."
537
+ }
538
+ ```
539
+
540
+ ---
541
+
542
+ ## Security Best Practices
543
+
544
+ 1. **Never commit API keys** - Use environment variables
545
+ 2. **Use HTTPS** - All API calls use secure connections
546
+ 3. **Validate input** - All inputs are validated before API calls
547
+ 4. **Error sanitization** - Sensitive information is not exposed in errors
548
+
549
+ ---
550
+
551
+ ## Contributing
552
+
553
+ Contributions are welcome! Please follow these guidelines:
554
+
555
+ 1. Fork the repository
556
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
557
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
558
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
559
+ 5. Open a Pull Request
560
+
561
+ ### Code Style
562
+
563
+ - Follow TypeScript best practices
564
+ - Use meaningful variable and function names
565
+ - Add comments for complex logic
566
+ - Ensure all tests pass
567
+ - Run linter before committing
568
+
569
+ ---
570
+
571
+ ## Troubleshooting
572
+
573
+ ### "UN_AUTHORIZED" Error
574
+ - Check that your API key is correct in `.env`
575
+ - Ensure the API key has the necessary permissions
576
+
577
+ ### "Contact not found" Error
578
+ - Verify the contact identifier format (`id:123`, `email:user@example.com`, `phone:+60123456789`)
579
+ - Check that the contact exists in your workspace
580
+
581
+ ### Rate Limit Errors
582
+ - Wait for the time specified in the `Retry-After` header
583
+ - Consider implementing exponential backoff for retries
584
+
585
+ ### Build Errors
586
+ - Run `npm install` to ensure all dependencies are installed
587
+ - Delete `node_modules` and `dist` folders, then reinstall
588
+
589
+ ### TypeScript/ESLint Warnings
590
+ - Ensure you are using a supported TypeScript version (recommended: `5.3.x`)
591
+ - If you see warnings about `any`, use `Record<string, unknown>` or define explicit interfaces
592
+
593
+ ### Health Check Fails
594
+ - Ensure the MCP server is running in HTTP mode (`MCP_SERVER_MODE=http`)
595
+ - Check the correct port (`PORT`) is open and matches your configuration
596
+ - Use `curl http://localhost:3000/health` to test
597
+
598
+ ---
599
+
600
+ ## License
601
+
602
+ MIT License - see LICENSE file for details
603
+
604
+ ---
605
+
606
+ ## Support
607
+
608
+ For issues and questions:
609
+ - GitHub Issues: [Create an issue]
610
+ - Respond.io API Documentation: https://docs.respond.io
611
+ - Respond.io Support: https://support.respond.io
612
+
613
+ ---
614
+
615
+ ## Changelog
616
+
617
+ ### Version 1.0.0
618
+ - Initial release
619
+ - Full support for Contact, Messaging, Conversation, Comment, and Space APIs
620
+ - Comprehensive error handling
621
+ - TypeScript with strict mode
622
+ - MCP SDK integration
623
+ - HTTP and STDIO dual-mode support
624
+ - Health endpoint for monitoring
625
+
626
+ ---
627
+
628
+ ## Acknowledgments
629
+
630
+ - Built with [Model Context Protocol SDK](https://github.com/anthropics/modelcontextprotocol)
631
+ - Powered by [Respond.io API](https://respond.io)
632
+
633
+ ---
634
+
635
+ Made with ❤️ for seamless customer engagement automation