whmcs-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.
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,362 @@
1
+ # WHMCS MCP Server
2
+
3
+ [![CI](https://github.com/not-sure-w/whmcs-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/not-sure-w/whmcs-mcp-server/actions/workflows/ci.yml)
4
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](LICENSE)
5
+ [![Node.js >=20](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
6
+
7
+ Automate your hosting business with AI agents. Connect Claude, Cursor, Windsurf, or any MCP-compatible AI to your WHMCS installation.
8
+
9
+ **73 tools** covering clients, tickets, products, invoices, orders, domains, and system health.
10
+
11
+ ## Why This Exists
12
+
13
+ Hosting providers spend 20-50 hours/week on manual WHMCS tasks — triaging tickets, provisioning accounts, chasing invoices, managing domains. AI agents connected through the Model Context Protocol can automate these workflows natively.
14
+
15
+ This server gives AI agents direct, secure access to your entire WHMCS installation through 73 purpose-built tools. Built by a hosting agency, for hosting agencies.
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Install
20
+
21
+ ```bash
22
+ npm install -g whmcs-mcp-server
23
+ ```
24
+
25
+ Or clone the repo:
26
+
27
+ ```bash
28
+ git clone https://github.com/not-sure-w/whmcs-mcp-server.git
29
+ cd whmcs-mcp-server
30
+ npm install
31
+ ```
32
+
33
+ ### 2. Configure
34
+
35
+ Create a `.env` file with your WHMCS credentials:
36
+
37
+ ```bash
38
+ WHMCS_BASE_URL=https://your-whmcs-domain.com
39
+ WHMCS_IDENTIFIER=your_api_identifier
40
+ WHMCS_SECRET=your_api_secret
41
+ ```
42
+
43
+ Get these from your WHMCS admin: **Setup > Staff Management > API Credentials**. Ensure your server IP is whitelisted under **Setup > General Settings > Security**.
44
+
45
+ ### 3. Connect
46
+
47
+ Add the server to your AI tool's MCP configuration (see [Integration](#integration) below), then ask your agent to manage WHMCS directly.
48
+
49
+ ## Features
50
+
51
+ | Category | Tools | Key Capabilities |
52
+ | ----------------- | -------------------------------------------------- | -------------------------------------------------------- |
53
+ | **Clients** (9) | list, get, add, update, delete, users | Full client lifecycle, user management |
54
+ | **Tickets** (12) | list, get, open, reply, notes, canned replies | Ticket triage, responses, internal notes, departments |
55
+ | **Products** (11) | provision, suspend, unsuspend, terminate, upgrade | Service provisioning, module operations, package changes |
56
+ | **Invoices** (11) | create, update, payments, transactions, credits | Invoice management, payment recording, client credits |
57
+ | **Orders** (9) | add, accept, pending, cancel, fraud check | Order processing, fraud detection |
58
+ | **Domains** (11) | register, transfer, renew, nameservers, WHOIS | Full domain lifecycle, lock management, TLD pricing |
59
+ | **Health** (10) | health check, stats, activity log, email, projects | System monitoring, reporting, email, project management |
60
+
61
+ **Total: 73 tools** covering the full WHMCS API.
62
+
63
+ ## Security
64
+
65
+ This server implements defense-in-depth security:
66
+
67
+ - **HTTPS enforcement** — API credentials only sent over encrypted connections
68
+ - **Response sanitization** — Passwords, credit card data, and sensitive fields automatically redacted
69
+ - **Credential masking** — Identifiers masked in logs (e.g., `abc***xyz`), never logged in full
70
+ - **Startup credential validation** — Server tests each credential's permissions on startup and reports scope
71
+ - **Confirmation for destructive ops** — Delete and terminate operations require explicit confirmation tokens
72
+ - **Input validation** — All parameters validated with Zod schemas (email format, dates, enums, length limits)
73
+ - **Request timeouts** — 30-second timeout prevents hung connections
74
+ - **Audit logging** — All tool invocations logged to stderr with sensitive params redacted
75
+
76
+ ### Access Control
77
+
78
+ Three layers of access control, from simple to granular:
79
+
80
+ | Mode | Description |
81
+ | ------------------------ | -------------------------------------------------------------- |
82
+ | **Single-key** (default) | One credential set for all tools |
83
+ | **Multi-key** | Separate credentials for readonly/standard/admin tool tiers |
84
+ | **Read-only mode** | Set `WHMCS_MCP_READONLY=true` to register only read-only tools |
85
+
86
+ Fine-grained tool allowlisting/denylisting via `WHMCS_MCP_ALLOWED_TOOLS` and `WHMCS_MCP_DENIED_TOOLS`.
87
+
88
+ For the full security guide including credential validation output, warning interpretation, and API role scoping, see the [Security Configuration](#security-configuration) section below.
89
+
90
+ ## Integration
91
+
92
+ ### OpenCode
93
+
94
+ Add to your `opencode.json`:
95
+
96
+ ```json
97
+ {
98
+ "mcp": {
99
+ "whmcs": {
100
+ "type": "local",
101
+ "command": ["npx", "whmcs-mcp-server"],
102
+ "env": {
103
+ "WHMCS_BASE_URL": "https://your-whmcs-domain.com",
104
+ "WHMCS_IDENTIFIER": "your_api_identifier",
105
+ "WHMCS_SECRET": "your_api_secret"
106
+ },
107
+ "enabled": true,
108
+ "timeout": 30000
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Claude Desktop
115
+
116
+ Add to your `claude_desktop_config.json`:
117
+
118
+ ```json
119
+ {
120
+ "mcpServers": {
121
+ "whmcs": {
122
+ "command": "npx",
123
+ "args": ["whmcs-mcp-server"],
124
+ "env": {
125
+ "WHMCS_BASE_URL": "https://your-whmcs-domain.com",
126
+ "WHMCS_IDENTIFIER": "your_api_identifier",
127
+ "WHMCS_SECRET": "your_api_secret"
128
+ }
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ ### Cursor
135
+
136
+ Add to your `.cursor/mcp.json` or MCP settings:
137
+
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "whmcs": {
142
+ "command": "npx",
143
+ "args": ["whmcs-mcp-server"],
144
+ "env": {
145
+ "WHMCS_BASE_URL": "https://your-whmcs-domain.com",
146
+ "WHMCS_IDENTIFIER": "your_api_identifier",
147
+ "WHMCS_SECRET": "your_api_secret"
148
+ }
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ ### Windsurf
155
+
156
+ Add to your Windsurf MCP configuration:
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "whmcs": {
162
+ "command": "npx",
163
+ "args": ["whmcs-mcp-server"],
164
+ "env": {
165
+ "WHMCS_BASE_URL": "https://your-whmcs-domain.com",
166
+ "WHMCS_IDENTIFIER": "your_api_identifier",
167
+ "WHMCS_SECRET": "your_api_secret"
168
+ }
169
+ }
170
+ }
171
+ }
172
+ ```
173
+
174
+ ### Generic Stdio (any MCP client)
175
+
176
+ ```json
177
+ {
178
+ "command": "npx",
179
+ "args": ["whmcs-mcp-server"],
180
+ "env": {
181
+ "WHMCS_BASE_URL": "https://your-whmcs-domain.com",
182
+ "WHMCS_IDENTIFIER": "your_api_identifier",
183
+ "WHMCS_SECRET": "your_api_secret"
184
+ }
185
+ }
186
+ ```
187
+
188
+ ### Docker
189
+
190
+ ```bash
191
+ docker compose up
192
+ ```
193
+
194
+ Development with hot-reload:
195
+
196
+ ```bash
197
+ docker compose --profile dev up
198
+ ```
199
+
200
+ ## Use Cases
201
+
202
+ **Auto-reply to Tier 1 support tickets** — Agent reads new tickets, matches against canned replies, and responds with solutions for common issues like password resets and billing questions.
203
+
204
+ **Bulk suspend accounts with overdue invoices** — Agent queries unpaid invoices older than 30 days, identifies associated services, and suspends them with a documented reason.
205
+
206
+ **Renew all domains expiring this month** — Agent lists client domains, filters by expiry date, and processes renewals for domains the client has opted to auto-renew.
207
+
208
+ **Generate daily health report** — Agent pulls system stats, open ticket counts, pending orders, and activity log entries, then summarizes the day's operational status.
209
+
210
+ **Provision new accounts from orders** — Agent accepts pending orders, provisions the associated services, and sends welcome emails to new clients.
211
+
212
+ **Chase overdue invoices** — Agent identifies overdue invoices, checks client history, and sends reminder emails with payment links.
213
+
214
+ ## Development
215
+
216
+ ```bash
217
+ npm run dev # Hot-reload development
218
+ npm run build # Build for production
219
+ npm run start # Run production build
220
+ npm run test # Run tests
221
+ npm run test:watch # Watch mode
222
+ npm run typecheck # TypeScript type checking
223
+ npm run lint # ESLint
224
+ npm run lint:fix # Fix lint issues
225
+ npm run format # Format code with Prettier
226
+ npm run validate # Run all checks (typecheck + lint + format + test)
227
+ ```
228
+
229
+ ### Project Structure
230
+
231
+ ```
232
+ src/
233
+ ├── index.ts # MCP server entry point (v1.0.0)
234
+ ├── client.ts # WHMCS API client (auth, HTTP, sanitization)
235
+ ├── config.ts # Environment config, credential loading, tool access
236
+ ├── utils.ts # Shared utilities (audit logging)
237
+ └── tools/
238
+ ├── clients.ts # Client & user management (9 tools)
239
+ ├── tickets.ts # Support ticket management (12 tools)
240
+ ├── products.ts # Product & service operations (11 tools)
241
+ ├── invoices.ts # Invoice & payment tools (11 tools)
242
+ ├── orders.ts # Order management (9 tools)
243
+ ├── domains.ts # Domain lifecycle tools (11 tools)
244
+ └── health.ts # System health & misc (10 tools)
245
+ ```
246
+
247
+ ## Security Configuration
248
+
249
+ ### Credential Validation on Startup
250
+
251
+ The server automatically validates credentials on startup by testing read access, probing permission scope (read, write, delete, tickets, orders, invoices, products, domains, admin), and reporting results to stderr with masked identifiers. Validation is non-blocking — warnings are logged but the server still starts.
252
+
253
+ ### Interpreting Validation Warnings
254
+
255
+ | Warning | Meaning | Action |
256
+ | ---------------------------------------- | ------------------------------------ | ---------------------------------------------------------------- |
257
+ | `Read access FAILED` | Cannot read from WHMCS API | Check identifier/secret, verify IP whitelist |
258
+ | `Credential can write but cannot delete` | Partial write permissions | Expected for restricted roles; verify if delete tools are needed |
259
+ | `Credential lacks admin-level access` | `WhmcsDetails` API call failed | Some health/stats tools may not work |
260
+ | `denied` on specific scopes | Permission not granted for that area | Create a more permissive API role if needed |
261
+
262
+ ### Recommended API Roles
263
+
264
+ | Role | Permissions |
265
+ | ------------- | ----------------------------------------------------------------------------------- |
266
+ | **Read-only** | View Clients, View Tickets, View Products, View Invoices, View Orders, View Domains |
267
+ | **Support** | Read-only + Manage Tickets, Add Client Notes |
268
+ | **Billing** | Read-only + Manage Invoices, Manage Orders |
269
+ | **Admin** | Full API access (all permissions) |
270
+
271
+ ### Multi-Key Mode (Defense-in-Depth)
272
+
273
+ Use separate credentials for different tool tiers. If any multi-key variable is set, single-key mode is automatically disabled.
274
+
275
+ ```bash
276
+ WHMCS_BASE_URL=https://your-whmcs-domain.com
277
+ WHMCS_READONLY_IDENTIFIER=readonly_api_id
278
+ WHMCS_READONLY_SECRET=readonly_api_secret
279
+ WHMCS_STANDARD_IDENTIFIER=standard_api_id
280
+ WHMCS_STANDARD_SECRET=standard_api_secret
281
+ WHMCS_ADMIN_IDENTIFIER=admin_api_id
282
+ WHMCS_ADMIN_SECRET=admin_api_secret
283
+ ```
284
+
285
+ | Credential Set | Tools | Risk if Compromised |
286
+ | -------------- | ---------------------------- | ---------------------------------- |
287
+ | **Read-only** | list/get tools | Attacker can only read data |
288
+ | **Standard** | create/update tools | Attacker can modify but not delete |
289
+ | **Admin** | delete/terminate/fraud tools | Full destructive access |
290
+
291
+ ### Tool Allowlisting / Denylisting
292
+
293
+ ```bash
294
+ # Only these tools will be registered
295
+ WHMCS_MCP_ALLOWED_TOOLS=whmcs_list_clients,whmcs_get_ticket,whmcs_health_check
296
+
297
+ # These tools will be excluded
298
+ WHMCS_MCP_DENIED_TOOLS=whmcs_delete_client,whmcs_delete_ticket,whmcs_module_terminate
299
+ ```
300
+
301
+ `WHMCS_MCP_ALLOWED_TOOLS` takes precedence. If both are set, only the allowlist is used.
302
+
303
+ ### Tool Role Reference
304
+
305
+ | Role | Description | Example Tools |
306
+ | ---------- | ------------------------------- | ----------------------------------------------- |
307
+ | `readonly` | Safe read-only operations | `whmcs_list_clients`, `whmcs_get_ticket` |
308
+ | `standard` | Create/update (non-destructive) | `whmcs_add_client`, `whmcs_open_ticket` |
309
+ | `admin` | Destructive/irreversible | `whmcs_delete_client`, `whmcs_module_terminate` |
310
+
311
+ ### Environment Variables
312
+
313
+ ```bash
314
+ # Required
315
+ WHMCS_BASE_URL=https://your-whmcs-domain.com
316
+
317
+ # Single-key mode (default)
318
+ WHMCS_IDENTIFIER=your_api_identifier
319
+ WHMCS_SECRET=your_api_secret
320
+
321
+ # OR Multi-key mode (optional, overrides single-key)
322
+ # WHMCS_READONLY_IDENTIFIER=readonly_api_id
323
+ # WHMCS_READONLY_SECRET=readonly_api_secret
324
+ # WHMCS_STANDARD_IDENTIFIER=standard_api_id
325
+ # WHMCS_STANDARD_SECRET=standard_api_secret
326
+ # WHMCS_ADMIN_IDENTIFIER=admin_api_id
327
+ # WHMCS_ADMIN_SECRET=admin_api_secret
328
+
329
+ # Access control (optional)
330
+ # WHMCS_MCP_READONLY=false
331
+ # WHMCS_MCP_ALLOWED_TOOLS=whmcs_list_clients,whmcs_get_ticket
332
+ # WHMCS_MCP_DENIED_TOOLS=whmcs_delete_client
333
+ ```
334
+
335
+ `WHMCS_BASE_URL` must use `https://`. HTTP connections are rejected.
336
+
337
+ ## Contributing
338
+
339
+ Contributions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
340
+
341
+ 1. Fork the repository
342
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
343
+ 3. Run `npm run validate` to ensure all checks pass
344
+ 4. Commit and push
345
+ 5. Open a Pull Request
346
+
347
+ ## License
348
+
349
+ ISC License — see [LICENSE](LICENSE) for details.
350
+
351
+ ## Support
352
+
353
+ - **Issues:** [GitHub Issues](https://github.com/not-sure-w/whmcs-mcp-server/issues)
354
+ - **Discussions:** [GitHub Discussions](https://github.com/not-sure-w/whmcs-mcp-server/discussions)
355
+ - **Support development:** [Buy me a coffee](https://buymeacoffee.com/whmcsmcp)
356
+
357
+ ### Consulting & Custom Development
358
+
359
+ Need help integrating WHMCS with AI agents or want custom MCP tools built for your setup?
360
+
361
+ - **Email:** hello@whmcsmcp.com
362
+ - **GitHub:** [Contact via Issues](https://github.com/not-sure-w/whmcs-mcp-server/issues)
@@ -0,0 +1,2 @@
1
+
2
+ export { }