HubSpot MCP Server

by SheffieldP
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables interaction with HubSpot CRM data, providing tools for managing contacts and companies, creating new entries with duplicate checking, and accessing recent engagement history from the CRM.

HubSpot MCP 服务器

概述

模型上下文协议 (MCP) 服务器实现,提供与 HubSpot CRM 的集成。该服务器使 AI 模型能够通过标准化接口与 HubSpot 数据和操作进行交互。

有关模型上下文协议及其工作原理的更多信息,请参阅Anthropic 的 MCP 文档

成分

资源

服务器公开以下资源:

  • hubspot://hubspot_contacts :提供访问 HubSpot 联系人的动态资源
  • hubspot://hubspot_companies :提供访问 HubSpot 公司的动态资源
  • hubspot://hubspot_recent_engagements :提供过去 3 天 HubSpot 互动情况的动态资源

所有资源都会自动更新,因为各自的对象在 HubSpot 中被修改。

示例提示

  • 通过从 LinkedIn 个人资料网页复制来创建 Hubspot 联系人:
    Create HubSpot contacts and companies from following: John Doe Software Engineer at Tech Corp San Francisco Bay Area • 500+ connections Experience Tech Corp Software Engineer Jan 2020 - Present · 4 yrs San Francisco, California Previous Company Inc. Senior Developer 2018 - 2020 · 2 yrs Education University of California, Berkeley Computer Science, BS 2014 - 2018
  • 获取贵公司的最新活动:
    What's happening latestly with my pipeline?

工具

该服务器提供了几种用于管理 HubSpot 对象的工具:

联系人管理工具

  • hubspot_get_contacts
    • 从 HubSpot 检索联系人
    • 无需输入
    • 返回:联系人对象数组
  • hubspot_create_contact
    • 在 HubSpot 中创建新联系人(创建前检查重复项)
    • 输入:
      • firstname (字符串):联系人的名字
      • lastname (字符串):联系人的姓氏
      • email (字符串,可选):联系人的电子邮件地址
      • properties (dict,可选):附加联系人属性
        • 例如: {"phone": "123456789", "company": "HubSpot"}
    • 行为:
      • 检查是否存在具有相同名字和姓氏的现有联系人
      • 如果属性中提供了company ,还会检查是否与同一家公司匹配
      • 如果找到匹配项,则返回现有联系人详细信息
      • 仅当未找到匹配项时才创建新联系人

公司管理工具

  • hubspot_get_companies
    • 从 HubSpot 检索公司
    • 无需输入
    • 返回:公司对象数组
  • hubspot_create_company
    • 在 HubSpot 中创建新公司(创建前检查重复项)
    • 输入:
      • name (字符串):公司名称
      • properties (字典,可选):其他公司属性
        • 例如: {"domain": "example.com", "industry": "Technology"}
    • 行为:
      • 检查是否存在同名的公司
      • 如果找到匹配项,则返回现有公司详细信息
      • 仅当未找到匹配项时才创建新公司
  • hubspot_get_company_activity
    • 获取特定公司的活动历史记录
    • 输入:
      • company_id (字符串):HubSpot 公司 ID
    • 返回:活动对象数组

参与工具

  • hubspot_get_recent_engagements
    • 获取过去 3 天内所有公司和联系人的 HubSpot 互动情况
    • 无需输入
    • 返回:具有完整元数据的参与对象数组

多用户支持

此 MCP 服务器旨在支持多个 HubSpot 用户,每个用户都有各自的访问令牌。服务器不使用全局环境变量来存储访问令牌。

相反,每个对 MCP 服务器的请求都应通过以下方式之一包含用户的特定访问令牌:

  1. 在请求标头中: X-HubSpot-Access-Token: your-token-here
  2. 在请求正文中作为accessToken{"accessToken": "your-token-here"}
  3. 在请求正文中作为hubspotAccessToken{"hubspotAccessToken": "your-token-here"}

这种设计允许您将用户令牌存储在您自己的后端(例如,Supabase)并将它们与每个请求一起传递。

多用户集成示例

// Example of how to use this MCP server in a multi-user setup async function makeHubSpotRequest(userId, action, params) { // Retrieve the user's HubSpot token from your database const userToken = await getUserHubSpotToken(userId); // Make request to MCP server with the user's token const response = await fetch('https://your-mcp-server.vercel.app/', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-HubSpot-Access-Token': userToken }, body: JSON.stringify({ action, ...params }) }); return await response.json(); }

设置

先决条件

您需要为每个用户获取一个 HubSpot 访问令牌。您可以通过以下方式获取:

  1. 在您的 HubSpot 帐户中创建私人应用程序:按照HubSpot 私人应用程序指南操作
    • 转到您的 HubSpot 帐户设置
    • 导航至“集成”>“私有应用”
    • 点击“创建私人应用”
    • 填写基本信息:
      • 命名您的应用
      • 添加描述
      • 上传徽标(可选)
    • 定义所需范围:
      • oauth(必需)
    • 可选范围:
      • crm.dealsplits.read_write
      • crm.objects.companies.read
      • crm.objects.companies.write
      • crm.objects.contacts.读取
      • crm.objects.contacts.write
      • crm.objects.deals.读取
    • 查看并创建应用程序
    • 复制生成的访问令牌

注意:请确保您的访问令牌安全,切勿将其提交到版本控制中。

Docker 安装

您可以在本地构建镜像,也可以从 Docker Hub 拉取。该镜像是为 Linux 平台构建的。

支持的平台

  • Linux/amd64
  • Linux/arm64
  • Linux/arm/v7

选项 1:从 Docker Hub 拉取

docker pull buryhuang/mcp-hubspot:latest

选项 2:本地构建

docker build -t mcp-hubspot .

运行容器:

docker run \ buryhuang/mcp-hubspot:latest

跨平台发布

要为多个平台发布 Docker 镜像,可以使用docker buildx命令。请按以下步骤操作:

  1. 创建一个新的构建器实例(如果还没有):
    docker buildx create --use
  2. 为多个平台构建并推送图像
    docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t buryhuang/mcp-hubspot:latest --push .
  3. 验证该图像是否适用于指定的平台
    docker buildx imagetools inspect buryhuang/mcp-hubspot:latest

与 Claude Desktop 一起使用

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 mcp-hubspot:

npx -y @smithery/cli@latest install mcp-hubspot --client claude

Docker 使用

{ "mcpServers": { "hubspot": { "command": "docker", "args": [ "run", "-i", "--rm", "buryhuang/mcp-hubspot:latest" ] } } }

发展

设置开发环境:

pip install -e .

执照

该项目已获得 MIT 许可。

-
security - not tested
A
license - permissive license
-
quality - not tested

该服务器使 AI 模型能够通过标准化界面与 HubSpot CRM 数据和操作进行交互,并通过基于多用户令牌的身份验证支持联系人和公司管理。

  1. Overview
    1. Components
      1. Resources
      2. Example Prompts
      3. Tools
    2. Multi-User Support
      1. Example Multi-User Integration
    3. Setup
      1. Prerequisites
      2. Docker Installation
    4. Cross-Platform Publishing
      1. Usage with Claude Desktop
        1. Installing via Smithery
        2. Docker Usage
      2. Development
        1. License
          ID: gl8jk9u4nb