内容
# GoHighLevel MCP Server
一个强大的 Model Context Protocol (MCP) server,用于 GoHighLevel API,提供管理联系人的工具。
## 安装
1. **克隆存储库:**
```sh
git clone https://github.com/CallBackCode/ghlMCP.git
cd ghlMCP
```
2. **安装依赖项:**
```sh
npm install
```
3. **设置您的 GoHighLevel API 密钥和位置 ID:**
- 在项目根目录中创建一个 `.env` 文件:
```sh
cat <<EOF > .env
# --- Required: Agency Token or Location Token and Location ID ---
GHL_API_KEY=your_api_key_here
GHL_LOCATION_ID=your_location_id_here
# --- Optional: Test Only Variables ---
GHL_TEST_BUSINESS_ID=your_business_id_here
GHL_TEST_CONTACT_ID=your_contact_id_here
EOF
```
````
4. **构建项目:**
```sh
npm run build
````
5. **运行 MCP server:**
```sh
npm start
```
6. **运行测试:**
```sh
npm test
```
## 环境变量
- `GHL_API_KEY` (required): 您的 GoHighLevel API 密钥
- `GHL_LOCATION_ID` (required): 您的 GoHighLevel 位置 ID
**Optional: Test Only**
- `GHL_TEST_BUSINESS_ID`: 用于基于 businessId 的联系人测试
- `GHL_TEST_CONTACT_ID`: 用于基于 contactId 的测试(如果需要)
## 可用的 MCP 接口 (工具)
<details>
<summary><strong>Contacts</strong></summary>
| Endpoint | Description | Required Params | Optional Params |
| ------------------------- | -------------------------------- | -------------------------- | ----------------------------------------- |
| `listContacts` | 列出所有联系人 | `locationId` | |
| `getContact` | 通过 ID 获取联系人 | `id`, `locationId` | |
| `createContact` | 创建新联系人 | `locationId` | `firstName`, `lastName`, `email`, `phone` |
| `updateContact` | 通过 ID 更新联系人 | `id`, `locationId` | `firstName`, `lastName`, `email`, `phone` |
| `deleteContact` | 通过 ID 删除联系人 | `id`, `locationId` | |
| `upsertContact` | 插入(创建/更新)联系人 | `locationId`, `email` | `firstName`, `lastName`, `phone` |
| `getContactsByBusinessId` | 通过 businessId 获取联系人 | `businessId`, `locationId` | `limit`, `skip`, `query` |
</details>
<!--
Add more <details> blocks for other edges (e.g., organizations, tasks) if/when implemented.
-->
## 项目结构
- `src/api/` — GoHighLevel 接口的 API 包装器
- `src/types/` — 集中式 TypeScript 类型
- `src/index.ts` — MCP server 入口点
- `test/` — 每个接口的 Jest 测试套件
## Notes
- 所有接口都需要有效的 GoHighLevel API 密钥和位置 ID。
- 响应以文本格式的格式化的 JSON 形式返回,以实现 LLM 兼容性。
- 有关更多详细信息,请参见 [GoHighLevel API Docs](https://github.com/GoHighLevel/highlevel-api-docs)。
---
Provided by CallBack