Uh oh!
There was an error while loading. Please reload this page.
feat: update MCP SDK and monitoring - #227
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:2c734171b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
2c73417 to
79c2d78CompareThere was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:270dbdbfcb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
dodeja
commented
May 29, 2026
@greptile review |
Uh oh!
There was an error while loading. Please reload this page.
dodeja
commented
May 29, 2026
@greptile review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:24ccec0758
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
dodeja
commented
May 29, 2026
@greptile review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:62c461f4a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
dodeja
commented
May 29, 2026
@greptile review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:1393bf104f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1393bf1 to
a13e545Comparea13e545 to
2c7f657Compare2c7f657 to
800bd66Comparedodeja
commented
May 29, 2026
@greptile review |
Summary
@modelcontextprotocol/sdk@^1.29.0and@terminal49/sdk@0.2.0intentinput telemetry across all MCP tools for Sentry analysis/mcpVercel routing/CORS support and refresh MCP docs/env examplesqsadvisoryVerification
npm auditat repo root: 0 vulnerabilitiesnpm auditinpackages/mcp: 0 vulnerabilitiesnpm auditinsdks/typescript-sdk: 0 vulnerabilitiesnpm run type-check --workspace @terminal49/mcpnpm run lint --workspace @terminal49/mcpnpm test --workspace @terminal49/mcp -- --run(41 passed)npm run build --workspace @terminal49/mcpnpm run type-check --workspace @terminal49/sdknpm run lint --workspace @terminal49/sdknpm test --workspace @terminal49/sdk -- --run(50 passed, 2 skipped)npm run build --workspace @terminal49/sdknpm run buildcd docs && npx mintlify broken-linksget_supported_shipping_linesforMAEUsucceeded withintentargumentcaptureExceptionflushed successfullyGreptile Summary
This PR upgrades the MCP SDK to
@modelcontextprotocol/sdk@^1.29.0, adds optional Sentry MCP monitoring (@sentry/node@^10.55.0) with env-based init and PII-off defaults, introduces an optionalintenttelemetry field across all tool input schemas, adds a/mcpVercel route with matching CORS headers, and applies a batch ofnpm auditoverrides.instrument.tsbootstraps Sentry as the first import in both the STDIO and HTTP entry points;wrapMcpServerWithSentrywraps the server for span/trace capture;captureMcpException+flushMcpEventshandle tool-level error reporting.intenttelemetry: An optional 200-charintentstring is appended to every tool's input schema for Sentry analysis; it is explicitly not forwarded to the Terminal49 API.finallyblock inapi/mcp.tsflushes Sentry unconditionally when initialized (fixing the previously flagged event-loss for tool errors);wrapToolWithContractalso callsflushMcpEvents()in its catch, which is necessary for the STDIO transport but adds up to 2 seconds of blocking latency before the error response is delivered in the HTTP/serverless path.Confidence Score: 4/5
Safe to merge with one latency concern in the error path worth addressing before or shortly after shipping.
Every tool error now triggers
await flushMcpEvents()insidewrapToolWithContractbefore the error object is returned to the MCP transport layer. Because the transport writes the response only after the handler returns, this adds up to 2 seconds of wall-clock delay to every tool error response visible to the MCP client. In the HTTP/Vercel path thefinallyblock inapi/mcp.tsalready handles flushing after the response is delivered, so this per-tool flush is redundant there. The safety risk is low (no data loss, no incorrect behaviour), but the latency impact is real and present on every validation or API error path.packages/mcp/src/server.ts — the wrapToolWithContract catch block awaits flushMcpEvents() before returning, blocking error response delivery.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client as MCP Client participant Vercel as Vercel Edge participant Handler as api/mcp.ts handler participant MCPServer as McpServer (Sentry-wrapped) participant Tool as wrapToolWithContract participant Sentry as Sentry SDK Client->>Vercel: POST /mcp or POST / Vercel->>Handler: forward request Handler->>MCPServer: server.connect(transport) + handleRequest MCPServer->>Tool: call tool handler(args) alt Tool success Tool-->>MCPServer: "{ content, structuredContent }" MCPServer-->>Handler: response written to transport Handler->>Sentry: flush(2000) [finally block] Handler-->>Vercel: function complete else Tool error Tool->>Sentry: captureException(error) Tool->>Sentry: flush(2000) blocks response up to 2s Sentry-->>Tool: flushed Tool-->>MCPServer: "{ content, isError: true }" MCPServer-->>Handler: error response written to transport Handler->>Sentry: flush(2000) [finally block, queue already empty] Handler-->>Vercel: function complete else Outer handler error Handler->>Sentry: captureException(error) Handler->>Sentry: flush(2000) [finally block] Handler-->>Vercel: 500 response end Vercel-->>Client: responsePrompt To Fix All With AI
Reviews (5): Last reviewed commit: "fix: capture handled mcp tool errors" | Re-trigger Greptile