Housecall Pro API管理工具

一个用于管理和操作Housecall Pro API的终端CLI和Claude Code插件,支持客户管理、预约调度、发票跟踪等功能。

  • by ToDucThanh
  • TypeScript
  • 本地部署
  • 9 星标
  • 更新于
在 GitHub 查看 ToDucThanh/housecallpro-mcp

使用说明

Housecall Pro MCP

终端CLI和Claude Code插件 Housecall Pro 公共API。 管理客户、预订工作、创建估算、跟踪发票、处理潜在客户等,所有这些都可以通过自然语言完成。


需求

  • Housecall Pro MAX计划 账户
  • Housecall Pro API密钥或OAuth凭据(如何获得一个)

安装

有两种方法可以使用此工具。选择一个适合您工作流程的。


选项A--hcpro终端CLI

一个独立的终端工具。一个curl命令即可安装所有内容,无需手动配置。

要求: 克劳德代码 已安装-- 仅限macOS和Linux (不支持Windows)

1.安装

curl -fsSL https://raw.githubusercontent.com/ToDucThanh/housecallpro-mcp/feature/cli/install.sh | sh

如果 ~/.local/bin 不在你的 $PATH,安装程序将打印命令以添加它。

要固定到特定版本,请执行以下操作:

HCPRO_VERSION=v0.2.0 curl -fsSL https://raw.githubusercontent.com/ToDucThanh/housecallpro-mcp/feature/cli/install.sh | sh

2.连接Housecall Pro

hcpro auth login

在系统提示时选择您的身份验证方法:

  • API密钥 (推荐) -粘贴Housecall Pro API密钥
  • OAuth 2.0 (高级) --输入您的客户ID和密码;打开浏览器窗口进行授权

建议大多数用户使用API密钥。 OAuth 2.0需要注册 http://localhost:7891/callback 在运行此命令之前,将其作为HCP开发人员仪表板应用程序设置中允许的重定向URI。如果跳过该步骤,则授权将失败。

API访问需要 MAX计划.如果你遇到403错误,请检查你的计划。

3.连接克劳德

hcpro auth claude login

在提示时选择您的Claude身份验证方法:

  • API密钥 -粘贴您的Anthropic API密钥(按代币计费)
  • 订阅 --通过Claude Code使用您现有的Claude.ai Pro/Max订阅

即使您已经登录到Claude Code,此步骤也是必需的。这不是重新身份验证,它只是注册了哪种身份验证方法 hcpro 应该使用。选择 订阅 如果您已经登录,将立即生效。

4.开始使用它

一次性查询:

hcpro "list my jobs today"
hcpro "find customer John Smith"
hcpro "show all open invoices"

互动环节:

hcpro chat

检查身份验证状态

hcpro auth status

删除凭据

hcpro auth logout          # remove HCP credentials
hcpro auth claude logout   # remove Claude credentials from hcpro (does not sign out of Claude Code itself)

更新hcpro

重新运行安装脚本——它将替换现有的二进制文件:

curl -fsSL https://raw.githubusercontent.com/ToDucThanh/housecallpro-mcp/feature/cli/install.sh | sh

卸载hcpro

rm -rf ~/.local/lib/hcpro ~/.local/bin/hcpro

获取帮助

hcpro --help
hcpro auth --help
hcpro auth claude --help

选项B——克劳德代码插件

适用于喜欢完全在Claude Code内工作的用户。

要求: 克劳德代码 已安装,Node.js 20+

第一步——注册市场

/plugin marketplace add toducthanh/housecallpro-mcp

若要仅适用于当前项目,请添加 --scope local。要与所有回购合作者共享,请添加 --scope project.

步骤2——安装并配置插件

跑 /plugin → 打开 市场 tab → 选择 toducthanh → 浏览插件 → find housecallpro-mcp → 安装它。

安装后,转到 已安装 tab → 选择 housecallpro-mcp → 配置选项 并输入您的凭据:

API密钥验证 (推荐):

选项 值
身份验证方法 apikey
Housecall Pro API密钥 您的API密钥

OAuth 2.0 (高级):

选项 值
身份验证方法 oauth
Housecall Pro客户端ID 您的OAuth客户端ID
Housecall Pro客户端密码 您的OAuth客户端密码
Housecall Pro OAuth令牌 您的OAuth访问令牌

该插件的OAuth要求您手动获取访问令牌(例如,从HCP开发人员仪表板)。没有自动刷新令牌的功能——当令牌到期时,您需要在“配置”选项中手动更新它。 建议使用API密钥。

您还可以通过CLI安装(默认情况下为用户范围):

/plugin install housecallpro-mcp@toducthanh

然后通过配置凭据 /plugin → 已安装选项卡→ 配置选项。

跑 /reload-plugins 激活插件。

验证它是否正常工作

在Claude Code内部运行:

/skills    ← should list housecallpro
/mcp       ← should show housecallpro connected

然后尝试现场测试:

Use the housecallpro MCP to get my company information

获取API密钥

  1. 登录您的Housecall Pro帐户
  2. 首选 应用商店 → API密钥管理 → 生成
  3. 复制密钥并确保其安全

API访问需要 MAX计划.如果你遇到403错误,请检查你的计划。


用法--示例提示

客户

List my first 10 customers
Find customer named "John Smith"
Create a customer Jane Doe with email jane@example.com and mobile +1 555 123 4567
Get all addresses for customer {customer_id}
Fetch all customers with fetch_all true and tell me the total count

预订和日程安排

Book a job for customer {customer_id} at address {address_id} on 2025-05-01 at 9am for 1 hour
Find customer John Smith, get his address, create a job and schedule it for next Monday 9am
Reschedule job {job_id} to 2025-05-10 at 2pm and notify the customer
Dispatch job {job_id} to employee {employee_id}
List all scheduled jobs for this week
List all unscheduled jobs
Get available booking windows for the next 7 days

估算和发票

Create an estimate for customer {customer_id} at address {address_id}
Add an option "Standard Package" with a labor line item to estimate {estimate_id}
Approve estimate option {option_id}
List all open invoices
Get all invoices for job {job_id}
List invoices created between 2025-01-01 and 2025-03-31

潜在客户

Create a lead for customer {customer_id}
List all open leads
Convert lead {lead_id} to a job

报告和批量

Fetch all completed jobs with fetch_all true for Q1 2025
Fetch all customers with fetch_all true and count how many have no address
List all employees
Get company information

工作流程指南

为现有客户预订工作

AI将自动链接这些步骤:

  1. list_customers → 查找customer_id
  2. list_customer_addresses → 查找地址_id
  3. create_job → 创建作业
  4. update_job_schedule → 安排它
  5. dispatch_job → 指派一名技术人员(可选)

示例提示:

Find customer John Smith, get his first address, create a job there
scheduled for 2025-05-01 9am-10am with 60 min arrival window,
notify the customer, and dispatch to employee Mike Johnson

为一位新客户预订工作

Create a new customer Sarah Connor, phone +1 555 999 0000,
add her address 123 Main St Austin TX 78701,
then book a job there for 2025-05-02 at 2pm for 2 hours

使用选项创建估算

估算采用两级结构-- 首先是选项,然后是每个选项内的行项目.

Create an estimate for customer {customer_id} at address {address_id},
add an option called "Standard Package" with a labor line item at $150,
then approve it

导致工作转换

Create a lead for customer {customer_id},
show me the pipeline statuses,
move it to the next status,
then convert it to a job and schedule it for next Monday at 10am

字段格式

字段 有效格式 无效
日期 "2025-05-01T09:00:00" "05/01/2025", "next Monday"
电话 "+1 555 123 4567" "555-PLUMBER"
工作状态 "scheduled", "completed" 等等 "done", "pending"
货币 整数分-- $150 = 15000 150.00
IDs 非空字符串 "" (空)

有效的工作状态值: unscheduled · scheduled · in_progress · completed · canceled


获取所有页面

支持多种列表工具 fetch_all: true 要自动检索所有页面,请执行以下操作:

Fetch all customers with fetch_all true
Fetch all completed jobs with fetch_all true from 2025-01-01 to 2025-03-31

支持: list_customers, list_jobs, list_estimates, list_leads, list_invoices, list_employees, list_events, list_tags, list_materials, list_pricebook_services

默认限制为20页(约200条记录)。使用显式 page + page_size 对于更大的数据集。


错误参考

错误 原因 修复
HCP API Error (401) API密钥错误或丢失 检查 HOUSECALL_API_KEY
HCP API Error (403) 不在MAX计划中 升级计划或检查 HOUSECALL_AUTH_METHOD
HCP API Error (404) ID错误或端点不可用 仔细检查ID
HCP API Error (422) 缺少必填字段 检查必填参数
HCP API Error (429) 速率受限 服务器自动重试--等待并重试
Must be ISO 8601 format 日期格式错误 使用 "2025-05-01T09:00:00"
Must be a valid phone number 无效电话 使用 "+1 555 123 4567"
ID cannot be empty ID为空字符串 请先获取正确的ID
/skills 未显示任何内容 插件未加载 重新运行步骤1和2,然后 /reload-plugins
/mcp 未显示housecallpro MCP未启动 转到 /plugin → 已安装→ 配置选项并验证凭据
HCP credentials not configured hcpro auth login 不运行 运行 hcpro auth login
Claude credentials not configured hcpro auth claude login 不运行 运行 hcpro auth claude login
claude binary not found 未安装Claude代码 从安装 claude.ai/code

已知限制

  • 管道 仅向前移动——您不能设置较低的订单状态
  • 可用性/预订时段端点 --使用 get_booking_windows 对于可用插槽
  • 估计 使用选项→ 行项目(不像作业那样直接)
  • 材料 需要 material_category_uuid --呼叫 list_material_categories 第一
  • 支付处理 -无法通过公共API获得,请使用HCP仪表板
  • fetch_all 默认情况下限制为20页
  • 费率限制 --HCP未发布;服务器通过回退自动重试最多3次

工具概述

所有Housecall Pro API资源中的70多个工具:

资源 工具
客户 列表、获取、创建、更新、地址
作业 列表、获取、创建、计划、调度、行项目、笔记、标签、锁、发票
估算 列出、获取、创建、选项、行项目、批准
发票 列表、获取、预览
潜在客户 列表、获取、创建、转换、行项目
员工列表
标签 列表、创建、更新、删除
事件列表,获取
材料 列表、创建、更新、删除
价目表 服务、价格表
管道 状态、更新状态
路线 列表
公司 获取、日程安排窗口、预订窗口
Webhooks 订阅、取消订阅
应用程序 获取、启用、禁用

发展

git clone https://github.com/toducthanh/housecallpro-mcp
cd housecallpro-mcp
npm install
npm run generate-types   # generate types from housecall_v1.yaml
npm run build
npm run dev

快速迭代: 仅加载当前会话的插件,无需安装:

claude --plugin-dir .

使用 /reload-plugins 在会话内部,无需重新启动即可获取更改。

CLI开发

cd cli
bun install
bun test                  # run all tests
bun run dev               # run CLI in dev mode (no build needed)

在开发模式下运行命令:

bun run src/index.ts auth status
bun run src/index.ts "list my jobs today"
bun run src/index.ts chat

在本地生成二进制文件:

bun run build:darwin-arm64   # macOS Apple Silicon
bun run build:darwin-x64     # macOS Intel
bun run build:linux-x64      # Linux x64
bun run build:linux-arm64    # Linux ARM

二进制文件输出到 ../dist/.

全安装流量测试:

# Register the local marketplace scoped to this project only
claude plugin marketplace add ./ --scope local

# Then in Claude Code: /plugin → Discover → install housecallpro-mcp → Configure options

测试后清理:

选项A——删除市场(也删除插件):

claude plugin marketplace remove toducthanh --scope local

选项B——先卸载插件,然后删除市场:

# Via CLI
claude plugin uninstall housecallpro-mcp --scope local

# Or via UI: /plugin → Installed tab → select housecallpro-mcp → Uninstall

然后删除市场:

# Via CLI
claude plugin marketplace remove toducthanh --scope local

# Or via UI: /plugin → Marketplaces tab → select toducthanh → Remove

链接


许可证

根据 通用公共许可证v3.0.