Skip to main content
Glama
TNE736

LQABR MCP HubSpot Server

by TNE736

LQABR_MCP

The LQABR central HubSpot MCP server. Built on FastMCP, and standalone — no dependency on the LQABR mono-repo.

RUNNING.md — how to run it: setup, credentials, both transports, agentgateway, troubleshooting. CONSUMING.md — how the email / voice / scheduling agents call it: ADK McpToolset, auth, the wire contract, tool scoping. This file is the design rationale; those two are the procedures.

LQABR_MCP/
├── hubspot-crm-mcp-server/
│   ├── __init__.py              (empty, per mcp.odt Step 4)
│   ├── hubspot_crm_server.py    the launcher — mcp.odt Step 5
│   ├── test_server.py           remote smoke test — handoff S8
│   ├── hubspot_mcp/             THE IMPLEMENTATION (vendored)
│   │   ├── __init__.py          provenance + drift warning — read this
│   │   ├── server.py            the FastMCP object + the two tools
│   │   ├── secrets.py           Secret Manager access
│   │   ├── obs/                 the four logs: system/process/audit/tokens
│   │   │   ├── __init__.py
│   │   │   ├── context.py       RunContext, run_id, lead_ref_id
│   │   │   └── loggers.py
│   │   └── hubspot/
│   │       ├── __init__.py
│   │       ├── crm.py           upsert_lead_profiles / get_lead_profile
│   │       ├── auth.py          get_hubspot_token(), short-lived M2M
│   │       ├── schema.py        LeadProfile, PushResult, property mapping
│   │       └── failures.py      failure taxonomy + CircuitBreaker
│   └── tests/                   61 tests ported from the mono-repo
├── .vscode/hubspot_mcp.json     stdio config — mcp.odt Steps 7–8
├── Dockerfile                   Cloud Run image — handoff S4
├── .dockerignore
├── pytest.ini
├── .python-version              3.12, matching the Dockerfile
├── .env.example                 mode switches + secret IDs (no values)
├── pyproject.toml
├── RUNNING.md                   step-by-step runbook — start here
├── CONSUMING.md                 client integration guide for other agents
└── README.md

This is a fork, not a move

hubspot_mcp/ is a copy of the mono-repo's implementation. Only the import lines were rewritten; no logic, field name or HubSpot property name changed. Verified by diff — the only differing lines across all nine files are:

- from lqabr_core.obs import get_obs, utc_now_iso
+ from ..obs import get_obs, utc_now_iso
- from lqabr_core.leadgen.secrets import ...
+ from ..secrets import ...

The mono-repo still needs its copy. Do not delete it.

Module

Also used by

lqabr_core.obs

8 files in lead_profile/src, 2 in text_voice/src, lqabr_core/crm

lqabr_core.leadgen.*

12 lead_profile files incl. call_mcp.py, plus evals/run_eval.py

lqabr_core.leadgen.secrets

lead_profile model.py, 2 test files

The consequence: there are now two write paths to HubSpot carrying the same field names and the same HubSpot property names — and the data contract says those names are the contract. Any fix to crm.py, any auth change, any HubSpot property rename must be applied in both places by hand. Nothing enforces it. Budget for that, or plan to retire one side.

Related MCP server: HubSpot CRM MCP Server

Why this lives outside the mono-repo

The LQABR repo has a top-level package literally named mcp at its root, which shadows the mcp SDK that FastMCP depends on. Running from inside the repo breaks FastMCP's own imports.

Do not add the LQABR repo root to PYTHONPATH.

Library: FastMCP, not the official SDK

The dependency is fastmcp>=3.4.7. Do not add mcp>=2.0 — the two are mutually exclusive:

  • fastmcp 3.4.7 pins mcp<2.0,>=1.24.0 transitively (it installs mcp 1.29).

  • MCPServer, the official SDK's server class, exists only in mcp>=2.0.

So a project can use FastMCP or MCPServer, never both. This one uses FastMCP. Nothing here imports MCPServer.

Two consequences worth knowing:

  • Transport names differ. FastMCP's HTTP transport is "http" ("streamable-http" is accepted as an alias) and the endpoint path kwarg is path=. The official SDK spells that streamable_http_path=.

  • Type fields differ. Because mcp is pinned to 1.x, the bundled types use camelCase: Tool.inputSchema, not input_schema.

The mono-repo's lqabr_core/leadgen/server.py still uses MCPServer. That is now a second divergence between the two codebases, on top of the fork.

Running it

uv sync

# stdio — local ADK MCPToolset, or the VSCode config in .vscode/
uv run python hubspot-crm-mcp-server/hubspot_crm_server.py

# HTTP — what Cloud Run runs
uv run python hubspot-crm-mcp-server/hubspot_crm_server.py \
    --transport http --host 0.0.0.0 --port 8080

Credentials

tools/list needs nothing. A tool call needs the HubSpot token, and that comes from Secret Manager — context §7.6 / CLAUDE.md §5: secrets are never hard-coded and never committed.

cp .env.example .env                    # holds mode switches + secret IDs only
gcloud auth application-default login
uv sync --extra gcp --extra test        # both extras; --extra gcp alone drops pytest
export UV_ENV_FILE=.env

uv sync --extra <x> syncs exactly that extra set, so --extra gcp on its own uninstalls pytest. test_server.py runs as a CLI without pytest, but uv run pytest obviously needs it.

.env carries no secret values — just HUBSPOT_AUTH_MODE, LQABR_SECRET_PROJECT and the secret's ID. The token itself is fetched over the Secret Manager API at runtime, held in memory, never logged (the audit line records only length and last four characters), and cached for 900s so rotation needs no redeploy.

auth.py and secrets.py both fail closed — unset means an explicit error, never a silent default.

LQABR_SECRET_BACKEND=env exists as a last resort for offline work or CI. secrets.py scopes it to "local development, CI and tests only" and there is no automatic fallback to it — you must type it. It puts a live credential in a file on disk. Never set it in Cloud Run.

Every flag has an env-var default (MCP_TRANSPORT, MCP_HOST, PORT, MCP_PATH), so the container starts with no arguments — Cloud Run injects PORT.

Tests

uv run pytest              # 61 tests, all passing, none touch real HubSpot

pytest.ini puts hubspot-crm-mcp-server/ on the path so import hubspot_mcp resolves — the folder itself can't be a package because of the hyphen.

The contract is TEN fields, not nine

LeadProfile carries ten: the nine everyone documents, plus contact_name (added for the firstname/lastname mapping). The mono-repo's test_wrapper_shape_is_the_nine_fields_plus_ids still asserted 9 and had been failing there — schema.py is byte-identical, so this project inherited it.

Resolved 2026-08-18: the code was right, the number was stale. The test is renamed test_wrapper_shape_is_the_contract_fields_plus_ids and now asserts the field names rather than a count, so the next addition fails with something readable.

The same fix is still owed to the mono-repo — that assertion is unchanged there and still red. The docs that say "9 fields" should be corrected too.

Testing a deployed server

# local
uv run python hubspot-crm-mcp-server/test_server.py

# Cloud Run — mints a Google ID token via ADC
uv run python hubspot-crm-mcp-server/test_server.py \
    --url https://lqabr-mcp-server-xxxx.a.run.app/mcp --auth google

# one real read against HubSpot — writes nothing
... --auth google --employee-id EMP-00042

Read-only by design: it never calls upsert_lead_profile. Sends X-LQABR-Run-Id so the server's audit logs attribute the call (the B10 fix).

The ID token audience is the service base URL without /mcp. The script strips it for you.

The client uses fastmcp.Client, which handles the initialize handshake, so there is no session plumbing in this file. Headers ride on a StreamableHttpTransport. This now matches the reference sample's library.

Deploying to Cloud Run

Two-stage uv build, non-root mcp user, PID 1 is Python so SIGTERM drains cleanly. Self-contained: no sibling folder, no git dependency.

docker build -t lqabr-mcp-server .

Commit a uv.lock and switch the sync to --frozen before production.

Then S5–S8: create mcp-server-sa, grant secretmanager.secretAccessor on lqabr-hubspot-access-token, deploy --no-allow-unauthenticated, grant the three agent service accounts roles/run.invoker, point test_server.py at it.

Tools exposed

Tool

Direction

Notes

upsert_lead_profile

write

Company upsert → Contact upsert → association. Idempotent.

get_lead_profile

read

contract fields + contact_hs_id + company_hs_id.

Dedup: Contact on employee_id, Company on company_id. Email lives in the custom email_id property.

Open item. The registered tool name is upsert_lead_profile (singular), but the design docs, session handoff and project instructions all say upsert_lead_profiles (plural), and the underlying function is plural. This is a wire contract — settle it before any client wires up.

Credentials

Two, never confused:

  • Google ID token proves agent → this server (Cloud Run service-to-service).

  • HubSpot M2M token proves this server → HubSpot, minted per call inside the server. Callers never see it.

This service is the sole holder of the HubSpot credential.

Verified

In a clean venv containing only fastmcp 3.4.7 (which brought mcp 1.29), requests and pytest — with lqabr_core absent (confirmed ModuleNotFoundError) and MCPServer absent (confirmed ImportError):

  • zero lqabr_core imports anywhere in the project

  • ported test suite: 61 passed, 0 failed

  • stdio — tools/list returns both tools, PYTHONPATH stripped entirely

  • --transport http — binds host/port/path, full fastmcp.Client session

  • --transport streamable-http — alias accepted, serves the same endpoint

  • test_server.py — PASS against the running server, exit 0

  • test_server.py under pytest — 3 passed with a server, 3 skipped without

  • live call_tool reached the real chain: transport → tool → crm.pyauth.pysecrets.py, failing only at the deliberate AuthConfigError / SecretConfigError guards (no GCP config in the test environment). The wiring is proven end to end.

Not verified: the Docker image has never been built — no Docker daemon was available where these files were assembled. Nothing has touched real HubSpot; every test uses a fake.

Available Tools

4 tools
get_blog_summaryA

Read one blog summary row by its publication timestamp. Read-only. Returns the seven contract fields plus ticket_hs_id. Not-found is a VALID result — found is false and summary is null — never an error. Check warnings: a non-empty list means more than one row shares this timestamp and the first was returned.

ParametersJSON Schema
NameRequiredDescriptionDefault
blog_published_atYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description takes full responsibility for behavioral transparency. It clearly states the tool is read-only, describes the return fields and the non-error 'not-found' behavior, and warns about potential ambiguity with shared timestamps. The only minor omission is not specifying the exact return structure or whether it includes pagination.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is four sentences, each with distinct value: purpose, safety, error handling, and edge-case warning. It is front-loaded with the core action, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple single-parameter tool and presence of an output schema (which handles return structure), the description covers purpose, behavioral edges, and warnings adequately. The omission of timestamp format detail is minor and acceptable for a tool with just one parameter and no nested objects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains that the single parameter 'blog_published_at' is a publication timestamp for identifying the row, which aligns with the schema. However, it does not provide format details (e.g., ISO 8601) or validation constraints beyond that, leaving the agent to infer from context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies a clear verb ('read'), a specific resource ('blog summary row'), and the unique identifier ('publication timestamp'). It also distinguishes from siblings like 'upsert_blog_summary' and 'get_lead_profile' by focusing on reading a blog summary.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context on when to use this tool: reading a single blog summary by timestamp. It does not explicitly mention when not to use it or alternatives, but the sibling list and the read-only nature imply a contrast with upsert_blog_summary. Some guidance on the 'not-found' and 'warnings' behavior aids correct usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_lead_profileA

Read one lead's current state from HubSpot. Read-only. Returns the nine contract fields plus contact_hs_id and company_hs_id so you can write status back without re-searching. Check company_resolved: when false, the company fields are unpopulated and warnings explains why.

ParametersJSON Schema
NameRequiredDescriptionDefault
emailNo
employee_idNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden for behavioral disclosure. It covers read-only safety, enumerates the returned fields, and explains the company_resolved flag and warnings. This is substantial context for a read tool, though it does not cover error cases or edge behaviors in detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no redundancy. The first sentence states the core purpose and safety, and the second adds essential behavioral details. Every word contributes value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read tool with an output schema, the description covers the main aspects: purpose, return fields, and a key data-quality flag. However, it omits parameter usage, which is a notable gap given the low schema coverage. The output schema likely documents return values, so that is not a deficiency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It does not mention email or employee_id at all, nor explain how the lead is identified, whether identifiers are mutually exclusive, or what happens if neither is provided. The schema only provides types and defaults, leaving the semantic meaning entirely unexplained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Read one lead's current state from HubSpot.' It uses a specific verb and resource, and explicitly declares read-only behavior. It differentiates from siblings by focusing on leads rather than blog summaries and by contrasting with upsert operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by stating the returned IDs are 'so you can write status back without re-searching,' suggesting it is the read-before-write companion to upsert_lead_profile. It also instructs to check company_resolved for interpreting data. However, it does not explicitly name alternatives or provide when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

upsert_blog_summaryA

Put one published blog post into HubSpot: the ONLY writer to the blog summary store. Searches on blog_published_at, then updates that row or creates one — a single upsert, so calling it twice for the same post is safe and does not duplicate. Returns the ticket id and whether the row was created or updated. blog_industry must be exactly one of FINANCIAL_SERVICES, LEGAL_SERVICES, HEALTHCARE — a near-miss selects zero leads and raises no error. Bad data is recorded and reported as failed, never silently dropped.

ParametersJSON Schema
NameRequiredDescriptionDefault
subjectYes
blog_summaryYes
blog_industryYes
summary_ref_idNo
blog_published_atYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and excels: it reveals the upsert logic (no duplicates), mentions the return value (ticket id and created/updated status), warns about exact value requirements for blog_industry, and states that bad data is recorded and reported as failed. This is comprehensive behavioral disclosure beyond what any annotation could provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact, every sentence adds critical information, and key points are front-loaded. It covers purpose, safety, return value, parameter constraints, and error handling without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters, an output schema, and no annotations, the description provides all necessary behavioral context including upsert semantics, exact enum values, and failure behavior. The return value is described, and the output schema structure is implied but not needed in detail. This is complete for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description must compensate. It explicitly explains the blog_industry parameter's allowed values and failure behavior, and implies the meaning of blog_published_at as the search key. It does not detail subject, blog_summary, or summary_ref_id, but the overall intent is clear enough given the tool's purpose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool puts a blog post into HubSpot using an upsert strategy, specifies it is the only writer to the blog summary store, and distinguishes itself from siblings by focusing on blog summaries rather than lead profiles. The verb 'put' combined with 'published blog post' and 'upsert' gives a concrete, specific purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states this is for published blog posts and mentions that calling it twice is safe due to upsert behavior. It does not explicitly list when not to use it or name alternatives among siblings, but the sibling tools (upsert_lead_profile, get_lead_profile, get_blog_summary) have different focuses, so the usage context is clear enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

upsert_lead_profileA

Create or update one lead in HubSpot: upserts the Company, upserts the Contact, and associates them. Creating and updating are ONE upsert, so calling this twice for the same lead is safe and does not duplicate. Returns the HubSpot ids. Bad data is recorded and reported as failed, never silently dropped.

ParametersJSON Schema
NameRequiredDescriptionDefault
emailNo
phoneNo
industryNo
job_titleNo
company_idYes
employee_idYes
lead_ref_idNo
annual_revenue_mNo
decision_maker_flagYes
frequency_of_purchaseNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavior. It reveals the internal operations (upsert Company, upsert Contact, associate), idempotency, return value (IDs), and error handling (bad data recorded and reported, never silently dropped). This is comprehensive for safety and side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences, each earning its place: first sentence defines the action, second sentence emphasizes idempotency, third sentence covers error handling and return values. No redundancy or unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately covers purpose, safety, and error behavior, and the output schema covers return values. However, given the high parameter count (10) and zero schema descriptions, the lack of parameter guidance leaves the description incomplete for correct invocation. It is sufficient for understanding what the tool does but not for parameter selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not explain the purpose or format of any of the 10 parameters (e.g., what employee_id, company_id, decision_maker_flag represent). The description must compensate for the lack of schema parameter descriptions, but it fails to do so, leaving the agent to guess parameter semantics from names alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create or update one lead'), the resource ('lead in HubSpot'), and specifics that it upserts both Company and Contact and associates them. It distinguishes itself from sibling tools like 'get_lead_profile' (read-only) and 'upsert_blog_summary' (different entity).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains that calling the tool twice is safe and does not duplicate, indicating idempotency. However, it does not provide explicit guidance on when to use this tool versus alternatives (e.g., get_lead_profile for reads) or when not to use it, leaving usage context implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.1.0
    • First observedget_blog_summary
    • First observedget_lead_profile
    • First observedupsert_blog_summary
    • First observedupsert_lead_profile

TDQS

A3.8/5.0
Disambiguation2/5

The tools clearly separate lead and blog summary domains, but within each domain the upsert and get tools have high semantic overlap in purpose, though descriptions help distinguish read vs. write.

Naming Consistency4/5

All tool names follow a consistent verb_noun pattern (upsert/get + lead_profile/blog_summary) with snake_case, very predictable. Minor point: 'upsert' is a valid term but less common than 'create_or_update'.

Tool Count4/5

4 tools is a reasonable count for a focused HubSpot integration covering two entities (lead and blog summary) with basic CRUD. It's slightly thin but appropriate for a narrow scope.

Completeness3/5

Coverage is incomplete: lead profiles have upsert+get but no ability to delete or list/filter leads. Blog summaries similarly lack delete and listing. The domain surface has notable missing operations that could hinder workflows.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Exposes HubSpot CRM data and actions as tools for AI agents, enabling contact lookup, company search, contact creation, and activity logging via natural language.
    4
    275
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    Enables AI assistants to interact with a HubSpot CRM account via natural language, starting with read-only lookups and optionally enabling write operations like creating contacts, deals, and notes.
    11
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TNE736/LQABR_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server