@wsapichat/mcp-server 1.0.5 → 2.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.
- package/README.md +53 -338
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -5
- package/dist/client/index.js.map +1 -1
- package/dist/config/index.d.ts +18 -53
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -1
- package/dist/config/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +70 -24
- package/dist/server.js.map +1 -1
- package/dist/tools/calls.d.ts +6 -0
- package/dist/tools/calls.d.ts.map +1 -0
- package/dist/tools/calls.js +24 -0
- package/dist/tools/calls.js.map +1 -0
- package/dist/tools/chats.d.ts +18 -0
- package/dist/tools/chats.d.ts.map +1 -1
- package/dist/tools/chats.js +156 -8
- package/dist/tools/chats.js.map +1 -1
- package/dist/tools/communities.d.ts +36 -0
- package/dist/tools/communities.d.ts.map +1 -0
- package/dist/tools/communities.js +263 -0
- package/dist/tools/communities.js.map +1 -0
- package/dist/tools/contacts.d.ts +8 -8
- package/dist/tools/contacts.d.ts.map +1 -1
- package/dist/tools/contacts.js +53 -158
- package/dist/tools/contacts.js.map +1 -1
- package/dist/tools/groups.d.ts +32 -0
- package/dist/tools/groups.d.ts.map +1 -1
- package/dist/tools/groups.js +272 -11
- package/dist/tools/groups.js.map +1 -1
- package/dist/tools/media.d.ts +6 -0
- package/dist/tools/media.d.ts.map +1 -0
- package/dist/tools/media.js +23 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/messaging-advanced.d.ts.map +1 -1
- package/dist/tools/messaging-advanced.js +79 -295
- package/dist/tools/messaging-advanced.js.map +1 -1
- package/dist/tools/messaging.d.ts +4 -0
- package/dist/tools/messaging.d.ts.map +1 -1
- package/dist/tools/messaging.js +150 -337
- package/dist/tools/messaging.js.map +1 -1
- package/dist/tools/newsletters.d.ts +16 -0
- package/dist/tools/newsletters.d.ts.map +1 -0
- package/dist/tools/newsletters.js +102 -0
- package/dist/tools/newsletters.js.map +1 -0
- package/dist/tools/session.d.ts +2 -0
- package/dist/tools/session.d.ts.map +1 -1
- package/dist/tools/session.js +18 -8
- package/dist/tools/session.js.map +1 -1
- package/dist/tools/status.d.ts +14 -0
- package/dist/tools/status.d.ts.map +1 -0
- package/dist/tools/status.js +86 -0
- package/dist/tools/status.js.map +1 -0
- package/dist/tools/users.d.ts +20 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +129 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/types/api.d.ts +4503 -1726
- package/dist/types/api.d.ts.map +1 -1
- package/dist/utils/logger.js +3 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/validation/schemas.d.ts +309 -650
- package/dist/validation/schemas.d.ts.map +1 -1
- package/dist/validation/schemas.js +209 -144
- package/dist/validation/schemas.js.map +1 -1
- package/package.json +24 -25
- package/dist/tools/account.d.ts +0 -14
- package/dist/tools/account.d.ts.map +0 -1
- package/dist/tools/account.js +0 -78
- package/dist/tools/account.js.map +0 -1
- package/dist/tools/instance.d.ts +0 -12
- package/dist/tools/instance.d.ts.map +0 -1
- package/dist/tools/instance.js +0 -54
- package/dist/tools/instance.js.map +0 -1
- package/dist/types/webhooks.d.ts +0 -1001
- package/dist/types/webhooks.d.ts.map +0 -1
- package/dist/types/webhooks.js +0 -6
- package/dist/types/webhooks.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,82 +3,26 @@
|
|
|
3
3
|
[](https://badge.fury.io/js/@wsapichat%2Fmcp-server)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
A comprehensive Model Context Protocol (MCP) server that provides LLMs with seamless access to WhatsApp functionality through the WSAPI service. This server enables AI assistants to send messages, manage contacts and groups, handle chat operations, and much more functionallity.
|
|
7
|
-
|
|
8
|
-
## 🚀 Features
|
|
9
|
-
|
|
10
|
-
### 📱 Core Messaging
|
|
11
|
-
- **Text Messages**: Send rich text with mentions and replies
|
|
12
|
-
- **Media Messages**: Send images, videos, audio files, and voice messages
|
|
13
|
-
- **Documents**: Share files with captions
|
|
14
|
-
- **Stickers**: Send animated and static stickers
|
|
15
|
-
- **Location**: Share location data with coordinates and place information
|
|
16
|
-
- **Contacts**: Send vCard contacts
|
|
17
|
-
- **Links**: Send URLs with rich preview metadata
|
|
18
|
-
- **Reactions**: React to messages with emojis
|
|
19
|
-
|
|
20
|
-
### 📧 Message Management
|
|
21
|
-
- **Edit Messages**: Modify sent text messages
|
|
22
|
-
- **Delete Messages**: Remove messages for all participants or just yourself
|
|
23
|
-
- **Star Messages**: Mark important messages
|
|
24
|
-
- **Mark as Read**: Update message read status
|
|
25
|
-
- **Reply to Messages**: Create threaded conversations
|
|
26
|
-
|
|
27
|
-
### 👥 Contact Management
|
|
28
|
-
- **List Contacts**: Get all WhatsApp contacts
|
|
29
|
-
- **Contact Details**: Retrieve contact information and business profiles
|
|
30
|
-
- **Create/Update Contacts**: Manage your contact list
|
|
31
|
-
- **Profile Pictures**: Get contact profile images
|
|
32
|
-
- **Presence Subscription**: Monitor contact online status
|
|
33
|
-
|
|
34
|
-
### 🏢 Group Management
|
|
35
|
-
- **Create Groups**: Start new group chats with participants
|
|
36
|
-
- **Group Info**: Get group details and participant lists
|
|
37
|
-
- **Manage Participants**: Add/remove group members
|
|
38
|
-
- **Group Settings**: Update name, description, and picture
|
|
39
|
-
- **Invite Links**: Generate and manage group invite links
|
|
40
|
-
|
|
41
|
-
### 💬 Chat Management
|
|
42
|
-
- **List Chats**: Get all active conversations
|
|
43
|
-
- **Chat Presence**: Set typing/recording indicators
|
|
44
|
-
- **Archive/Unarchive**: Organize chat list
|
|
45
|
-
- **Pin/Unpin**: Prioritize important chats
|
|
46
|
-
- **Mute/Unmute**: Control notifications
|
|
47
|
-
- **Ephemeral Messages**: Configure disappearing messages
|
|
48
|
-
|
|
49
|
-
### 🔐 Session & Instance Management
|
|
50
|
-
- **Session Status**: Monitor connection state
|
|
51
|
-
- **QR Code Login**: Get QR codes for device pairing
|
|
52
|
-
- **Pair Code**: Generate pairing codes for phone linking
|
|
53
|
-
- **Logout**: Disconnect from WhatsApp
|
|
54
|
-
- **Instance Settings**: Configure instance preferences
|
|
55
|
-
- **API Key Management**: Generate new authentication keys
|
|
56
|
-
|
|
57
|
-
### 👤 Account Management
|
|
58
|
-
- **Profile Info**: Get account details
|
|
59
|
-
- **Display Name**: Update account name
|
|
60
|
-
- **Profile Picture**: Change profile image
|
|
61
|
-
- **Status Message**: Update account status
|
|
62
|
-
- **Presence Status**: Set availability (available/unavailable)
|
|
63
|
-
|
|
64
|
-
## 📦 Installation
|
|
65
6
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- WSAPI account with API credentials
|
|
7
|
+
<a href="https://glama.ai/mcp/servers/@wsapi-chat/wsapi-mcp">
|
|
8
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@wsapi-chat/wsapi-mcp/badge" alt="WSAPI WhatsApp Server MCP server" />
|
|
9
|
+
</a>
|
|
70
10
|
|
|
71
|
-
|
|
11
|
+
A Model Context Protocol (MCP) server for [WSAPI](https://wsapi.chat) - the WhatsApp API Gateway. Enables LLMs to send messages, manage contacts and groups, handle communities and newsletters, post status updates, and more through WhatsApp.
|
|
72
12
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
13
|
+
For comprehensive documentation, see the [WSAPI MCP Server guide](https://docs.wsapi.chat/integrations/mcp-server).
|
|
14
|
+
|
|
15
|
+
> **Note**: This project is not affiliated with, associated with, or endorsed by WhatsApp or Meta.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
76
18
|
|
|
77
|
-
###
|
|
19
|
+
### Prerequisites
|
|
20
|
+
- Node.js >= 20.19.0
|
|
21
|
+
- WSAPI account with API credentials ([wsapi.chat](https://wsapi.chat))
|
|
78
22
|
|
|
79
|
-
|
|
23
|
+
### Claude Desktop
|
|
80
24
|
|
|
81
|
-
Add
|
|
25
|
+
Add to your Claude Desktop configuration:
|
|
82
26
|
|
|
83
27
|
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
84
28
|
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
@@ -91,313 +35,84 @@ Add the server to your Claude Desktop configuration file:
|
|
|
91
35
|
"args": ["@wsapichat/mcp-server"],
|
|
92
36
|
"env": {
|
|
93
37
|
"WSAPI_API_KEY": "your_api_key_here",
|
|
94
|
-
"WSAPI_INSTANCE_ID": "your_instance_id_here"
|
|
38
|
+
"WSAPI_INSTANCE_ID": "your_instance_id_here",
|
|
39
|
+
"WSAPI_ENABLED_CATEGORIES": "messaging,contacts"
|
|
95
40
|
}
|
|
96
41
|
}
|
|
97
42
|
}
|
|
98
43
|
}
|
|
99
44
|
```
|
|
100
45
|
|
|
101
|
-
|
|
46
|
+
### Claude Code
|
|
102
47
|
|
|
103
|
-
1. **Install the package:**
|
|
104
48
|
```bash
|
|
105
|
-
|
|
49
|
+
claude mcp add wsapi -- npx @wsapichat/mcp-server \
|
|
50
|
+
--env WSAPI_API_KEY=your_api_key_here \
|
|
51
|
+
--env WSAPI_INSTANCE_ID=your_instance_id_here \
|
|
52
|
+
--env WSAPI_ENABLED_CATEGORIES=messaging,contacts
|
|
106
53
|
```
|
|
107
54
|
|
|
108
|
-
|
|
109
|
-
```env
|
|
110
|
-
WSAPI_API_KEY=your_api_key_here
|
|
111
|
-
WSAPI_INSTANCE_ID=your_instance_id_here
|
|
112
|
-
WSAPI_BASE_URL=https://api.wsapi.chat
|
|
113
|
-
```
|
|
55
|
+
## Tool Filtering
|
|
114
56
|
|
|
115
|
-
|
|
116
|
-
```json
|
|
117
|
-
{
|
|
118
|
-
"mcpServers": {
|
|
119
|
-
"wsapi": {
|
|
120
|
-
"command": "node",
|
|
121
|
-
"args": ["./node_modules/@wsapichat/mcp-server/dist/index.js"],
|
|
122
|
-
"env": {
|
|
123
|
-
"WSAPI_API_KEY": "your_api_key_here",
|
|
124
|
-
"WSAPI_INSTANCE_ID": "your_instance_id_here"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
```
|
|
57
|
+
The server exposes 80+ tools across 12 categories. To reduce context window usage, you can filter which tools are loaded using environment variables.
|
|
130
58
|
|
|
131
|
-
###
|
|
59
|
+
### By category
|
|
132
60
|
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
git clone https://github.com/wsapi-chat/wsapi-mcp
|
|
136
|
-
cd wsapi-mcp
|
|
137
|
-
npm install
|
|
138
|
-
```
|
|
61
|
+
Load only messaging and contact tools:
|
|
139
62
|
|
|
140
|
-
2. **Configure environment:**
|
|
141
|
-
```bash
|
|
142
|
-
cp .env.example .env
|
|
143
63
|
```
|
|
144
|
-
|
|
145
|
-
3. **Edit `.env` file with your WSAPI credentials:**
|
|
146
|
-
```env
|
|
147
|
-
WSAPI_API_KEY=your_api_key_here
|
|
148
|
-
WSAPI_INSTANCE_ID=your_instance_id_here
|
|
149
|
-
WSAPI_BASE_URL=https://api.wsapi.chat
|
|
150
|
-
|
|
151
|
-
# Server configuration
|
|
152
|
-
LOG_LEVEL=info
|
|
153
|
-
NODE_ENV=development
|
|
64
|
+
WSAPI_ENABLED_CATEGORIES=messaging,contacts
|
|
154
65
|
```
|
|
155
66
|
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
npm run build
|
|
159
|
-
npm start
|
|
160
|
-
```
|
|
67
|
+
Available categories: `messaging`, `contacts`, `groups`, `chats`, `session`, `users`, `communities`, `newsletters`, `status`, `calls`, `media`
|
|
161
68
|
|
|
162
|
-
|
|
69
|
+
### By individual tool
|
|
163
70
|
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
npm run dev
|
|
167
|
-
```
|
|
71
|
+
Load only specific tools:
|
|
168
72
|
|
|
169
|
-
### Type Checking
|
|
170
|
-
```bash
|
|
171
|
-
npm run type-check
|
|
172
73
|
```
|
|
173
|
-
|
|
174
|
-
### Linting
|
|
175
|
-
```bash
|
|
176
|
-
npm run lint
|
|
177
|
-
npm run lint:fix
|
|
74
|
+
WSAPI_ENABLED_TOOLS=whatsapp_send_text,whatsapp_send_image,whatsapp_get_contacts
|
|
178
75
|
```
|
|
179
76
|
|
|
180
|
-
###
|
|
181
|
-
```bash
|
|
182
|
-
npm test
|
|
183
|
-
npm run test:watch
|
|
184
|
-
```
|
|
77
|
+
### Combined
|
|
185
78
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
79
|
+
Use categories as a base set and add individual tools from other categories:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
WSAPI_ENABLED_CATEGORIES=messaging
|
|
83
|
+
WSAPI_ENABLED_TOOLS=whatsapp_get_contacts,whatsapp_get_chats
|
|
189
84
|
```
|
|
190
85
|
|
|
191
|
-
|
|
86
|
+
If neither variable is set, all tools are loaded.
|
|
192
87
|
|
|
193
|
-
|
|
88
|
+
## Configuration
|
|
194
89
|
|
|
195
90
|
| Variable | Required | Default | Description |
|
|
196
91
|
|----------|----------|---------|-------------|
|
|
197
92
|
| `WSAPI_API_KEY` | Yes | - | Your WSAPI API key |
|
|
198
93
|
| `WSAPI_INSTANCE_ID` | Yes | - | Your WSAPI instance ID |
|
|
199
|
-
| `WSAPI_BASE_URL` | No | `https://
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `WSAPI_RETRY_DELAY` | No | `1000` | Delay between retries in milliseconds |
|
|
203
|
-
| `PORT` | No | `3000` | Server port |
|
|
94
|
+
| `WSAPI_BASE_URL` | No | `https://wsapi.chat` | WSAPI base URL |
|
|
95
|
+
| `WSAPI_ENABLED_CATEGORIES` | No | *(all)* | Comma-separated tool categories to load |
|
|
96
|
+
| `WSAPI_ENABLED_TOOLS` | No | *(all)* | Comma-separated tool names to load |
|
|
204
97
|
| `LOG_LEVEL` | No | `info` | Logging level (error, warn, info, debug) |
|
|
205
|
-
| `NODE_ENV` | No | `development` | Environment (development, production, test) |
|
|
206
98
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
1. Visit [WSAPI.chat](https://wsapi.chat) and create an account
|
|
210
|
-
2. Create a new WhatsApp instance
|
|
211
|
-
3. Get your API key and Instance ID from the dashboard
|
|
212
|
-
4. Configure your instance settings as needed
|
|
213
|
-
|
|
214
|
-
## 📚 Usage Examples
|
|
215
|
-
|
|
216
|
-
### Send a Text Message
|
|
217
|
-
```typescript
|
|
218
|
-
// Tool: whatsapp_send_text
|
|
219
|
-
{
|
|
220
|
-
"to": "1234567890@s.whatsapp.net",
|
|
221
|
-
"text": "Hello! How are you today?",
|
|
222
|
-
"mentions": ["1234567890@s.whatsapp.net"]
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Send an Image with Caption
|
|
227
|
-
```typescript
|
|
228
|
-
// Tool: whatsapp_send_image
|
|
229
|
-
{
|
|
230
|
-
"to": "1234567890@s.whatsapp.net",
|
|
231
|
-
"imageURL": "https://example.com/image.jpg",
|
|
232
|
-
"mimeType": "image/jpeg",
|
|
233
|
-
"caption": "Check out this amazing photo!"
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Create a Group
|
|
238
|
-
```typescript
|
|
239
|
-
// Tool: whatsapp_create_group
|
|
240
|
-
{
|
|
241
|
-
"name": "Project Team",
|
|
242
|
-
"participants": [
|
|
243
|
-
"1234567890@s.whatsapp.net",
|
|
244
|
-
"0987654321@s.whatsapp.net"
|
|
245
|
-
]
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### Send Location
|
|
250
|
-
```typescript
|
|
251
|
-
// Tool: whatsapp_send_location
|
|
252
|
-
{
|
|
253
|
-
"to": "1234567890@s.whatsapp.net",
|
|
254
|
-
"latitude": 37.7749,
|
|
255
|
-
"longitude": -122.4194,
|
|
256
|
-
"name": "San Francisco",
|
|
257
|
-
"address": "San Francisco, CA, USA"
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Set Chat Presence
|
|
262
|
-
```typescript
|
|
263
|
-
// Tool: whatsapp_set_chat_presence
|
|
264
|
-
{
|
|
265
|
-
"chatId": "1234567890@s.whatsapp.net",
|
|
266
|
-
"state": "typing"
|
|
267
|
-
}
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## 🔗 Available Tools
|
|
271
|
-
|
|
272
|
-
### Messaging Tools
|
|
273
|
-
- `whatsapp_send_text` - Send text messages
|
|
274
|
-
- `whatsapp_send_image` - Send image messages
|
|
275
|
-
- `whatsapp_send_video` - Send video messages
|
|
276
|
-
- `whatsapp_send_audio` - Send audio files
|
|
277
|
-
- `whatsapp_send_voice` - Send voice messages
|
|
278
|
-
- `whatsapp_send_document` - Send document files
|
|
279
|
-
- `whatsapp_send_sticker` - Send stickers
|
|
280
|
-
- `whatsapp_send_location` - Send location data
|
|
281
|
-
- `whatsapp_send_contact` - Send contact vCards
|
|
282
|
-
- `whatsapp_send_link` - Send links with preview
|
|
283
|
-
- `whatsapp_send_reaction` - React to messages
|
|
284
|
-
- `whatsapp_edit_message` - Edit sent messages
|
|
285
|
-
- `whatsapp_delete_message` - Delete messages
|
|
286
|
-
- `whatsapp_mark_message_read` - Mark messages as read
|
|
287
|
-
- `whatsapp_star_message` - Star messages
|
|
288
|
-
|
|
289
|
-
### Contact Tools
|
|
290
|
-
- `whatsapp_get_contacts` - List all contacts
|
|
291
|
-
- `whatsapp_get_contact` - Get contact details
|
|
292
|
-
- `whatsapp_create_contact` - Create new contact
|
|
293
|
-
- `whatsapp_update_contact` - Update contact info
|
|
294
|
-
- `whatsapp_get_contact_picture` - Get contact profile picture
|
|
295
|
-
- `whatsapp_get_contact_business` - Get business profile
|
|
296
|
-
- `whatsapp_subscribe_contact_presence` - Monitor contact status
|
|
297
|
-
|
|
298
|
-
### Group Tools
|
|
299
|
-
- `whatsapp_get_groups` - List all groups
|
|
300
|
-
- `whatsapp_create_group` - Create new group
|
|
301
|
-
- `whatsapp_get_group` - Get group details
|
|
302
|
-
- `whatsapp_update_group_name` - Change group name
|
|
303
|
-
|
|
304
|
-
### Chat Tools
|
|
305
|
-
- `whatsapp_get_chats` - List all chats
|
|
306
|
-
- `whatsapp_get_chat` - Get chat details
|
|
307
|
-
- `whatsapp_set_chat_presence` - Set typing/recording status
|
|
308
|
-
- `whatsapp_archive_chat` - Archive/unarchive chats
|
|
309
|
-
- `whatsapp_pin_chat` - Pin/unpin chats
|
|
310
|
-
|
|
311
|
-
### Session Tools
|
|
312
|
-
- `whatsapp_get_session_status` - Check connection status
|
|
313
|
-
- `whatsapp_get_qr_code` - Get QR code for login
|
|
314
|
-
- `whatsapp_get_qr_code_image` - Get QR code image
|
|
315
|
-
- `whatsapp_get_pair_code` - Get pairing code
|
|
316
|
-
- `whatsapp_logout` - Logout from WhatsApp
|
|
317
|
-
|
|
318
|
-
### Instance Tools
|
|
319
|
-
- `whatsapp_get_instance_settings` - Get instance configuration
|
|
320
|
-
- `whatsapp_update_instance_settings` - Update instance settings
|
|
321
|
-
- `whatsapp_restart_instance` - Restart instance
|
|
322
|
-
- `whatsapp_update_api_key` - Generate new API key
|
|
323
|
-
|
|
324
|
-
### Account Tools
|
|
325
|
-
- `whatsapp_get_account_info` - Get account information
|
|
326
|
-
- `whatsapp_set_account_name` - Update display name
|
|
327
|
-
- `whatsapp_set_account_picture` - Update profile picture
|
|
328
|
-
- `whatsapp_set_account_presence` - Set availability status
|
|
329
|
-
- `whatsapp_set_account_status` - Update status message
|
|
330
|
-
|
|
331
|
-
## 🐛 Troubleshooting
|
|
332
|
-
|
|
333
|
-
### Common Issues
|
|
334
|
-
|
|
335
|
-
1. **Authentication Errors**
|
|
336
|
-
- Verify your API key and instance ID are correct
|
|
337
|
-
- Check that your WSAPI subscription is active
|
|
338
|
-
- Ensure the instance is properly configured
|
|
339
|
-
|
|
340
|
-
2. **Connection Issues**
|
|
341
|
-
- Check your internet connection
|
|
342
|
-
- Verify the WSAPI service status
|
|
343
|
-
- Review firewall settings
|
|
344
|
-
|
|
345
|
-
3. **Message Sending Failures**
|
|
346
|
-
- Ensure the recipient number format is correct (include @s.whatsapp.net)
|
|
347
|
-
- Check that the WhatsApp session is active
|
|
348
|
-
- Verify media file formats and sizes
|
|
349
|
-
|
|
350
|
-
4. **Validation Errors**
|
|
351
|
-
- Review input parameters against the tool schemas
|
|
352
|
-
- Check data types and required fields
|
|
353
|
-
- Ensure string lengths don't exceed limits
|
|
354
|
-
|
|
355
|
-
### Debug Mode
|
|
356
|
-
|
|
357
|
-
Enable debug logging for detailed troubleshooting:
|
|
99
|
+
## Development
|
|
358
100
|
|
|
359
101
|
```bash
|
|
360
|
-
|
|
102
|
+
git clone https://github.com/wsapi-chat/wsapi-mcp
|
|
103
|
+
cd wsapi-mcp
|
|
104
|
+
npm install
|
|
105
|
+
cp .env.example .env # Edit with your credentials
|
|
106
|
+
npm run build
|
|
107
|
+
npm start
|
|
361
108
|
```
|
|
362
109
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
The server includes a built-in health check that verifies API connectivity on startup.
|
|
366
|
-
|
|
367
|
-
## 🤝 Contributing
|
|
110
|
+
## License
|
|
368
111
|
|
|
369
|
-
|
|
370
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
371
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
372
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
373
|
-
5. Open a Pull Request
|
|
112
|
+
MIT - see [LICENSE](LICENSE) for details.
|
|
374
113
|
|
|
375
|
-
|
|
114
|
+
## Links
|
|
376
115
|
|
|
377
|
-
-
|
|
378
|
-
-
|
|
379
|
-
- Update documentation for new features
|
|
380
|
-
- Run linting and type checking before committing
|
|
381
|
-
- Follow the existing code style and conventions
|
|
382
|
-
|
|
383
|
-
## 📄 License
|
|
384
|
-
|
|
385
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
386
|
-
|
|
387
|
-
## 🔗 Links
|
|
388
|
-
|
|
389
|
-
- [WSAPI Documentation](https://wsapi.gitbook.io/wsapi-docs)
|
|
116
|
+
- [WSAPI MCP Server Documentation](https://docs.wsapi.chat/integrations/mcp-server)
|
|
117
|
+
- [WSAPI Documentation](https://docs.wsapi.chat)
|
|
390
118
|
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
391
|
-
- [OpenAPI Specification](https://openapi.gitbook.com/o/VqjwkXj2jsuSdFqwsNwR/spec/wsapi-api.yaml)
|
|
392
|
-
|
|
393
|
-
## 📞 Support
|
|
394
|
-
|
|
395
|
-
For support and questions:
|
|
396
|
-
|
|
397
|
-
- Create an issue in this repository
|
|
398
|
-
- Check the [WSAPI documentation](https://wsapi.gitbook.io/wsapi-docs)
|
|
399
|
-
- Contact WSAPI support for API-related issues
|
|
400
|
-
|
|
401
|
-
---
|
|
402
|
-
|
|
403
|
-
Built with ❤️ using TypeScript, and the Model Context Protocol SDK.
|
package/dist/client/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export declare class WSAPIClient {
|
|
|
9
9
|
delete(path: string, params?: any): Promise<void>;
|
|
10
10
|
private buildUrl;
|
|
11
11
|
healthCheck(): Promise<boolean>;
|
|
12
|
-
getInstanceInfo(): Promise<any>;
|
|
13
12
|
}
|
|
14
13
|
export declare const wsapiClient: WSAPIClient;
|
|
15
14
|
export default WSAPIClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAOA,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;;IAiBvC,OAAO,CAAC,iBAAiB;YA8DX,OAAO;IAsBf,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAS7C,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUzD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUxD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IASvD,OAAO,CAAC,QAAQ;IA8BV,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAUtC;AAGD,eAAO,MAAM,WAAW,aAAoB,CAAC;AAC7C,eAAe,WAAW,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export class WSAPIClient {
|
|
|
13
13
|
'Content-Type': 'application/json',
|
|
14
14
|
'X-Api-Key': config.wsapi.apiKey,
|
|
15
15
|
'X-Instance-Id': config.wsapi.instanceId,
|
|
16
|
-
'User-Agent': 'WSAPI-MCP-Server/
|
|
16
|
+
'User-Agent': 'WSAPI-MCP-Server/2.0.0',
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
this.setupInterceptors();
|
|
@@ -143,10 +143,6 @@ export class WSAPIClient {
|
|
|
143
143
|
return false;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
// Get instance info
|
|
147
|
-
async getInstanceInfo() {
|
|
148
|
-
return this.get('/instance/settings');
|
|
149
|
-
}
|
|
150
146
|
}
|
|
151
147
|
// Export singleton instance
|
|
152
148
|
export const wsapiClient = new WSAPIClient();
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OA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: z.ZodDefault<z.ZodNumber>;
|
|
8
8
|
retryAttempts: z.ZodDefault<z.ZodNumber>;
|
|
9
9
|
retryDelay: z.ZodDefault<z.ZodNumber>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
baseUrl: string;
|
|
14
|
-
timeout: number;
|
|
15
|
-
retryAttempts: number;
|
|
16
|
-
retryDelay: number;
|
|
17
|
-
}, {
|
|
18
|
-
apiKey: string;
|
|
19
|
-
instanceId: string;
|
|
20
|
-
baseUrl?: string | undefined;
|
|
21
|
-
timeout?: number | undefined;
|
|
22
|
-
retryAttempts?: number | undefined;
|
|
23
|
-
retryDelay?: number | undefined;
|
|
24
|
-
}>;
|
|
10
|
+
enabledCategories: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string[], string>>;
|
|
11
|
+
enabledTools: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<string[], string>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
25
13
|
server: z.ZodObject<{
|
|
26
14
|
port: z.ZodDefault<z.ZodNumber>;
|
|
27
|
-
logLevel: z.ZodDefault<z.ZodEnum<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
baseUrl: string;
|
|
41
|
-
timeout: number;
|
|
42
|
-
retryAttempts: number;
|
|
43
|
-
retryDelay: number;
|
|
44
|
-
};
|
|
45
|
-
server: {
|
|
46
|
-
port: number;
|
|
47
|
-
logLevel: "error" | "warn" | "info" | "debug";
|
|
48
|
-
};
|
|
49
|
-
environment: "development" | "production" | "test";
|
|
50
|
-
}, {
|
|
51
|
-
wsapi: {
|
|
52
|
-
apiKey: string;
|
|
53
|
-
instanceId: string;
|
|
54
|
-
baseUrl?: string | undefined;
|
|
55
|
-
timeout?: number | undefined;
|
|
56
|
-
retryAttempts?: number | undefined;
|
|
57
|
-
retryDelay?: number | undefined;
|
|
58
|
-
};
|
|
59
|
-
server: {
|
|
60
|
-
port?: number | undefined;
|
|
61
|
-
logLevel?: "error" | "warn" | "info" | "debug" | undefined;
|
|
62
|
-
};
|
|
63
|
-
environment?: "development" | "production" | "test" | undefined;
|
|
64
|
-
}>;
|
|
15
|
+
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
16
|
+
error: "error";
|
|
17
|
+
warn: "warn";
|
|
18
|
+
info: "info";
|
|
19
|
+
debug: "debug";
|
|
20
|
+
}>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
environment: z.ZodDefault<z.ZodEnum<{
|
|
23
|
+
development: "development";
|
|
24
|
+
production: "production";
|
|
25
|
+
test: "test";
|
|
26
|
+
}>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
65
28
|
export type Config = z.infer<typeof configSchema>;
|
|
66
29
|
export declare const config: {
|
|
67
30
|
wsapi: {
|
|
@@ -71,6 +34,8 @@ export declare const config: {
|
|
|
71
34
|
timeout: number;
|
|
72
35
|
retryAttempts: number;
|
|
73
36
|
retryDelay: number;
|
|
37
|
+
enabledCategories: string[];
|
|
38
|
+
enabledTools: string[];
|
|
74
39
|
};
|
|
75
40
|
server: {
|
|
76
41
|
port: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBhB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAwDlD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAAe,CAAC;AAGnC,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED,wBAAgB,MAAM,IAAI,OAAO,CAEhC"}
|
package/dist/config/index.js
CHANGED
|
@@ -11,6 +11,8 @@ const configSchema = z.object({
|
|
|
11
11
|
timeout: z.number().positive().default(30000),
|
|
12
12
|
retryAttempts: z.number().min(0).default(3),
|
|
13
13
|
retryDelay: z.number().positive().default(1000),
|
|
14
|
+
enabledCategories: z.string().default('').transform(s => s ? s.split(',').map(c => c.trim()).filter(Boolean) : []),
|
|
15
|
+
enabledTools: z.string().default('').transform(s => s ? s.split(',').map(c => c.trim()).filter(Boolean) : []),
|
|
14
16
|
}),
|
|
15
17
|
server: z.object({
|
|
16
18
|
port: z.number().positive().default(3000),
|
|
@@ -28,6 +30,8 @@ function loadConfig() {
|
|
|
28
30
|
timeout: process.env.WSAPI_TIMEOUT ? parseInt(process.env.WSAPI_TIMEOUT, 10) : undefined,
|
|
29
31
|
retryAttempts: process.env.WSAPI_RETRY_ATTEMPTS ? parseInt(process.env.WSAPI_RETRY_ATTEMPTS, 10) : undefined,
|
|
30
32
|
retryDelay: process.env.WSAPI_RETRY_DELAY ? parseInt(process.env.WSAPI_RETRY_DELAY, 10) : undefined,
|
|
33
|
+
enabledCategories: process.env.WSAPI_ENABLED_CATEGORIES,
|
|
34
|
+
enabledTools: process.env.WSAPI_ENABLED_TOOLS,
|
|
31
35
|
},
|
|
32
36
|
server: {
|
|
33
37
|
port: process.env.PORT ? parseInt(process.env.PORT, 10) : undefined,
|
|
@@ -40,7 +44,7 @@ function loadConfig() {
|
|
|
40
44
|
}
|
|
41
45
|
catch (error) {
|
|
42
46
|
if (error instanceof z.ZodError) {
|
|
43
|
-
const errorMessages = error.
|
|
47
|
+
const errorMessages = error.issues.map((err) => `${err.path.join('.')}: ${err.message}`);
|
|
44
48
|
const message = `Configuration validation failed: ${errorMessages.join(', ')}`;
|
|
45
49
|
// Log to stderr for MCP debugging
|
|
46
50
|
console.error('WSAPI MCP Server Configuration Error:', message);
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,6BAA6B;AAC7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,uBAAuB;AACvB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC;QACtD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;QAC9D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,wBAAwB,CAAC;QAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,6BAA6B;AAC7B,MAAM,CAAC,MAAM,EAAE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C,uBAAuB,CAAC;wBAC/B,GAAG,EAAE;4BACH,aAAa,EAAE,mBAAmB;4BAClC,iBAAiB,EAAE,uBAAuB;yBAC3C;qBACF;iBACF;aACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAEb,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,0BAA0B;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;AAEnC,mBAAmB;AACnB,MAAM,UAAU,YAAY;IAC1B,OAAO,MAAM,CAAC,WAAW,KAAK,YAAY,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,WAAW,KAAK,aAAa,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,OAAO,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC;AACvC,CAAC;AAED,wEAAwE"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACtC;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAuC;;IAmBpD,OAAO,CAAC,iBAAiB;IA6EzB,OAAO,CAAC,mBAAmB;IAmE3B,OAAO,CAAC,YAAY;IAmBd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,aAAa,IAAI,MAAM;CAaxB;AAGD,eAAO,MAAM,SAAS,gBAAuB,CAAC;AAG9C,eAAe,SAAS,CAAC"}
|