@wsapichat/mcp-server 1.0.5 → 3.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 +58 -339
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +47 -28
- package/dist/client/index.js.map +1 -1
- package/dist/config/index.d.ts +19 -54
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +57 -29
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -36
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +127 -59
- 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 +26 -0
- package/dist/tools/calls.js.map +1 -0
- package/dist/tools/chats.d.ts +19 -1
- package/dist/tools/chats.d.ts.map +1 -1
- package/dist/tools/chats.js +242 -39
- 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 +318 -0
- package/dist/tools/communities.js.map +1 -0
- package/dist/tools/contacts.d.ts +9 -9
- package/dist/tools/contacts.d.ts.map +1 -1
- package/dist/tools/contacts.js +68 -158
- package/dist/tools/contacts.js.map +1 -1
- package/dist/tools/groups.d.ts +33 -1
- package/dist/tools/groups.d.ts.map +1 -1
- package/dist/tools/groups.js +367 -33
- 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 +39 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/messaging-advanced.d.ts +1 -1
- package/dist/tools/messaging-advanced.d.ts.map +1 -1
- package/dist/tools/messaging-advanced.js +135 -281
- package/dist/tools/messaging-advanced.js.map +1 -1
- package/dist/tools/messaging.d.ts +5 -1
- package/dist/tools/messaging.d.ts.map +1 -1
- package/dist/tools/messaging.js +241 -319
- 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 +131 -0
- package/dist/tools/newsletters.js.map +1 -0
- package/dist/tools/session.d.ts +3 -1
- package/dist/tools/session.d.ts.map +1 -1
- package/dist/tools/session.js +72 -37
- 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 +106 -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 +175 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/types/api.d.ts +4508 -1726
- package/dist/types/api.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +43 -42
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +22 -22
- package/dist/utils/logger.js.map +1 -1
- package/dist/validation/schemas.d.ts +310 -651
- package/dist/validation/schemas.d.ts.map +1 -1
- package/dist/validation/schemas.js +245 -153
- package/dist/validation/schemas.js.map +1 -1
- package/package.json +25 -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
6
|
+
<a href="https://glama.ai/mcp/servers/@wsapi-chat/wsapi-mcp">
|
|
7
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@wsapi-chat/wsapi-mcp/badge" alt="WSAPI WhatsApp Server MCP server" />
|
|
8
|
+
</a>
|
|
65
9
|
|
|
66
|
-
|
|
67
|
-
- Node.js 18.0.0 or higher
|
|
68
|
-
- npm or yarn package manager
|
|
69
|
-
- WSAPI account with API credentials
|
|
10
|
+
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.
|
|
70
11
|
|
|
71
|
-
|
|
12
|
+
For comprehensive documentation, see the [WSAPI MCP Server guide](https://docs.wsapi.chat/integrations/mcp-server).
|
|
72
13
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
14
|
+
> **Note**: This project is not affiliated with, associated with, or endorsed by WhatsApp or Meta.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### Prerequisites
|
|
76
19
|
|
|
77
|
-
|
|
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,88 @@ 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
|
-
```bash
|
|
188
|
-
npm run generate-types
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## 🛠️ Configuration
|
|
192
|
-
|
|
193
|
-
### Environment Variables
|
|
194
|
-
|
|
195
|
-
| Variable | Required | Default | Description |
|
|
196
|
-
|----------|----------|---------|-------------|
|
|
197
|
-
| `WSAPI_API_KEY` | Yes | - | Your WSAPI API key |
|
|
198
|
-
| `WSAPI_INSTANCE_ID` | Yes | - | Your WSAPI instance ID |
|
|
199
|
-
| `WSAPI_BASE_URL` | No | `https://api.wsapi.chat` | WSAPI base URL |
|
|
200
|
-
| `WSAPI_TIMEOUT` | No | `30000` | Request timeout in milliseconds |
|
|
201
|
-
| `WSAPI_RETRY_ATTEMPTS` | No | `3` | Number of retry attempts |
|
|
202
|
-
| `WSAPI_RETRY_DELAY` | No | `1000` | Delay between retries in milliseconds |
|
|
203
|
-
| `PORT` | No | `3000` | Server port |
|
|
204
|
-
| `LOG_LEVEL` | No | `info` | Logging level (error, warn, info, debug) |
|
|
205
|
-
| `NODE_ENV` | No | `development` | Environment (development, production, test) |
|
|
79
|
+
Use categories as a base set and add individual tools from other categories:
|
|
206
80
|
|
|
207
|
-
### Getting WSAPI Credentials
|
|
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
81
|
```
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
}
|
|
82
|
+
WSAPI_ENABLED_CATEGORIES=messaging
|
|
83
|
+
WSAPI_ENABLED_TOOLS=whatsapp_get_contacts,whatsapp_get_chats
|
|
235
84
|
```
|
|
236
85
|
|
|
237
|
-
|
|
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
|
-
```
|
|
86
|
+
If neither variable is set, all tools are loaded.
|
|
248
87
|
|
|
249
|
-
|
|
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
|
-
```
|
|
88
|
+
## Configuration
|
|
260
89
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
90
|
+
| Variable | Required | Default | Description |
|
|
91
|
+
| -------------------------- | -------- | -------------------- | ---------------------------------------- |
|
|
92
|
+
| `WSAPI_API_KEY` | Yes | - | Your WSAPI API key |
|
|
93
|
+
| `WSAPI_INSTANCE_ID` | Yes | - | Your WSAPI instance ID |
|
|
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 |
|
|
97
|
+
| `LOG_LEVEL` | No | `info` | Logging level (error, warn, info, debug) |
|
|
269
98
|
|
|
270
|
-
##
|
|
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
|
-
|
|
110
|
+
## License
|
|
364
111
|
|
|
365
|
-
|
|
112
|
+
MIT - see [LICENSE](LICENSE) for details.
|
|
366
113
|
|
|
367
|
-
##
|
|
114
|
+
## Links
|
|
368
115
|
|
|
369
|
-
|
|
370
|
-
|
|
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
|
|
374
|
-
|
|
375
|
-
### Development Guidelines
|
|
376
|
-
|
|
377
|
-
- Follow TypeScript best practices
|
|
378
|
-
- Add tests for new functionality
|
|
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
119
|
|
|
401
|
-
|
|
120
|
+
## Unreleased contract update
|
|
402
121
|
|
|
403
|
-
|
|
122
|
+
The source covers 101 WhatsApp operations; Cloud Account/subscription and OSS admin APIs are outside this integration's scope. Changes in this working tree have not been published. See [CHANGELOG.md](CHANGELOG.md).
|
package/dist/client/index.d.ts
CHANGED
|
@@ -4,12 +4,15 @@ export declare class WSAPIClient {
|
|
|
4
4
|
private setupInterceptors;
|
|
5
5
|
private request;
|
|
6
6
|
get(path: string, params?: any): Promise<any>;
|
|
7
|
+
getBinary(path: string, params?: Record<string, string>): Promise<{
|
|
8
|
+
data: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
}>;
|
|
7
11
|
post(path: string, data: any, params?: any): Promise<any>;
|
|
8
12
|
put(path: string, data: any, params?: any): Promise<any>;
|
|
9
13
|
delete(path: string, params?: any): Promise<void>;
|
|
10
14
|
private buildUrl;
|
|
11
15
|
healthCheck(): Promise<boolean>;
|
|
12
|
-
getInstanceInfo(): Promise<any>;
|
|
13
16
|
}
|
|
14
17
|
export declare const wsapiClient: WSAPIClient;
|
|
15
18
|
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;YAkEX,OAAO;IAsBf,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAS7C,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IA6BxC,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;CAStC;AAGD,eAAO,MAAM,WAAW,aAAoB,CAAC;AAC7C,eAAe,WAAW,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import axios from
|
|
2
|
-
import { config } from
|
|
3
|
-
import { createLogger, logRequest } from
|
|
4
|
-
import { handleError, withRetry } from
|
|
5
|
-
const logger = createLogger(
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { config } from "../config/index.js";
|
|
3
|
+
import { createLogger, logRequest } from "../utils/logger.js";
|
|
4
|
+
import { handleError, withRetry } from "../utils/errors.js";
|
|
5
|
+
const logger = createLogger("wsapi-client");
|
|
6
6
|
export class WSAPIClient {
|
|
7
7
|
client;
|
|
8
8
|
constructor() {
|
|
@@ -10,10 +10,10 @@ export class WSAPIClient {
|
|
|
10
10
|
baseURL: config.wsapi.baseUrl,
|
|
11
11
|
timeout: config.wsapi.timeout,
|
|
12
12
|
headers: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
"X-Api-Key": config.wsapi.apiKey,
|
|
15
|
+
"X-Instance-Id": config.wsapi.instanceId,
|
|
16
|
+
"User-Agent": "WSAPI-MCP-Server/2.0.0",
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
this.setupInterceptors();
|
|
@@ -23,14 +23,14 @@ export class WSAPIClient {
|
|
|
23
23
|
this.client.interceptors.request.use((config) => {
|
|
24
24
|
const startTime = Date.now();
|
|
25
25
|
config.metadata = { startTime };
|
|
26
|
-
logger.debug(
|
|
26
|
+
logger.debug("Making API request", {
|
|
27
27
|
method: config.method?.toUpperCase(),
|
|
28
28
|
url: config.url,
|
|
29
|
-
headers: { ...config.headers,
|
|
29
|
+
headers: { ...config.headers, "X-Api-Key": "[REDACTED]" },
|
|
30
30
|
});
|
|
31
31
|
return config;
|
|
32
32
|
}, (error) => {
|
|
33
|
-
logger.error(
|
|
33
|
+
logger.error("Request interceptor error", { error: error.message });
|
|
34
34
|
return Promise.reject(error);
|
|
35
35
|
});
|
|
36
36
|
// Response interceptor
|
|
@@ -38,8 +38,8 @@ export class WSAPIClient {
|
|
|
38
38
|
const duration = response.config.metadata?.startTime
|
|
39
39
|
? Date.now() - response.config.metadata.startTime
|
|
40
40
|
: undefined;
|
|
41
|
-
logRequest(response.config.method?.toUpperCase() ||
|
|
42
|
-
logger.debug(
|
|
41
|
+
logRequest(response.config.method?.toUpperCase() || "UNKNOWN", response.config.url || "UNKNOWN", response.status, duration);
|
|
42
|
+
logger.debug("API request successful", {
|
|
43
43
|
method: response.config.method?.toUpperCase(),
|
|
44
44
|
url: response.config.url,
|
|
45
45
|
status: response.status,
|
|
@@ -50,7 +50,7 @@ export class WSAPIClient {
|
|
|
50
50
|
const duration = error.config?.metadata?.startTime
|
|
51
51
|
? Date.now() - error.config.metadata.startTime
|
|
52
52
|
: undefined;
|
|
53
|
-
logRequest(error.config?.method?.toUpperCase() ||
|
|
53
|
+
logRequest(error.config?.method?.toUpperCase() || "UNKNOWN", error.config?.url || "UNKNOWN", error.response?.status, duration);
|
|
54
54
|
return Promise.reject(error);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -70,22 +70,45 @@ export class WSAPIClient {
|
|
|
70
70
|
}, {
|
|
71
71
|
maxAttempts: config.wsapi.retryAttempts,
|
|
72
72
|
delay: config.wsapi.retryDelay,
|
|
73
|
-
retryableErrors: [
|
|
73
|
+
retryableErrors: ["NETWORK_ERROR", "INSTANCE_ERROR"],
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
// GET request
|
|
77
77
|
async get(path, params) {
|
|
78
78
|
const url = this.buildUrl(path, params);
|
|
79
79
|
return this.request({
|
|
80
|
-
method:
|
|
80
|
+
method: "GET",
|
|
81
81
|
url,
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
// POST request
|
|
85
|
+
async getBinary(path, params) {
|
|
86
|
+
return withRetry(async () => {
|
|
87
|
+
try {
|
|
88
|
+
const response = await this.client.request({
|
|
89
|
+
method: "GET",
|
|
90
|
+
url: this.buildUrl(path, params),
|
|
91
|
+
responseType: "arraybuffer",
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
data: Buffer.from(response.data).toString("base64"),
|
|
95
|
+
mimeType: String(response.headers["content-type"] || "application/octet-stream").split(";")[0] || "application/octet-stream",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw handleError(error, { method: "GET", url: path });
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
maxAttempts: config.wsapi.retryAttempts,
|
|
103
|
+
delay: config.wsapi.retryDelay,
|
|
104
|
+
retryableErrors: ["NETWORK_ERROR", "INSTANCE_ERROR"],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// POST request
|
|
85
108
|
async post(path, data, params) {
|
|
86
109
|
const url = this.buildUrl(path, params);
|
|
87
110
|
return this.request({
|
|
88
|
-
method:
|
|
111
|
+
method: "POST",
|
|
89
112
|
url,
|
|
90
113
|
data,
|
|
91
114
|
});
|
|
@@ -94,7 +117,7 @@ export class WSAPIClient {
|
|
|
94
117
|
async put(path, data, params) {
|
|
95
118
|
const url = this.buildUrl(path, params);
|
|
96
119
|
return this.request({
|
|
97
|
-
method:
|
|
120
|
+
method: "PUT",
|
|
98
121
|
url,
|
|
99
122
|
data,
|
|
100
123
|
});
|
|
@@ -103,7 +126,7 @@ export class WSAPIClient {
|
|
|
103
126
|
async delete(path, params) {
|
|
104
127
|
const url = this.buildUrl(path, params);
|
|
105
128
|
return this.request({
|
|
106
|
-
method:
|
|
129
|
+
method: "DELETE",
|
|
107
130
|
url,
|
|
108
131
|
});
|
|
109
132
|
}
|
|
@@ -113,14 +136,14 @@ export class WSAPIClient {
|
|
|
113
136
|
if (params) {
|
|
114
137
|
// Replace path parameters
|
|
115
138
|
Object.entries(params).forEach(([key, value]) => {
|
|
116
|
-
if (typeof value ===
|
|
139
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
117
140
|
url = url.replace(`{${key}}`, encodeURIComponent(value.toString()));
|
|
118
141
|
}
|
|
119
142
|
});
|
|
120
143
|
// Add query parameters
|
|
121
144
|
const queryParams = new URLSearchParams();
|
|
122
145
|
Object.entries(params).forEach(([key, value]) => {
|
|
123
|
-
if (typeof value ===
|
|
146
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
124
147
|
if (!path.includes(`{${key}}`)) {
|
|
125
148
|
queryParams.append(key, value.toString());
|
|
126
149
|
}
|
|
@@ -135,18 +158,14 @@ export class WSAPIClient {
|
|
|
135
158
|
// Health check method
|
|
136
159
|
async healthCheck() {
|
|
137
160
|
try {
|
|
138
|
-
await this.get(
|
|
161
|
+
await this.get("/session/status");
|
|
139
162
|
return true;
|
|
140
163
|
}
|
|
141
164
|
catch (error) {
|
|
142
|
-
logger.warn(
|
|
165
|
+
logger.warn("Health check failed", { error: error.message });
|
|
143
166
|
return false;
|
|
144
167
|
}
|
|
145
168
|
}
|
|
146
|
-
// Get instance info
|
|
147
|
-
async getInstanceInfo() {
|
|
148
|
-
return this.get('/instance/settings');
|
|
149
|
-
}
|
|
150
169
|
}
|
|
151
170
|
// Export singleton instance
|
|
152
171
|
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,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EA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