Skip to content

feat(hex): add Hex MCP Plugin support#286

Open
cstavitsky wants to merge 4 commits intogetsentry:mainfrom
cstavitsky:cstavitsky/hex-mcp-plugin
Open

feat(hex): add Hex MCP Plugin support#286
cstavitsky wants to merge 4 commits intogetsentry:mainfrom
cstavitsky:cstavitsky/hex-mcp-plugin

Conversation

@cstavitsky
Copy link
Copy Markdown

Testing

  • Tested locally via ngrok tunnel
  • ran core suite locally

Summary

  • Adds @sentry/junior-hex, a standalone plugin that connects Junior to Hex's hosted MCP server (create_thread / get_thread) via per-user OAuth — no shared API token needed.
  • Adds guardrails for data integrity (no fabrication, always report data_as_of and gaps), query safety (read-only, scoped to org slug + time window), auth error handling (no retry on 401/403), and rate limits (cap of 6 create_thread / 30 get_thread calls per invocation).
  • Wires the package into the release pipeline (.craft.yml, CI, bump script, CONTRIBUTING.md, README.md).
  • Adds plugin docs at extend/hex-plugin.md with install, config, region table, verification steps, and failure modes.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@cstavitsky is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@cstavitsky cstavitsky changed the title Hex MCP Plugin feat: Hex MCP Plugin May 5, 2026
@cstavitsky cstavitsky changed the title feat: Hex MCP Plugin feat(junior-hex): Hex MCP Plugin May 5, 2026
@cstavitsky cstavitsky changed the title feat(junior-hex): Hex MCP Plugin feat(hex): add Hex MCP Plugin support May 5, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 148d752. Configure here.

Internal data access primitive. Executes a Hex query and returns structured
results. Called by core skills — not intended for direct use. Invoke when you
need to run a Hex query on behalf of a core skill that has provided a query
and pattern.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Atomic Hex skill is exposed

High Severity

query-hex is packaged as a normal discoverable skill, while type: atomic is not runtime-enforced. It accepts arbitrary query input without requiring org_slug or window, bypassing the scoped get-hex-data flow and allowing broad Hex warehouse queries by authorized users.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 148d752. Configure here.

Comment on lines +31 to +33
- Retry up to **5 times** with approximately **10 seconds** between polls.
- Continue polling while the thread status is not `IDLE` (i.e., still processing).
- If still not `IDLE` after 5 retries, return exactly:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The query-hex skill's instructions are contradictory. The steps imply 6 polling attempts, while the guardrails cap it at 5, risking rate limit violations.
Severity: MEDIUM

Suggested Fix

Unify the instructions in query-hex/SKILL.md. Change the text in the steps from "Retry up to 5 times" to "Poll up to 5 times" or "Retry up to 4 times" to align with the guardrail's cap of 5 total get_thread calls per thread. Ensure the error message is also consistent.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/junior-hex/skills/query-hex/SKILL.md#L31-L33

Potential issue: The `query-hex` skill documentation contains conflicting instructions
for polling. The procedural steps direct the LLM to "Retry up to 5 times," which implies
an initial call plus five retries for a total of six `get_thread` calls. However, the
guardrails section and a related error message specify a maximum of five total polling
attempts. An LLM following the step-by-step instructions is likely to make six calls,
which, when multiplied by the six allowed invocations, results in 36 total `get_thread`
calls, exceeding the intended cap of 30.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +42 to +46
- If `query-hex` returns `not_found`, try common slug derivations:
- Lowercase the customer name, replace spaces with hyphens (e.g. "Acme Corp" -> "acme-corp")
- Try without common suffixes: "inc", "llc", "co", "corp", "ltd"
- Try the domain name if known (e.g. "acme" from "acme.com")
- Re-query `query-hex` with each derived slug: "Does a Sentry org with slug '[derived-slug]' exist? Return the slug, plan type, and trial status."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The get-hex-data skill's slug derivation steps suggest more query-hex calls than the guardrail allows, potentially exhausting the invocation budget before the main task is performed.
Severity: HIGH

Suggested Fix

Update the get-hex-data/SKILL.md instructions to align with the guardrails. Either reduce the number of enumerated slug derivation examples or explicitly state that the LLM should only attempt a maximum of three derivations in total, as specified in the guardrail.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/junior-hex/skills/get-hex-data/SKILL.md#L42-L46

Potential issue: The `get-hex-data` skill's instructions for slug derivation are
inconsistent with its invocation limits. The steps enumerate up to seven potential slug
variations to try, instructing the LLM to re-query `query-hex` for each one. This could
lead to eight `query-hex` calls for derivation alone. However, a guardrail limits total
`query-hex` invocations to six per run, with only three allowed for derivation. An LLM
following the steps literally would exhaust its entire invocation budget on derivation,
preventing it from performing its primary function of retrieving usage data.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant