Skip to content

dev-docs (MCP server): Add tracing and errors documentation #14374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

betegon
Copy link
Member

@betegon betegon commented Jul 15, 2025

DESCRIBE YOUR PR

Closes #14106

Adds developer docs for our MCP Server instrumentation.

Route for the documentation sdk/expected-features/mcp-instrumentation that includes:

.mcp-instrumentation
├── index.mdx  # brief description on current features and limitations
├── errors.mdx # draft errors doc 
└── tracing.mdx # Tracing and span conventions

Followed this file structure as a start to (in the future) have this structure for all the other features, having something like this below, where we have :

.[Feature 1]
├── index.mdx 
├── logs.mdx 
├── errors.mdx 
.
.
.
.[Feature 2]
├── index.mdx 
├── errors.mdx 
├── tracing.mdx
.
.
.

The structure idea is from @abhi, who helped me settle this <3.

NOTE: Error docs are going to change, addressing feedback from sentry-javascript/pull/16817

IS YOUR CHANGE URGENT?

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

@betegon betegon self-assigned this Jul 15, 2025
Copy link

vercel bot commented Jul 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2025 2:28pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
sentry-docs ⬜️ Ignored (Inspect) Visit Preview Jul 16, 2025 2:28pm

@betegon betegon changed the title Bete/mcp server module dev-docs (MCP server): Add tracing and errors documentation Jul 16, 2025
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

nice, this is what I think we want. Once we convert the errors spec to stop using tags we can merge!

Copy link

@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.

Bug: Code Example Mismatches Documentation Goals

The captureError code example (lines 19-34) uses TypeScript syntax and JavaScript-specific relative imports (../../currentScopes, ../../exports). This contradicts the stated goal of language-agnostic documentation for all SDK implementations and exposes internal implementation details. Additionally, a "[WIP] will be removed as tags are intended for users" comment (line 38) is present, which is a temporary development note and should not be in the final documentation.

develop-docs/sdk/expected-features/mcp-instrumentation/errors.mdx#L17-L38

```ts
import { getClient } from '../../currentScopes';
import { captureException } from '../../exports';
export function captureError(error: Error, errorType?: string): void {
try {
const client = getClient();
if (!client) return;
captureException(error, {
tags: {
mcp_error_type: errorType || 'handler_execution',
},
});
} catch {
// Silently ignore capture errors so it never affects MCP operation
}
}
```
- **Never throws an exception:** All error capture is wrapped in a try/catch and will never throw an exception.
- **Tags errors:** [WIP] will be removed as tags are intended for users.

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@@ -0,0 +1,76 @@
---
title: Errors
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
title: Errors
title: MCP Server Errors
sidebar_title: Errors


### Error Categorization

Errors are categorized and tagged based on the handler and error type:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Errors are categorized and tagged based on the handler and error type:
Errors are categorized and tagged according to the handler and type of error:

title: Tracing
---

The MCP Server module is the instrumentation for the anthropic MCP SDKs. At the moment it only supports the [MCP Typescript SDK](https://github.com/modelcontextprotocol/typescript-sdk/).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The MCP Server module is the instrumentation for the anthropic MCP SDKs. At the moment it only supports the [MCP Typescript SDK](https://github.com/modelcontextprotocol/typescript-sdk/).
The MCP Server module is the instrumentation for the [anthropic MCP](https://www.anthropic.com/news/model-context-protocol) SDKs. At the moment it only supports the [MCP Typescript SDK](https://github.com/modelcontextprotocol/typescript-sdk/).

@@ -0,0 +1,137 @@
---
title: Tracing
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
title: Tracing
title: MCP Tracing
sidebar_title: Tracing

Copy link
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for adding 🫡

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.

MCP Server - instrumentation spec document
3 participants