HubSpot MCP Server

HubSpot MCP Server

Enables AI assistants to interact with HubSpot CRM for managing contacts, companies, deals, and sending emails through natural language commands.

Category
访问服务器

README

HubSpot MCP Server

A Model Context Protocol (MCP) server that provides seamless integration with HubSpot CRM. This server enables AI assistants like Claude to interact with your HubSpot data, allowing for efficient management of contacts, companies, deals, and more.

🚀 Features

  • Contacts Management: Create, read, update, and search contacts in HubSpot
  • Companies Management: Manage company records and information
  • Deals Management: Track and update sales opportunities
  • Email Integration: Send emails and track engagement (requires setup)
  • Type-Safe: Built with TypeScript for better development experience
  • Comprehensive Testing: Includes unit tests and integration examples
  • Easy Setup: Simple configuration with environment variables

📋 Available Tools

Contacts

  • get_contacts - Retrieve a list of contacts
  • get_contact - Get a specific contact by ID
  • create_contact - Create a new contact
  • update_contact - Update an existing contact
  • search_contacts - Search for contacts

Companies

  • get_companies - Retrieve a list of companies
  • get_company - Get a specific company by ID
  • create_company - Create a new company
  • update_company - Update an existing company

Deals

  • get_deals - Retrieve a list of deals
  • get_deal - Get a specific deal by ID
  • create_deal - Create a new deal
  • update_deal - Update an existing deal

Emails

  • send_email - Send emails through HubSpot (requires Marketing Email API)
  • get_email_events - Get email engagement data (requires Events API)

🛠️ Prerequisites

  • Node.js 18+ and npm
  • HubSpot account with API access
  • HubSpot API key or OAuth credentials

📦 Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/hubspot-mcp-server.git
    cd hubspot-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Configure environment variables:

    cp .env.example .env
    

    Edit .env with your HubSpot credentials:

    HUBSPOT_API_KEY=your_hubspot_api_key_here
    # OR use OAuth (if you prefer)
    HUBSPOT_CLIENT_ID=your_client_id
    HUBSPOT_CLIENT_SECRET=your_client_secret
    HUBSPOT_ACCESS_TOKEN=your_access_token
    
  4. Build the project:

    npm run build
    

🔧 Getting HubSpot API Credentials

Option 1: API Key (Recommended for testing)

  1. Go to HubSpot Settings → Integrations → API key
  2. Generate a new API key
  3. Add it to your .env file as HUBSPOT_API_KEY

Option 2: OAuth App (Recommended for production)

  1. Go to HubSpot Developer Account → Apps
  2. Create a new app
  3. Note your Client ID and Client Secret
  4. Configure OAuth redirect URI
  5. Add credentials to your .env file

🚀 Usage

With Claude Desktop

  1. Configure Claude Desktop by adding to your MCP settings:

    {
      "mcpServers": {
        "hubspot": {
          "command": "node",
          "args": ["dist/index.js"],
          "cwd": "/path/to/hubspot-mcp-server",
          "env": {
            "HUBSPOT_API_KEY": "your_api_key_here"
          }
        }
      }
    }
    
  2. Restart Claude Desktop

  3. Start using HubSpot tools in Claude:

    • "Show me my recent contacts"
    • "Create a new contact for John Doe with email john@example.com"
    • "Search for companies in the technology industry"

Direct Usage

You can also run the server directly:

npm start

Or for development with auto-reload:

npm run dev

🧪 Testing

Run the test suite:

npm test

Run tests in watch mode:

npm run test:watch

Run a manual test of the server:

npm run dev
# In another terminal:
node tests/test-server.js

📖 Examples

Creating a Contact

// Using the MCP tool
{
  "tool": "create_contact",
  "arguments": {
    "email": "jane.doe@example.com",
    "firstname": "Jane",
    "lastname": "Doe",
    "phone": "+1-555-123-4567",
    "company": "Example Corp",
    "lifecyclestage": "lead"
  }
}

Searching for Companies

// This would be handled automatically by Claude when you ask:
// "Find all companies in the software industry"
{
  "tool": "get_companies",
  "arguments": {
    "limit": 20,
    "properties": ["name", "domain", "industry", "city", "state"]
  }
}

🏗️ Development

Project Structure

src/
├── index.ts              # Main MCP server
├── services/
│   └── hubspot.ts        # HubSpot API wrapper
├── tools/
│   ├── base.ts           # Base tool class
│   ├── contacts.ts       # Contact management tools
│   ├── companies.ts      # Company management tools
│   ├── deals.ts          # Deal management tools
│   └── emails.ts         # Email tools
└── types/
    └── index.ts          # Type definitions

tests/
├── setup.ts              # Test configuration
├── hubspot.service.test.ts
├── contacts.tool.test.ts
└── test-server.ts        # Manual testing script

Adding New Tools

  1. Create a new tool class extending BaseTool
  2. Implement getTools() and executeTool() methods
  3. Register the tool in src/index.ts
  4. Add tests for the new tool

Code Style

This project uses TypeScript with strict mode enabled. Make sure to:

  • Use proper type annotations
  • Follow existing naming conventions
  • Add JSDoc comments for public methods
  • Write tests for new functionality

🔒 Security Considerations

  • API Keys: Never commit API keys to version control
  • Environment Variables: Use .env files for local development
  • Production: Use proper secret management in production
  • Rate Limiting: Be aware of HubSpot API rate limits
  • Permissions: Only request necessary HubSpot scopes

📚 Resources

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🐛 Troubleshooting

Common Issues

"API key not found" error:

  • Ensure your .env file is properly configured
  • Check that the API key is valid and has necessary permissions

"Module not found" errors:

  • Run npm install to ensure all dependencies are installed
  • Run npm run build to compile TypeScript

Rate limiting errors:

  • HubSpot has API rate limits. Implement proper retry logic for production use
  • Consider using exponential backoff for failed requests

Connection timeouts:

  • Check your internet connection
  • Verify HubSpot service status

For more help, please open an issue.

🚀 Deployment

Production Considerations

  1. Environment Variables: Use a proper secrets management system
  2. Logging: Configure appropriate log levels
  3. Monitoring: Set up health checks and monitoring
  4. Scaling: Consider rate limiting and caching for high-volume usage

Docker Support (Coming Soon)

Docker support will be added in a future release for easier deployment.


Built with ❤️ for the HubSpot and AI community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选