@elitedcs/ghl-mcp 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 ADDED
@@ -0,0 +1,758 @@
1
+ # Elite DCs GHL MCP Server
2
+
3
+ **Full GoHighLevel API access for Claude.** 171 tools across 35 modules — manage contacts, conversations, pipelines, calendars, funnels, workflows, invoices, custom objects, webhooks, and more. **Includes full workflow builder, funnel/page editor, form builder, pipeline builder, bulk operations, account export, and workflow cloning** — capabilities no other GHL tool offers.
4
+
5
+ **v2.7.0** — Production-hardened with automatic retry/backoff, Zod-validated API responses, pre-flight workflow action validation, and type-safe tool registration. Built to share confidently.
6
+
7
+ Works with **both the Claude Desktop App and Claude Code terminal** — your choice.
8
+
9
+ Built by [Elite DCs, LLC](https://elitedcs.com) for the Clinic Launch Lab project and beyond.
10
+
11
+ ---
12
+
13
+ ## What Makes This Different
14
+
15
+ Most GHL integrations give you read access and basic CRUD. This server goes far beyond that — it includes capabilities that **don't exist anywhere else**, built on reverse-engineered internal APIs that GHL's public API doesn't expose.
16
+
17
+ | Exclusive Feature | Why It Matters |
18
+ |---|---|
19
+ | **Programmatic Workflow Builder** | The only tool on the market that can create, edit, and publish GHL workflows via code. GHL's public API has no workflow write endpoints — this uses their internal backend API (the same one their UI calls) to give Claude full workflow CRUD. Build entire automation sequences from a conversation. |
20
+ | **Deep Workflow Cloning** | Clone any workflow with full UUID remapping — every action, trigger, branch, and internal reference gets new IDs. No other tool can duplicate a workflow programmatically without ID collisions. |
21
+ | **Funnel & Page Editor** | Read and edit funnel page content — sections, elements, rows, CSS, tracking codes. Goes beyond the public API's list-only access. |
22
+ | **Form Builder** | Full form CRUD including field management, conditional logic, and auto-responder configuration via internal API. |
23
+ | **Pipeline Builder** | Create, edit, and delete pipelines and stages via internal API. The public API only lists pipelines — this lets Claude build them. |
24
+ | **Template Deployment** | Deploy a complete sub-account setup (tags, custom fields, pipelines, workflows, forms) from a single template. Set up a new client in minutes instead of hours. |
25
+ | **Multi-Sub-Account Token Registry** | Register multiple sub-accounts with their own API keys. Switch locations mid-session and the API key swaps automatically — no restart needed. |
26
+ | **Full Account Export & Diff** | Export an entire sub-account to JSON or compare two locations side-by-side. Useful for auditing, migration, and quality control. |
27
+
28
+ Everything else — CRM, conversations, calendars, invoices, bulk ops — works through GHL's official public API v2 with full read/write access.
29
+
30
+ ---
31
+
32
+ ## What It Does
33
+
34
+ This MCP (Model Context Protocol) server connects Claude directly to GoHighLevel's API v2. Once installed, Claude can read and write to your GHL account — no browser, no Zapier, no middleware. Use it from the Claude Desktop App (no terminal needed) or from Claude Code in the terminal.
35
+
36
+ | Capability | What Claude Can Do |
37
+ |---|---|
38
+ | **CRM** | Search, create, update, and delete contacts. Manage tags, notes, tasks. |
39
+ | **Conversations** | Read message threads, send SMS/email/WhatsApp, update message status. |
40
+ | **Pipeline** | Create and manage opportunities. Move deals through stages. |
41
+ | **Scheduling** | Check availability, book appointments, manage calendars. |
42
+ | **Automation** | **Full workflow builder** — create, read, edit, and publish workflows. See every action, trigger, condition, and branch. Clone workflows with deep ID remapping. |
43
+ | **Marketing** | **Funnel/page editor** — read and edit existing funnel page content (sections, elements, CSS). **Full form builder** — read/edit all fields, conditional logic, auto-responder. |
44
+ | **Pipelines** | **Full pipeline builder** — create, edit, delete pipelines. Add, remove, rename, reorder stages. |
45
+ | **Bulk Ops** | Batch tag, untag, update fields, enroll in workflows, or delete contacts — all rate-limited. |
46
+ | **Backup** | Export entire sub-account to JSON. Compare two locations side-by-side for auditing. |
47
+ | **Multi-Location** | Switch between sub-accounts mid-session. Token registry stores per-location API keys for seamless switching. |
48
+ | **Billing** | Create/send/void invoices, record payments, view orders and subscriptions. |
49
+ | **Content** | Manage blog posts, social media posts, courses, media files. |
50
+ | **Custom Objects** | Full CRUD on custom object schemas and records. Manage associations. |
51
+ | **Estimates & Coupons** | Create/send estimates, manage promo codes. |
52
+ | **Webhooks** | Create and manage webhook subscriptions. |
53
+ | **Documents** | List, send, and manage documents/contracts. |
54
+ | **Admin** | View/update sub-accounts, manage custom fields, custom values, location tags, users. |
55
+
56
+ ---
57
+
58
+ ## Quick Start
59
+
60
+ Choose your path:
61
+
62
+ ### Path 1: Easy Install (Recommended — No Technical Knowledge Needed)
63
+
64
+ **What you need first:**
65
+ 1. **Claude** — either the [Claude Desktop App](https://claude.ai/download) or [Claude Code](https://claude.ai/code) (or both!)
66
+ 2. **Node.js** — download from [nodejs.org](https://nodejs.org) (click the big green "LTS" button and run the installer)
67
+ 3. Your **license key** and **purchase email** (sent to you after purchase)
68
+ 4. Your **GHL API Key** and **Location ID** (see "Get Your GHL API Key" below)
69
+
70
+ **Then just do this:**
71
+
72
+ 1. Open a terminal (on Mac: search "Terminal" in Spotlight) or open Claude Code
73
+ 2. Paste this line and press Enter:
74
+ ```
75
+ cd ~/projects && git clone git@github.com:drjerryrelth/ghl-command-mcp.git && cd ghl-command-mcp && bash setup.sh
76
+ ```
77
+ > If running from inside Claude Code, prefix the command with `!`:
78
+ > ```
79
+ > ! cd ~/projects && git clone git@github.com:drjerryrelth/ghl-command-mcp.git && cd ghl-command-mcp && bash setup.sh
80
+ > ```
81
+
82
+ > **Note:** This repo is private. You must have an SSH key linked to your GitHub account. See [GitHub SSH setup](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) if you haven't done this before.
83
+
84
+ 3. The setup wizard opens — it will:
85
+ - Validate your license key (from your purchase email)
86
+ - Ask for your GHL API key (paste it when prompted)
87
+ - Ask for your Location ID (paste it when prompted)
88
+ - Verify your credentials work
89
+ - Optionally enable the workflow builder (you can skip this)
90
+ - **Ask which Claude client(s) to register with** — Desktop App, terminal, or both
91
+ - Register everything for you automatically
92
+ 4. Restart the Claude app (quit fully and reopen) or restart Claude Code
93
+ 5. Try it: type `"List my contacts"` — you should see your GHL data
94
+
95
+ **That's it. One command, follow the prompts, done.**
96
+
97
+ ---
98
+
99
+ ### Path 2: Manual Install (For Developers)
100
+
101
+ #### Option A: Claude Code (Terminal)
102
+
103
+ ```bash
104
+ git clone git@github.com:drjerryrelth/ghl-command-mcp.git
105
+ cd ghl-command-mcp
106
+ npm install && npm run build
107
+ cp start-mcp.example.sh start-mcp.sh
108
+ # Edit start-mcp.sh with your API key and Location ID
109
+ chmod +x start-mcp.sh
110
+ claude mcp add --scope user -t stdio ghl $(pwd)/start-mcp.sh
111
+ ```
112
+
113
+ > **Why a wrapper script?** Claude Code's env injection via MCP config is unreliable. The wrapper script exports env vars directly, guaranteeing they reach the server process. MCP servers must be registered in `~/.claude.json` (via `claude mcp add`), NOT in `~/.claude/mcp.json`.
114
+
115
+ #### Option B: Claude Desktop App
116
+
117
+ ```bash
118
+ git clone git@github.com:drjerryrelth/ghl-command-mcp.git
119
+ cd ghl-command-mcp
120
+ npm install && npm run build
121
+ ```
122
+
123
+ Then add the MCP server to your Claude Desktop config file:
124
+
125
+ - **Mac:** `~/Library/Application Support/Claude/claude_desktop_config.json`
126
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
127
+
128
+ Add a `"ghl"` entry under `"mcpServers"`:
129
+
130
+ ```json
131
+ {
132
+ "mcpServers": {
133
+ "ghl": {
134
+ "command": "node",
135
+ "args": ["/full/path/to/ghl-command-mcp/dist/index.js"],
136
+ "env": {
137
+ "GHL_API_KEY": "YOUR_API_KEY_HERE",
138
+ "GHL_LOCATION_ID": "YOUR_LOCATION_ID_HERE"
139
+ }
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ > **Tip:** Replace `/full/path/to/` with the actual path where you cloned the repo (e.g., `/Users/yourname/projects/ghl-command-mcp/dist/index.js`). To add workflow builder support, include `GHL_USER_ID`, `GHL_FIREBASE_API_KEY`, and `GHL_FIREBASE_REFRESH_TOKEN` in the `env` block too.
146
+
147
+ Quit the Claude app fully and reopen it. The GHL tools will appear automatically.
148
+
149
+ #### Option C: Both
150
+
151
+ Run the Easy Install (Path 1) — the setup wizard lets you register with both clients in one step.
152
+
153
+ ---
154
+
155
+ ### Get Your GHL API Key
156
+
157
+ > **CRITICAL: Sub-Account Level Only**
158
+ >
159
+ > Private Integrations in GHL are **scoped to individual sub-accounts**, NOT to the agency level. You must create a separate Private Integration **inside each sub-account** you want to connect. An API key created in Sub-Account A will return `403 Forbidden` if you try to use it with Sub-Account B's Location ID.
160
+ >
161
+ > **Your API key can only be copied ONCE** — at the moment you create the integration. After you leave that screen, the key is permanently masked and cannot be retrieved. If you lose it, you must delete the integration and create a new one (which generates a new key).
162
+
163
+ 1. Log into GoHighLevel
164
+ 2. **Switch into the specific sub-account** you want to connect (not the agency view)
165
+ 3. Go to **Settings** > **Integrations**
166
+ 4. Click **Private Integrations** > **Create Private Integration**
167
+ 5. Name it `Claude Code MCP`
168
+ 6. Enable all scopes/permissions you want Claude to access
169
+ 7. **Immediately copy the API Key** and paste it into your config — you will not be able to see it again
170
+
171
+ ### Enable Workflow Builder (Optional)
172
+
173
+ The workflow builder tools use GHL's internal API and require additional Firebase credentials. Without these, the standard API tools still work — you just won't have workflow editing.
174
+
175
+ **Step 1: Get your Firebase credentials from GHL**
176
+
177
+ 1. Log into `app.gohighlevel.com` in Chrome
178
+ 2. Press **Cmd + Option + I** (Mac) or **F12** (Windows) to open Developer Tools
179
+ 3. Go to **Application** tab → **IndexedDB** → expand **firebaseLocalStorageDb** → **firebaseLocalStorage**
180
+ 4. Click the entry — you'll see a JSON object with:
181
+ - `stsTokenManager.refreshToken` — this is your **Firebase Refresh Token**
182
+ - The `fbase_key` contains the **Firebase API Key** (the part between `firebase:authUser:` and `:[DEFAULT]`)
183
+ 5. Your **User ID** is in the `uid` field
184
+
185
+ **Step 2: Add to your wrapper script**
186
+
187
+ Add these to `start-mcp.sh` alongside your existing env vars:
188
+
189
+ ```bash
190
+ export GHL_USER_ID="your-user-id"
191
+ export GHL_FIREBASE_API_KEY="your-firebase-api-key"
192
+ export GHL_FIREBASE_REFRESH_TOKEN="your-firebase-refresh-token"
193
+ ```
194
+
195
+ Restart Claude Code and the workflow builder tools will be available.
196
+
197
+ > **Note:** The Firebase refresh token may rotate periodically. If workflow tools stop working, re-extract the token from your browser using the steps above.
198
+
199
+ ### Find Your Location ID
200
+
201
+ Your Location ID (sub-account ID) is in the GHL URL when you're inside a sub-account:
202
+
203
+ ```
204
+ https://app.gohighlevel.com/v2/location/YOUR_LOCATION_ID/dashboard
205
+ ```
206
+
207
+ ### Verify It Works
208
+
209
+ Restart the Claude Desktop App (quit fully and reopen) or restart Claude Code, then try:
210
+
211
+ ```
212
+ "List my contacts"
213
+ "Show my pipelines"
214
+ "What calendars do I have?"
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Tools (171)
220
+
221
+ ### CRM & Contacts (15 tools)
222
+
223
+ | Tool | What It Does |
224
+ |---|---|
225
+ | `search_contacts` | Search contacts by name, email, phone, or tag |
226
+ | `get_contact` | Get full contact details by ID |
227
+ | `create_contact` | Create a new contact |
228
+ | `update_contact` | Update contact fields |
229
+ | `delete_contact` | Delete a contact |
230
+ | `upsert_contact` | Create or update a contact (match by email/phone) |
231
+ | `add_contact_tags` | Add tags to a contact |
232
+ | `remove_contact_tags` | Remove tags from a contact |
233
+ | `get_contact_tasks` | List tasks for a contact |
234
+ | `create_contact_task` | Create a task on a contact |
235
+ | `get_contact_notes` | List notes on a contact |
236
+ | `create_contact_note` | Add a note to a contact |
237
+ | `get_contact_appointments` | List a contact's appointments |
238
+ | `add_contact_to_workflow` | Add a contact to a workflow |
239
+ | `remove_contact_from_workflow` | Remove a contact from a workflow |
240
+
241
+ ### Conversations & Messaging (8 tools)
242
+
243
+ | Tool | What It Does |
244
+ |---|---|
245
+ | `search_conversations` | Search conversation threads |
246
+ | `get_conversation` | Get a specific conversation |
247
+ | `create_conversation` | Start a new conversation |
248
+ | `get_messages` | Read messages in a conversation |
249
+ | `send_message` | Send SMS, email, or WhatsApp message |
250
+ | `add_inbound_message` | Log an inbound message |
251
+ | `update_message_status` | Update read/unread status |
252
+ | `get_message` | Get a specific message |
253
+
254
+ ### Opportunities & Pipelines (7 tools)
255
+
256
+ | Tool | What It Does |
257
+ |---|---|
258
+ | `search_opportunities` | Search deals across pipelines |
259
+ | `get_opportunity` | Get opportunity details |
260
+ | `create_opportunity` | Create a new deal |
261
+ | `update_opportunity` | Update deal fields or move stages |
262
+ | `delete_opportunity` | Delete a deal |
263
+ | `update_opportunity_status` | Change opportunity status (won/lost/open) |
264
+ | `get_pipelines` | List all pipelines and their stages |
265
+
266
+ ### Calendars & Scheduling (11 tools)
267
+
268
+ | Tool | What It Does |
269
+ |---|---|
270
+ | `get_calendars` | List all calendars |
271
+ | `get_calendar` | Get calendar details |
272
+ | `create_calendar` | Create a new calendar |
273
+ | `update_calendar` | Update calendar settings |
274
+ | `delete_calendar` | Delete a calendar |
275
+ | `get_free_slots` | Check available time slots |
276
+ | `get_calendar_events` | List events on a calendar |
277
+ | `get_appointment` | Get appointment details |
278
+ | `create_appointment` | Book an appointment |
279
+ | `update_appointment` | Update an appointment |
280
+ | `delete_appointment` | Cancel an appointment |
281
+
282
+ ### Locations & Sub-Accounts (15 tools)
283
+
284
+ | Tool | What It Does |
285
+ |---|---|
286
+ | `get_location` | Get sub-account details |
287
+ | `update_location` | Update sub-account settings |
288
+ | `search_locations` | Search locations |
289
+ | `get_location_tags` | List all tags in a location |
290
+ | `create_location_tag` | Create a new tag |
291
+ | `update_location_tag` | Update an existing tag |
292
+ | `delete_location_tag` | Delete a tag |
293
+ | `get_custom_fields` | List all custom fields |
294
+ | `create_custom_field` | Create a new custom field |
295
+ | `update_custom_field` | Update a custom field |
296
+ | `delete_custom_field` | Delete a custom field |
297
+ | `get_custom_values` | List all custom values |
298
+ | `create_custom_value` | Create a new custom value |
299
+ | `update_custom_value` | Update a custom value |
300
+ | `delete_custom_value` | Delete a custom value |
301
+
302
+ ### Custom Objects (7 tools)
303
+
304
+ | Tool | What It Does |
305
+ |---|---|
306
+ | `list_custom_objects` | List all custom object schemas |
307
+ | `get_custom_object` | Get a custom object schema by key |
308
+ | `search_custom_object_records` | Search records of a custom object |
309
+ | `get_custom_object_record` | Get a single record by ID |
310
+ | `create_custom_object_record` | Create a new record |
311
+ | `update_custom_object_record` | Update an existing record |
312
+ | `delete_custom_object_record` | Delete a record |
313
+
314
+ ### Associations (3 tools)
315
+
316
+ | Tool | What It Does |
317
+ |---|---|
318
+ | `list_associations` | List associations for a custom object record |
319
+ | `create_association` | Link a record to a contact/opportunity/other record |
320
+ | `delete_association` | Remove an association |
321
+
322
+ ### Invoices & Billing (8 tools)
323
+
324
+ | Tool | What It Does |
325
+ |---|---|
326
+ | `list_invoices` | List all invoices |
327
+ | `get_invoice` | Get invoice details |
328
+ | `create_invoice` | Create a new invoice |
329
+ | `update_invoice` | Update an invoice |
330
+ | `send_invoice` | Send invoice to recipient |
331
+ | `void_invoice` | Void an invoice |
332
+ | `record_invoice_payment` | Record a payment against an invoice |
333
+ | `delete_invoice` | Delete an invoice |
334
+
335
+ ### Estimates (6 tools)
336
+
337
+ | Tool | What It Does |
338
+ |---|---|
339
+ | `list_estimates` | List estimates/quotes |
340
+ | `get_estimate` | Get estimate details |
341
+ | `create_estimate` | Create a new estimate |
342
+ | `update_estimate` | Update an estimate |
343
+ | `delete_estimate` | Delete an estimate |
344
+ | `send_estimate` | Send an estimate to a contact |
345
+
346
+ ### Coupons (5 tools)
347
+
348
+ | Tool | What It Does |
349
+ |---|---|
350
+ | `list_coupons` | List all coupons/promo codes |
351
+ | `get_coupon` | Get coupon details |
352
+ | `create_coupon` | Create a new coupon |
353
+ | `update_coupon` | Update a coupon |
354
+ | `delete_coupon` | Delete a coupon |
355
+
356
+ ### Webhooks (5 tools)
357
+
358
+ | Tool | What It Does |
359
+ |---|---|
360
+ | `list_webhooks` | List all webhook subscriptions |
361
+ | `get_webhook` | Get webhook details |
362
+ | `create_webhook` | Create a new webhook |
363
+ | `update_webhook` | Update a webhook |
364
+ | `delete_webhook` | Delete a webhook |
365
+
366
+ ### Documents (4 tools)
367
+
368
+ | Tool | What It Does |
369
+ |---|---|
370
+ | `list_documents` | List documents and contracts |
371
+ | `get_document` | Get document details and signature status |
372
+ | `delete_document` | Delete a document |
373
+ | `send_document` | Send a document for e-signature |
374
+
375
+ ### Payments (4 tools)
376
+
377
+ | Tool | What It Does |
378
+ |---|---|
379
+ | `get_orders` | View all orders |
380
+ | `get_order` | Get order details |
381
+ | `get_subscriptions` | List active subscriptions |
382
+ | `get_transactions` | View transaction history |
383
+
384
+ ### Workflow Builder (6 tools) — Internal API
385
+
386
+ > **This is the flagship feature.** GHL's public API has **zero** workflow write endpoints. These tools use GHL's internal backend API — the same API their own UI calls — reverse-engineered to give Claude full workflow CRUD. No other GHL integration, Zapier connector, or third-party tool can create or edit workflows programmatically. Requires additional Firebase auth setup (see "Enable Workflow Builder" in Quick Start above).
387
+
388
+ | Tool | What It Does |
389
+ |---|---|
390
+ | `list_workflows_full` | List all workflows with full metadata, versions, and permissions |
391
+ | `get_workflow_full` | Get complete workflow internals: every action, trigger, condition, if/else branch, email template, SMS body |
392
+ | `create_workflow` | Create a new workflow from scratch (starts as draft) |
393
+ | `update_workflow_actions` | Add, edit, or remove actions, triggers, and branches in an existing workflow |
394
+ | `delete_workflow_full` | Permanently delete a workflow |
395
+ | `publish_workflow` | Publish a draft workflow to make it active |
396
+
397
+ **What you can build:** Complete automation sequences — lead nurture drip campaigns, appointment reminder sequences, onboarding flows, re-engagement workflows, internal notification chains. Tell Claude what you want and it builds the workflow action by action.
398
+
399
+ **Supported action types:** `sms`, `email`, `add_contact_tag`, `remove_contact_tag`, `update_contact_field`, `wait`, `if_else`, `webhook`, `create_opportunity`, `custom_code`, `add_notes`, `internal_notification`, `task-notification`, `remove_from_workflow`, and more.
400
+
401
+ **Supported trigger types:** `contact_tag`, `contact_created`, `form_submission`, `customer_reply`, `appointment`, `inbound_webhook`, `payment_received`, and more.
402
+
403
+ ### Pipeline Builder (5 tools) — Internal API
404
+
405
+ > Also uses GHL's internal API. The public API only lists pipelines — this lets Claude create, edit, and delete pipelines and their stages.
406
+
407
+ | Tool | What It Does |
408
+ |---|---|
409
+ | `list_pipelines_full` | List all pipelines with full stage details, positions, and display settings |
410
+ | `get_pipeline_full` | Get a single pipeline with complete stage configuration |
411
+ | `create_pipeline` | Create a new pipeline with stages |
412
+ | `update_pipeline` | Update name, add/remove/rename/reorder stages |
413
+ | `delete_pipeline` | Permanently delete a pipeline |
414
+
415
+ ### Bulk Operations (5 tools)
416
+
417
+ | Tool | What It Does |
418
+ |---|---|
419
+ | `bulk_add_tags` | Add tags to multiple contacts at once (rate-limited) |
420
+ | `bulk_remove_tags` | Remove tags from multiple contacts (rate-limited) |
421
+ | `bulk_update_contacts` | Update the same fields on multiple contacts (rate-limited) |
422
+ | `bulk_add_to_workflow` | Enroll multiple contacts into a workflow (rate-limited) |
423
+ | `bulk_delete_contacts` | Delete multiple contacts (rate-limited, requires safety confirmation) |
424
+
425
+ ### Account Export & Comparison (2 tools)
426
+
427
+ | Tool | What It Does |
428
+ |---|---|
429
+ | `export_account` | Full sub-account backup — contacts, pipelines, workflows, funnels, forms, fields, tags, calendars, users |
430
+ | `compare_locations` | Side-by-side diff of two sub-accounts for auditing or migration |
431
+
432
+ ### Location Switcher & Token Registry (6 tools)
433
+
434
+ | Tool | What It Does |
435
+ |---|---|
436
+ | `get_current_location` | Show which sub-account is active |
437
+ | `switch_location` | Switch to a different sub-account mid-session (auto-swaps API key from registry) |
438
+ | `list_available_locations` | List all accessible sub-accounts |
439
+ | `register_location` | Add a sub-account and its API key to the token registry |
440
+ | `unregister_location` | Remove a sub-account from the token registry |
441
+ | `list_registered_locations` | List all sub-accounts stored in the token registry |
442
+
443
+ ### Workflow Cloner (1 tool)
444
+
445
+ > Deep-clones a workflow with full UUID remapping. Every action, trigger, branch, and internal cross-reference gets a new unique ID. GHL has no built-in way to duplicate a workflow programmatically — this is the only tool that can.
446
+
447
+ | Tool | What It Does |
448
+ |---|---|
449
+ | `clone_workflow` | Deep clone a workflow with new UUIDs for all actions, triggers, and references |
450
+
451
+ ### Template Deployer (3 tools)
452
+
453
+ > Deploy a complete sub-account setup from a pre-built template — tags, custom fields, pipelines, workflows, and forms — in one step. Claude walks the user through a questionnaire, then deploys everything. Includes dry-run mode to preview changes before applying.
454
+
455
+ | Tool | What It Does |
456
+ |---|---|
457
+ | `list_templates` | List available setup templates (clinic, med spa, dental, etc.) |
458
+ | `get_template_questionnaire` | Get the questionnaire for a template — present to user conversationally |
459
+ | `deploy_template` | Deploy a complete sub-account setup from a template (tags, fields, pipelines, workflows, forms). Supports dry-run mode. |
460
+
461
+ ### Other Modules
462
+
463
+ | Module | Tools | What It Does |
464
+ |---|---|---|
465
+ | **Social Planner** | 5 | Create, list, delete posts, view connected accounts |
466
+ | **Businesses** | 5 | Full CRUD on business entities |
467
+ | **Blogs** | 5 | Posts, authors, categories, URL slugs |
468
+ | **Funnels** (public API) | 2 | List funnels and their pages |
469
+ | **Forms** (public API) | 2 | List forms and view submissions |
470
+ | **Surveys** | 2 | List surveys and view submissions |
471
+ | **Users** | 2 | List and view team members |
472
+ | **Media** | 2 | Browse and delete media files |
473
+ | **Campaigns** | 1 | List campaigns |
474
+ | **Workflows** (public API) | 1 | List all workflows |
475
+ | **Courses** | 1 | List courses |
476
+ | **Emails** | 1 | List email campaigns |
477
+ | **Trigger Links** | 1 | List trigger links |
478
+
479
+ ---
480
+
481
+ ## How It Works
482
+
483
+ ```
484
+ ┌──────────────────┐ ┌──────────────────┐
485
+ │ Claude Desktop │ │ Claude Code │
486
+ │ App (GUI) │ │ (Terminal) │
487
+ └────────┬─────────┘ └────────┬─────────┘
488
+ │ │
489
+ └──────────┬───────────┘
490
+ │ MCP Protocol (stdio)
491
+ ┌───────────────────┴─────────────────────┐
492
+ │ GHL MCP SERVER │
493
+ │ │
494
+ │ ┌──────────┐ ┌──────────┐ ┌────────┐ │
495
+ │ │ Contacts │ │ Calendar │ │Invoices│ │
496
+ │ │ 15 tools │ │ 11 tools │ │8 tools │ │
497
+ │ └────┬─────┘ └────┬─────┘ └───┬────┘ │
498
+ │ └─────────────┼───────────┘ │
499
+ │ ┌──────┴──────┐ │
500
+ │ │ GHL Client │ │
501
+ │ └──────┬──────┘ │
502
+ ├─────────────────────┼───────────────────┤
503
+ │ ↓ │
504
+ │ GoHighLevel API v2 │
505
+ │ https://services.leadconnectorhq.com │
506
+ └─────────────────────────────────────────┘
507
+ ```
508
+
509
+ ### Architecture
510
+
511
+ - **`src/index.ts`** — MCP server entry, startup API key validation, tool registration.
512
+ - **`src/ghl-client.ts`** — HTTP client for GHL API v2. Returns `Promise<unknown>` (no generic `as T` casts). Automatic retry with exponential backoff on 429/5xx/network errors. 30-second timeout with clear error messages.
513
+ - **`src/workflow-builder-client.ts`** — Internal API client for workflow CRUD. Firebase auth with thread-safe token refresh (promise lock), retry/backoff, Zod-validated `WorkflowFull` responses, and pre-flight `validateActionChain()` that catches common action attribute errors before GHL can silently fail.
514
+ - **`src/api-schemas.ts`** — Zod response schemas for contacts, pipelines, and calendars. Runtime validation on the most-used API paths.
515
+ - **`src/workflow-action-types.ts`** — Discriminated union types for all 11 documented workflow action types. Compile-time enforcement of action-specific attributes (SMS needs `body`, email needs `subject`+`html`, etc.).
516
+ - **`src/tool-helpers.ts`** — `safeTool()` wrapper (automatic try/catch + JSON formatting for 127 tools), response helpers, error formatting.
517
+ - **`src/token-registry.ts`** — Per-location API key storage, Zod-validated on load with corruption backup.
518
+ - **`src/tools/index.ts`** — Type-safe registry array. Compiler catches missing tool registrations.
519
+ - **`src/tools/*.ts`** — One file per GHL domain. Most use `safeTool()` for zero-boilerplate handlers.
520
+
521
+ ### Build System
522
+
523
+ Uses **esbuild** for production builds (not tsc). TypeScript 5.9.3 + MCP SDK types cause tsc to run out of memory at 4GB+. esbuild bundles in ~5ms with zero memory issues.
524
+
525
+ ```bash
526
+ npm run build # esbuild → dist/index.js (~212KB)
527
+ npm run dev # tsc --watch (type-checking only)
528
+ ```
529
+
530
+ ### Data Flow
531
+
532
+ ```
533
+ User prompt → Claude Code → MCP tool call → GHL Client → GHL API → JSON response → Claude Code → User
534
+ ```
535
+
536
+ Every tool returns structured JSON. Claude interprets the response and presents it naturally. No data is stored locally — it's a pass-through to GHL's API.
537
+
538
+ ---
539
+
540
+ ## Project Structure
541
+
542
+ ```
543
+ ghl-command-mcp/
544
+ ├── src/
545
+ │ ├── index.ts # MCP server entry point + startup validation
546
+ │ ├── ghl-client.ts # GHL API v2 HTTP client (retry/backoff, returns unknown)
547
+ │ ├── workflow-builder-client.ts # Internal API client (Firebase auth, Zod-validated responses)
548
+ │ ├── workflow-action-types.ts # Discriminated union types for workflow actions
549
+ │ ├── api-schemas.ts # Zod response schemas for contacts, pipelines, calendars
550
+ │ ├── token-registry.ts # Per-location API key storage (Zod-validated on load)
551
+ │ ├── tool-helpers.ts # safeTool() wrapper, response helpers, error formatting
552
+ │ └── tools/
553
+ │ ├── index.ts # Type-safe tool registry (compiler-checked)
554
+ │ ├── contacts.ts # 15 tools — CRM & contact management
555
+ │ ├── conversations.ts # 8 tools — messaging (SMS, email, WhatsApp)
556
+ │ ├── opportunities.ts # 7 tools — pipeline & deal management
557
+ │ ├── calendars.ts # 11 tools — scheduling & appointments
558
+ │ ├── locations.ts # 15 tools — sub-accounts, custom fields/values, tags
559
+ │ ├── invoices.ts # 8 tools — invoicing & payment recording
560
+ │ ├── custom-objects.ts # 7 tools — custom object schema & record CRUD
561
+ │ ├── estimates.ts # 6 tools — estimates/quotes
562
+ │ ├── social-planner.ts # 5 tools — social media management
563
+ │ ├── businesses.ts # 5 tools — business entity management
564
+ │ ├── blogs.ts # 5 tools — blog management
565
+ │ ├── coupons.ts # 5 tools — promo code management
566
+ │ ├── webhooks.ts # 5 tools — webhook subscriptions
567
+ │ ├── payments.ts # 4 tools — orders, subscriptions, transactions
568
+ │ ├── documents.ts # 4 tools — document & contract management
569
+ │ ├── associations.ts # 3 tools — custom object associations
570
+ │ ├── funnels.ts # 2 tools — funnel & page listing
571
+ │ ├── forms.ts # 2 tools — forms & submissions
572
+ │ ├── surveys.ts # 2 tools — surveys & submissions
573
+ │ ├── users.ts # 2 tools — team members
574
+ │ ├── media.ts # 2 tools — media file management
575
+ │ ├── campaigns.ts # 1 tool — campaign listing
576
+ │ ├── workflows.ts # 1 tool — workflow listing
577
+ │ ├── courses.ts # 1 tool — course listing
578
+ │ ├── emails.ts # 1 tool — email campaign listing
579
+ │ ├── trigger-links.ts # 1 tool — trigger link listing
580
+ │ ├── workflow-builder.ts # 6 tools — full workflow CRUD (internal API)
581
+ │ ├── funnel-builder.ts # 9 tools — funnel/page builder (internal API)
582
+ │ ├── form-builder.ts # 5 tools — form builder (internal API)
583
+ │ ├── pipeline-builder.ts # 5 tools — pipeline/stage builder (internal API)
584
+ │ ├── bulk-operations.ts # 5 tools — batch contact operations
585
+ │ ├── account-export.ts # 2 tools — backup & location comparison
586
+ │ ├── workflow-cloner.ts # 1 tool — deep workflow cloning
587
+ │ ├── location-switcher.ts # 6 tools — multi-location support + token registry
588
+ │ └── template-deployer.ts # 3 tools — deploy sub-account from template (Zod-validated)
589
+ ├── templates/
590
+ │ ├── clinic-medspa.json # Clinic/Med Spa blueprint
591
+ │ └── action-schemas.json # Mandatory workflow action attribute schemas
592
+ ├── dist/ # Compiled JavaScript (generated by build)
593
+ ├── setup.sh # One-command install + setup wizard
594
+ ├── setup-wizard.mjs # Interactive setup wizard (@clack/prompts)
595
+ ├── start-mcp.example.sh # Wrapper script template (copy to start-mcp.sh)
596
+ ├── package.json
597
+ ├── tsconfig.json
598
+ ├── CLAUDE.md # Claude Code project instructions
599
+ ├── CHANGELOG.md
600
+ ├── CONTRIBUTING.md # Contributor guide
601
+ ├── .gitignore
602
+ └── README.md
603
+ ```
604
+
605
+ ---
606
+
607
+ ## Known Limitations
608
+
609
+ These are GHL features the MCP server **does not currently support**. In most cases, the GHL API either doesn't expose these endpoints or the feature requires browser-level interaction.
610
+
611
+ | Area | What's Missing |
612
+ |---|---|
613
+ | **Contact deduplication** | No merge or dedup tool. `search_contacts` can find potential duplicates by name/email/phone, but merging must be done manually in the GHL UI. |
614
+ | **Account auditing** | No one-click "find what's broken" scanner. `export_account` dumps full sub-account data and `compare_locations` diffs two accounts — Claude can analyze the output to spot issues, but it's not a turnkey audit button. |
615
+ | **SMS/email templates** | No template CRUD. You can send messages and build email actions in workflows, but managing reusable message templates isn't supported. |
616
+ | **Payment gateway config** | Read-only access to orders, subscriptions, and transactions. No Stripe/payment gateway setup or configuration. |
617
+ | **Phone & call tracking** | No call tools. VoIP, call tracking, and phone number management are not available via the API. |
618
+ | **Memberships & communities** | Not supported. GHL's membership/community features don't have public API endpoints. |
619
+ | **Reporting & analytics** | No dashboard or reporting tools. Use `export_account` for raw data, but there are no built-in analytics queries. |
620
+ | **Trigger links** | List only — no create, update, or delete. |
621
+ | **Campaigns** | List only — no create, update, or delete. |
622
+ | **Courses** | List only — no create, update, or delete. |
623
+ | **Workflow builder auth** | Requires Firebase credentials extracted from browser DevTools. The refresh token may rotate, requiring re-extraction. |
624
+
625
+ > **Contributing:** If you'd like to help close any of these gaps, see [CONTRIBUTING.md](CONTRIBUTING.md).
626
+
627
+ ---
628
+
629
+ ## Security
630
+
631
+ This MCP server is safe to share via GitHub.
632
+
633
+ | Concern | How It's Handled |
634
+ |---|---|
635
+ | **API Keys** | Stored in environment variables or wrapper script only. Never in code, never committed. |
636
+ | **`.env` & `start-mcp.sh`** | Gitignored. Your credentials never touch version control. |
637
+ | **Multi-user** | Each user brings their own API key. Complete account isolation. |
638
+ | **Scope** | The server only talks to GHL's API. No filesystem access, no shell commands, no network access beyond GHL. |
639
+ | **Permissions** | Controlled by your GHL Private Integration scopes. Disable what you don't need. |
640
+
641
+ ---
642
+
643
+ ## Reliability & Type Safety
644
+
645
+ This server has been through a rigorous, multi-pass audit for production reliability (v2.4.0–v2.7.0). Here's what's in place:
646
+
647
+ | Layer | What It Does |
648
+ |---|---|
649
+ | **Retry with backoff** | Both HTTP clients automatically retry on 429 rate limits, 5xx server errors, and transient network failures (ECONNRESET, ETIMEDOUT). 3 retries with exponential backoff. Respects `Retry-After` headers. |
650
+ | **Clear error messages** | Timeouts show `"Request timeout (30s): GET /path"` instead of cryptic abort errors. API errors include status code, method, path, and response body. |
651
+ | **Zod-validated responses** | Critical API paths (contacts, pipelines, calendars, workflows) validate response structure at runtime with Zod schemas. Malformed responses throw immediately with clear errors instead of silently passing garbage. |
652
+ | **Zod-validated config** | Token registry (`.ghl-tokens.json`) and template files are validated against Zod schemas on load. Corrupted files are backed up and reported, not silently accepted. |
653
+ | **Pre-flight workflow validation** | `validateActionChain()` checks action attributes before sending to GHL — catches missing `body` on SMS, missing `subject`/`html` on email, missing `pipelineId`/`stageId` on create_opportunity, and more. Prevents GHL's silent failure mode where bad actions kill all subsequent steps. |
654
+ | **Delete confirmation** | 10 high-risk destructive operations (delete_contact, delete_workflow, delete_pipeline, delete_funnel, etc.) require `confirm: "DELETE"` parameter. Prevents accidental deletion. |
655
+ | **Thread-safe token refresh** | Firebase token refresh uses a promise-based lock — concurrent requests share one refresh instead of racing. Failed refresh clears the cache immediately instead of leaving a stale token for 55 minutes. |
656
+ | **Startup validation** | Server validates the API key at startup (non-blocking) and logs a clear warning if it's invalid. |
657
+ | **Type-safe registration** | Tool modules are registered via a typed array — the compiler catches missing registrations. |
658
+ | **Honest types** | HTTP client methods return `Promise<unknown>`, not `Promise<T>`. No `as T` casts on JSON.parse. The type system never lies about response shapes. |
659
+
660
+ ---
661
+
662
+ ## Access & Collaboration
663
+
664
+ This is a **private repository**. Access is by invitation only, controlled by Elite DCs, LLC.
665
+
666
+ ### For the Repo Owner (granting access)
667
+
668
+ 1. Get the person's **GitHub username** (they need a free GitHub account at [github.com](https://github.com))
669
+ 2. Go to [github.com/drjerryrelth/ghl-command-mcp/settings/access](https://github.com/drjerryrelth/ghl-command-mcp/settings/access)
670
+ 3. Click **Add people**
671
+ 4. Enter their GitHub username or email
672
+ 5. Set role:
673
+ - **Read** — for customers (can pull updates, cannot push)
674
+ - **Write** — for contributors (can push branches and open PRs)
675
+ 6. Click **Add** — they'll receive an email invitation
676
+
677
+ > **Security:** Customers get **Read-only** access. Contributors get **Write** access to push branches and open PRs, but should never push directly to `main`. Use branch protection rules to enforce this.
678
+
679
+ ### For Contributors (first-time setup)
680
+
681
+ **Step 1:** Accept the GitHub invitation from `drjerryrelth` (check your email).
682
+
683
+ **Step 2:** Follow **Path 2 (Manual Install)** in the Quick Start section above. You'll need your own GHL API key.
684
+
685
+ **Step 3:** Read **[CONTRIBUTING.md](CONTRIBUTING.md)** for branching conventions, how to add tools, and PR guidelines.
686
+
687
+ **Step 4:** Create a branch, make your changes, and open a PR against `main`.
688
+
689
+ ### For Customers / Invited Users (first-time setup)
690
+
691
+ **Step 1:** Accept the GitHub invitation from `drjerryrelth` (check your email).
692
+
693
+ **Step 2:** Follow **Path 1 (Easy Install)** or **Path 2 (Manual Install)** in the Quick Start section above. You'll need your own GHL API key — each user connects to their own GHL account.
694
+
695
+ **Step 3:** Restart Claude Code and test with `"List my contacts"`
696
+
697
+ > **Note:** You have read-only access. You can clone and pull updates, but cannot push changes to the repository.
698
+
699
+ ### Staying Up to Date
700
+
701
+ ```bash
702
+ cd ghl-command-mcp
703
+ git pull
704
+ npm run build
705
+ ```
706
+
707
+ Then restart Claude Code. Your settings and API key stay the same.
708
+
709
+ ---
710
+
711
+ ## Environment Variables
712
+
713
+ | Variable | Required | Description |
714
+ |---|---|---|
715
+ | `GHL_API_KEY` | Yes | Your GHL Private Integration API key. **Must be created inside the sub-account you're connecting to** (not at the agency level). Can only be copied once at creation. |
716
+ | `GHL_LOCATION_ID` | No | Default sub-account ID. **Must match the sub-account where you created the API key.** Saves you from passing it with every tool call. |
717
+ | `GHL_USER_ID` | No* | Your GHL user ID. Required for workflow builder tools. |
718
+ | `GHL_FIREBASE_API_KEY` | No* | Firebase API key from GHL's auth system. Required for workflow builder tools. |
719
+ | `GHL_FIREBASE_REFRESH_TOKEN` | No* | Firebase refresh token. Required for workflow builder tools. May rotate periodically. |
720
+
721
+ *Required only for the workflow builder (internal API) tools. The standard API tools work without these.
722
+
723
+ ---
724
+
725
+ ## Troubleshooting
726
+
727
+ | Error | Cause | Fix |
728
+ |---|---|---|
729
+ | MCP tools don't appear (CLI) | Server not registered | Run `claude mcp add --scope user -t stdio ghl /path/to/start-mcp.sh` |
730
+ | MCP tools don't appear (CLI) | Wrong config file | Must be in `~/.claude.json` (via `claude mcp add`), NOT `~/.claude/mcp.json` |
731
+ | MCP tools don't appear (Desktop App) | Config missing or wrong | Check `~/Library/Application Support/Claude/claude_desktop_config.json` has a `ghl` entry under `mcpServers` |
732
+ | MCP tools don't appear (Desktop App) | App not restarted | Quit the Claude app completely (Cmd+Q on Mac) and reopen it |
733
+ | MCP tools don't appear (Desktop App) | Wrong node path | Make sure `"command": "node"` works in your terminal. If not, use the full path (e.g., `/usr/local/bin/node`) |
734
+ | `GHL_API_KEY environment variable is required` | Missing API key | Set it in `start-mcp.sh` or `.env` file |
735
+ | `locationId is required` | Tool needs a location ID | Set `GHL_LOCATION_ID` in your env, or tell Claude which location to use |
736
+ | `GHL API Error 401` | Invalid or expired key | Generate a new API key in GHL > Settings > Integrations |
737
+ | `GHL API Error 403` | Key from wrong sub-account | Create a new Private Integration **inside the correct sub-account** |
738
+ | `GHL API Error 403` (alt) | Missing permission scope | Edit your Private Integration in GHL and enable the required scope |
739
+ | `GHL API Error 422` | Invalid request data | Check the error message for which field is wrong |
740
+ | `GHL API Error 429` | Rate limited | Wait a moment and retry |
741
+
742
+ ---
743
+
744
+ ## About
745
+
746
+ Built by **[Elite DCs, LLC](https://elitedcs.com)** — a digital marketing and automation agency specializing in GoHighLevel implementations for healthcare practices and local businesses.
747
+
748
+ **Tech stack:** TypeScript, Node.js, esbuild, MCP SDK, Zod, GHL API v2, Firebase Auth
749
+
750
+ **Version:** 2.3.0
751
+
752
+ ---
753
+
754
+ ## License
755
+
756
+ MIT License — see [LICENSE](LICENSE) for full text.
757
+
758
+ Copyright (c) 2026 Elite DCs, LLC. All rights reserved.