How mastanley13/gohighlevel-mcp works
1. What this repo is
This is a Node.js/TypeScript MCP server that exposes GoHighLevel sub-account APIs as AI-callable tools. The core architecture is an adapter layer: Claude Desktop or an HTTP MCP client talks to this server, and the server translates tool calls into GoHighLevel REST API requests.
2. Primary execution modes
There are two server entrypoints: src/server.ts for the CLI/stdio MCP mode used by Claude Desktop, and src/http-server.ts for HTTP-based MCP access. The api/index.js file exists as a deployment entrypoint for serverless platforms like Vercel. This means the same tool layer can be served over local stdio or HTTP without changing the domain logic.
3. Central data flow
The main flow is: MCP client → server entrypoint → tool registry/module → shared GoHighLevel API client → GoHighLevel API. Tool results flow back as MCP responses. The server itself is thin; most business behavior lives in domain-specific tool files, not in the transport layer.
4. GoHighLevel integration boundary
src/clients/ghl-api-client.ts is the integration boundary to the external system. It encapsulates authenticated HTTP calls to GoHighLevel, using environment-provided credentials and location context. This client is the only place that should know about base URLs, authorization headers, API version quirks, pagination, and error translation.
5. Tool layer by domain
The src/tools/ directory is the real application surface. Each file groups tools by GoHighLevel domain: contacts, conversations, calendar, opportunities, blog, email, location, media, custom objects, associations, custom fields, workflows, surveys, store, products, payments, and invoices. Architecturally, this is a vertical-slice design: each module owns a bounded capability set and exposes it as MCP tools.
6. MCP tool contract
Each tool module likely defines both the tool metadata/schema and the handler function. The handler validates inputs, calls the GHL client, and returns structured data suitable for MCP. Because the repo is explicitly a tool server, the tool schemas are part of the public API boundary and are as important as the HTTP endpoints.
7. Shared types
src/types/ghl-types.ts centralizes TypeScript models for GoHighLevel entities and responses. This reduces drift between tool modules and the API client, and it makes the tool surface more consistent. In architecture terms, the types layer is the contract bridge between raw API payloads and typed tool handlers.
8. Transport and hosting differences
The repo supports multiple deployment targets without changing application logic: local Node execution, containerized runtime via Dockerfile, serverless HTTP via vercel.json and api/index.js, and process-based hosting via Procfile/railway.json. Those files matter because they define how the server is launched, not what the domain logic does.
9. Configuration and security boundary
Runtime configuration is environment-driven via .env.example and README-described variables like GHL_API_KEY, GHL_LOCATION_ID, and GHL_BASE_URL. The system is designed around private integration credentials, so the main security boundary is credential handling and scope control, not user authentication inside the app.
10. Testing structure
tests/ mirrors the source layout: client tests validate the GoHighLevel integration boundary, tool tests validate domain behavior, and mocks isolate external API calls. This indicates the architecture is designed to be testable at both the client and tool layers, with the transport layer mostly smoke-tested.
11. Operational concerns
Because the server is a thin wrapper over an external SaaS API, rate limiting, request failure handling, and location-scoped access are important operational constraints. The README’s emphasis on retries, monitoring, and permissions reflects that the main failure modes are external API limits and credential/scoping mistakes rather than internal state corruption.
12. How to diagram it
A good architecture diagram should show three layers: the MCP transports on the left, the tool/domain layer in the middle, and the GoHighLevel API client plus external GHL service on the right. Underneath, show shared types/config as cross-cutting concerns, and tests/deployment files as supporting infrastructure rather than runtime subsystems.
Main entry points: tools Tool surface · ghl-api-client.ts GHL client · server.ts StdIO server · http-server.ts HTTP server
Components 21
Runtime
MCP entrypoints and deployment adapters
- StdIO server · Claude Desktop / stdio MCP host
src/server.ts - HTTP server · HTTP-based MCP host
src/http-server.ts - Serverless entry · Platform entry for serverless hosting
api/index.js
Tools
Domain-specific MCP tool modules
- Tool surface · Directory containing the MCP tool implementations
src/tools - Contacts · Contact-related MCP tools
src/tools/contact-tools.ts - Conversations · Conversation and messaging tools
src/tools/conversation-tools.ts - Calendar · Calendar and scheduling tools
src/tools/calendar-tools.ts - Opportunities · Pipeline and deal tools
src/tools/opportunity-tools.ts - Workflows · Automation and workflow tools
src/tools/workflow-tools.ts - Email · Email-related MCP tools
src/tools/email-tools.ts - Social media · Social media tools
src/tools/social-media-tools.ts - Store · Storefront and commerce tools
src/tools/store-tools.ts - Payments · Payment tools
src/tools/payments-tools.ts - Invoices · Invoice tools
src/tools/invoices-tools.ts
Core
Shared client and types
- GHL client · Authenticated GoHighLevel API boundary
src/clients/ghl-api-client.ts - GHL types · Typed models for GoHighLevel payloads
src/types/ghl-types.ts
Support
Config, deployment, and tests
- Config · Environment and deployment configuration
.env.example - Docker · Container runtime definition
Dockerfile - Vercel config · Serverless deployment settings
vercel.json - Client tests · Integration-boundary tests for the GHL client
tests/clients/ghl-api-client.test.ts - Tool tests · Domain tool behavior tests
tests/tools
Connections 29
- StdIO server → Tool surface: loads tools · StdIO host wires MCP tools into the runtime
- HTTP server → Tool surface: loads tools · HTTP host exposes the same tool surface
- Serverless entry → HTTP server: boots · Serverless entry delegates to the HTTP server
- Tool surface → Contacts: includes · Tool directory organizes contact tools
- Tool surface → Conversations: includes · Tool directory organizes conversation tools
- Tool surface → Calendar: includes · Tool directory organizes calendar tools
- Tool surface → Opportunities: includes · Tool directory organizes opportunity tools
- Tool surface → Workflows: includes · Tool directory organizes workflow tools
- Tool surface → Email: includes · Tool directory organizes email tools
- Tool surface → Social media: includes · Tool directory organizes social media tools
- Tool surface → Store: includes · Tool directory organizes store tools
- Tool surface → Payments: includes · Tool directory organizes payment tools
- Tool surface → Invoices: includes · Tool directory organizes invoice tools
- Contacts → GHL client: calls · Tool handlers translate requests into GHL API calls
- Conversations → GHL client: calls · Tool handlers translate requests into GHL API calls
- Calendar → GHL client: calls · Tool handlers translate requests into GHL API calls
- Opportunities → GHL client: calls · Tool handlers translate requests into GHL API calls
- Workflows → GHL client: calls · Tool handlers translate requests into GHL API calls
- Email → GHL client: calls · Tool handlers translate requests into GHL API calls
- Social media → GHL client: calls · Tool handlers translate requests into GHL API calls
- Store → GHL client: calls · Tool handlers translate requests into GHL API calls
- Payments → GHL client: calls · Tool handlers translate requests into GHL API calls
- Invoices → GHL client: calls · Tool handlers translate requests into GHL API calls
- GHL client → GHL types: uses · Shared models shape requests and responses
- Client tests → GHL client: verifies · Tests validate API client behavior
- Tool tests → Tool surface: verifies · Tests validate tool-layer behavior
- Docker → StdIO server: packages · Container runtime can host the Node process
- Vercel config → Serverless entry: deploys · Serverless config targets the API entrypoint
- Config → GHL client: configures · Environment variables feed auth and base URL settings