Building Production-Ready CRM Integration for ChatGPT using Model Context Protocol
hubspot · Tech · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.5 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Enterprise CRM connector for ChatGPT Deep Research using remote MCP
HubSpot needed to expose CRM data and search tools to ChatGPT Deep Research for over 250,000 businesses without local setup, while preserving enterprise security, user-level permissions, horizontal scalability, automatic tool registration, and model-reliable query generation.
Constraints:
- The earlier local MCP server required manual Private App Access Tokens and local MCP-client configuration.
- HubSpot needed browser-based OAuth access instead of developer-only local setup.
- Existing public APIs were not originally designed to enforce granular user-level permissions.
- Remote MCP transport needed to fit Dropwizard Java services and auto-scaling infrastructure.
- SSE long-lived connections were undesirable because the use case focused on tool calls and load balancers frequently scale servers up or down.
- Hundreds of teams needed a self-service way to expose tools without gateway redeployments.
- The AI model needed a query syntax it could reliably generate from natural language.
Architecture
HubSpot built a homegrown remote MCP server in Java and Dropwizard. ChatGPT connects through a remote MCP endpoint, users authenticate through OAuth, and each HTTP request maps to a stateless ephemeral MCP session. CHIRP service discovery lets teams expose existing RPCs as MCP tools with @ChirpTool annotations. A dedicated mcp.hubspot.com gateway handles CRM search, associations, and property fetching with runtime intersection of app scopes and user permissions. A compact token-based query DSL gives the model predictable examples for CRM search while avoiding ambiguous features that would reduce reliability.
Diagram confidence: explicit (topology described by the source).
flowchart LR chatgpt-deep-research[ChatGPT Deep Research] --> remote-mcp-server[Remote MCP server] remote-mcp-server --> oauth-flow[OAuth flow] oauth-flow --> access-token-parser[Access token parser] access-token-parser --> user-permission-intersection[User permission intersection] remote-mcp-server --> streamable-http-transport[Streamable HTTP transport] streamable-http-transport --> ephemeral-mcp-session[Ephemeral MCP session] ephemeral-mcp-session --> mcp-java-sdk[MCP Java SDK] remote-mcp-server --> mcp-gateway[MCP Gateway] mcp-gateway --> chirp-service-discovery[CHIRP service discovery] chirp-service-discovery --> annotated-rpc-services[Annotated RPC services] annotated-rpc-services --> internal-crm-apis[Internal CRM APIs] remote-mcp-server --> crm-gateway-api[CRM gateway API] user-permission-intersection --> crm-gateway-api crm-gateway-api --> query-dsl-parser[Query DSL parser] query-dsl-parser --> crm-search-tool[CRM search tool] crm-search-tool --> internal-crm-apis user-permission-intersection --> internal-crm-apis internal-crm-apis --> hubspot-crm-records[HubSpot CRM records]
Components
| Component | Role | Interacts with |
|---|---|---|
ChatGPT Deep Research |
AI client that discovers and invokes HubSpot MCP tools for CRM deep research. | Remote MCP server |
Remote MCP server |
HubSpot-hosted MCP endpoint that exposes CRM tools to ChatGPT without local installation. | ChatGPT Deep Research, OAuth flow, Streamable HTTP transport, MCP Gateway, MCP Java SDK |
OAuth flow |
Trusted browser authentication flow that grants scoped, user-level access for the connector. | Remote MCP server, Access token parser, User permission intersection |
Access token parser |
Extracts client_id, hub_id, user_id, and scopes from OAuth access tokens. | OAuth flow, User permission intersection |
User permission intersection |
Computes the intersection of app permissions and user-specific permissions before forwarding calls to internal CRM APIs. | Access token parser, CRM gateway API, Internal CRM APIs |
Streamable HTTP transport |
Custom Dropwizard/JAX-RS transport that supports MCP over stateless HTTP without SSE long-lived sessions. | Remote MCP server, Ephemeral MCP session, MCP Java SDK |
Ephemeral MCP session |
Per-request MCP session created for a single HTTP call and bound to the HTTP response. | Streamable HTTP transport, MCP Java SDK |
MCP Java SDK |
Protocol implementation extended by HubSpot to support their Dropwizard backend and Streamable HTTP needs. | Remote MCP server, Streamable HTTP transport, Ephemeral MCP session |
MCP Gateway |
Service that discovers CHIRP-annotated tools, converts RPCs to MCP spec-compliant tools, and registers them with the SDK. | Remote MCP server, CHIRP service discovery, Annotated RPC services |
CHIRP service discovery |
HubSpot internal RPC discovery layer used to find services deployed with @ChirpTool annotations. | MCP Gateway, Annotated RPC services |
Annotated RPC services |
Internal HubSpot microservices whose RPC methods are marked as AI-ready MCP tools. | CHIRP service discovery, MCP Gateway, Internal CRM APIs |
CRM gateway API |
Dedicated mcp.hubspot.com API for CRM search, associations, and property fetching with MCP-specific user-permission enforcement. | Remote MCP server, User permission intersection, Query DSL parser, Internal CRM APIs |
Query DSL parser |
Parses compact key[:operator]:value query strings generated by the AI model into CRM search operations. | CRM gateway API, CRM search tool |
CRM search tool |
MCP search tool that supports object searches, filters, associations, pagination, and sorting through the query DSL. | Query DSL parser, Internal CRM APIs |
Internal CRM APIs |
HubSpot internal services that enforce CRM record, team, unassigned-record, and field-level access restrictions. | User permission intersection, Annotated RPC services, CRM search tool, HubSpot CRM records |
HubSpot CRM records |
Contacts, companies, tickets, deals, associations, and properties queried by the Deep Research Connector. | Internal CRM APIs |
Data flow
A HubSpot customer connects ChatGPT to HubSpot through OAuth. ChatGPT calls the remote MCP server over Streamable HTTP. HubSpot creates an ephemeral MCP session for the HTTP request, discovers available tools through the MCP Gateway and CHIRP annotations, parses model-generated CRM search queries through the token DSL, intersects app scopes with the user's CRM permissions, forwards the constrained request to internal CRM APIs, and returns the result through the MCP response.
4 supporting quotes
Why this architecture
HubSpot built the connector in-house because remote MCP needed to inherit existing CI/CD, auto-scaling, observability, region-aware routing, Java/Dropwizard stack, OAuth model, and permission semantics. Stateless Streamable HTTP matched tool-call workloads and scaling constraints better than SSE. CHIRP-based discovery let hundreds of teams publish tools without central bottlenecks, while a constrained DSL made AI-generated CRM queries reliable.
4 supporting quotes
Models used: ChatGPT Deep Research · Model Context Protocol · MCP Java SDK · Dropwizard · CHIRP · Cloudflare Workers · OAuth
Scale
- The connector targets more than 250,000 businesses.“democratizes access to AI for more than 250,000 businesses”article, stated
- HubSpot built the homegrown MCP server infrastructure in a matter of weeks.“built a completely homegrown MCP Server infrastructure in a matter of weeks”article, stated
- The service discovery model is intended for hundreds of HubSpot teams.“hundreds of teams can now make their products AI-ready just by adding @ChirpTool to their existing RPC methods.”article, stated
- HubSpot's public API estate includes thousands of APIs owned by hundreds of teams.“HubSpot has thousands of public APIs that hundreds of teams at HubSpot contribute to”article, stated
- The initial Deep Research Connector supports contacts, companies, tickets, and deals.“we support contacts, companies, tickets, and deals in our Deep Research Connector.”article, stated
- Runtime permission computation adds a few dozen milliseconds.“our public APIs on our MCP server can be a few dozen milliseconds slower due to computing user and account permissions at runtime.”article, stated
- The DSL supports pagination with limit 100 and offset 20 as an example.“pagination (
limit:100 offset:20), and sorting (sort:lastmodifieddate:desc).”article, stated
Alternatives considered (roads not taken)
Keep the local MCP server model
Rejected because: Local setup required Private App Access Tokens and MCP-client configuration, limiting adoption to technical developers.
3 supporting quotes
Buy a turnkey remote MCP solution
Rejected because: HubSpot wanted direct integration with its own CI/CD, scaling, observability, routing, OAuth scopes, and permission model.
3 supporting quotes
Use SSE long-lived connections
Rejected because: The connector focused on tool calls, and long-lived connections complicate load balancing and autoscaling.
3 supporting quotes
Overhaul all public APIs for user-level permissions at once
Rejected because: A broad change would be enormous and potentially breaking for many existing integrations.
3 supporting quotes
Expose a fully flexible query language
Rejected because: The AI model generates more reliable queries when the syntax is predictable, example-rich, and constrained.
Patterns
tool-use-orchestration (agent-control)
HubSpot exposes CRM search and internal RPCs as MCP tools that ChatGPT can discover and invoke automatically through the remote MCP server.
3 supporting quotes
privacy-preserving-processing (security)
The connector intersects app scopes with user-specific permissions so ChatGPT cannot query CRM data beyond what the connected user could access in HubSpot.
3 supporting quotes
safety-policy-enforcement (security)
HubSpot omits write and sensitive-property scopes from the Deep Research Connector and forwards only constrained user permissions to internal APIs.
structured-output-contract (tool-interface)
HubSpot designs a token-based DSL with key[:operator]:value tokens, examples, and helpful errors so AI models can generate valid CRM searches.
3 supporting quotes
key[:operator]:value pattern.”article, statedlatency-optimization (production-operations)
HubSpot uses stateless HTTP and ephemeral sessions for tool-call workloads, accepting only a few dozen milliseconds of permission-overhead where security requires it.
3 supporting quotes
observability-tracing (production-operations)
HubSpot chose in-house hosting partly to reuse enterprise observability, CI/CD, autoscaling, and region-aware routing for the MCP server.
guardrails-io-filtering (governance)
HubSpot plans governance around distributed tool registration so hundreds of teams can expose tools without fragmenting the customer-facing interface.
Tradeoffs
Build the MCP server in-house
Chose HubSpot Java/Dropwizard infrastructure over A turnkey third-party MCP solution.
Rationale: In-house hosting preserved direct control over OAuth, permissions, CI/CD, autoscaling, observability, and routing at the cost of more engineering work.
3 supporting quotes
Use stateless HTTP transport
Chose Streamable HTTP with ephemeral sessions over SSE long-lived sessions.
Rationale: The connector only needed tool calls, and stateless requests fit HubSpot's load balancing and autoscaling constraints.
3 supporting quotes
Phase user-level permissions
Chose Dedicated MCP gateway API for CRM data over Immediate user-permission enforcement across all public APIs.
Rationale: The gateway enabled secure ChatGPT access without breaking existing API integrations or coordinating a massive platform migration.
Pay runtime permission overhead
Chose Precise app/user/account permission intersection over Faster but coarser access checks.
Rationale: The AI agent can generate nondeterministic CRM queries, so security precision was worth a few dozen milliseconds.
3 supporting quotes
Use a constrained query DSL
Chose Predictable token syntax and examples over Maximum search-language flexibility.
Rationale: A consistent DSL better matches model pattern generation and improves valid-query rates.
3 supporting quotes
Enable self-service tool publication
Chose @ChirpTool annotations and gateway polling over Central manual MCP tool registration.
Rationale: Self-service annotations let teams expose tools immediately without coordination, while governance remains necessary to keep the interface cohesive.
3 supporting quotes
Gotchas (what bit them)
Local MCP setup blocked non-technical adoption.
Root cause: Users had to create Private App Access Tokens and configure local MCP clients manually.
Resolution: Move to a remote MCP server with browser-based OAuth access.
3 supporting quotes
The MCP Java SDK did not yet support the newly standardized Streamable HTTP protocol.
Root cause: The standard was evolving faster than the SDK implementation.
Resolution: Implement a custom transport provider that bridges Dropwizard async responses to MCP sessions.
3 supporting quotes
SSE would have added operational complexity for a tool-call-only workload.
Root cause: Long-lived SSE sessions are harder for load balancers and autoscaled servers, and server-to-client notifications were not needed.
Resolution: Use stateless Streamable HTTP and one ephemeral MCP session per request.
3 supporting quotes
Existing API token semantics were not sufficient for user-facing AI agents.
Root cause: HubSpot historically decoupled API tokens from granular user identities for background sync and automated workflows.
Resolution: Use user-level OAuth apps and replay the intersection of app and user permissions to internal APIs.
3 supporting quotes
Too-flexible CRM query syntax would reduce model reliability.
Root cause: Boolean OR, nested expressions, and relative dates add ambiguity that LLMs may generate inconsistently.
Resolution: Use a consistent token DSL with examples and helpful errors.
3 supporting quotes
Distributed tool ownership can mirror the org chart to customers.
Root cause: Hundreds of teams can expose tools independently, which creates speed but risks fragmentation.
Resolution: Add governance and guardrails around self-service tool publication.
Evaluation
The article does not describe a formal benchmark suite, but it provides production validation criteria: MCP protocol compliance over stateless HTTP, OAuth/user-permission correctness, service discovery without manual gateway redeploys, model-valid query DSL generation, helpful error-driven self-correction, and precise access control for nondeterministic AI queries.
Metrics: MCP protocol compliance · OAuth consent flow success · User permission enforcement · Runtime permission-computation overhead · Tool discovery coverage · Gateway redeploy avoidance · Valid query DSL generation · Helpful error self-correction · Autoscaling compatibility · Region-aware routing compatibility
4 supporting quotes
Outcomes
- HubSpot launched the first CRM Deep Research Connector with ChatGPT and the first third-party remote MCP connector in the ChatGPT Registry according to the article.
- The remote server removed local installation and configuration requirements.
- The homegrown Java/Dropwizard MCP server reached customer-ready implementation in a matter of weeks.
- The custom transport achieved full MCP compliance in a stateless HTTP environment.
- CHIRP annotations made MCP tool exposure self-service for hundreds of teams.
- OAuth and runtime permission intersection let ChatGPT respect native HubSpot user permissions.
- The query DSL gave AI models a predictable, example-rich way to generate CRM searches.
- The design accepted a few dozen milliseconds of overhead for precise user-level access control.
The source reports 250,000+ businesses, hundreds of teams, thousands of public APIs, contacts/companies/deals/tickets scope coverage, a few dozen milliseconds of permission overhead, and build time measured in weeks.