Skip to content

MCP semantic conventions - #2083

Merged
lmolkova merged 28 commits into
open-telemetry:mainfrom
lmolkova:mcp
Jan 12, 2026
Merged

lmolkova merged 28 commits into
open-telemetry:mainfrom
lmolkova:mcp

Conversation

@lmolkova

@lmolkova lmolkova commented Apr 10, 2025 •

Copy link
Copy Markdown
Member

Comment thread docs/attributes-registry/mcp.md Outdated
Comment thread docs/gen-ai/mcp.md Outdated
Comment thread docs/gen-ai/mcp.md Outdated
Comment thread docs/gen-ai/mcp.md Outdated
Comment thread docs/gen-ai/mcp.md Outdated
Comment thread docs/gen-ai/mcp.md
Comment thread docs/gen-ai/mcp.md Outdated
Comment thread docs/attributes-registry/mcp.md Outdated
@github-actions github-actions Bot added the enhancement New feature or request label Apr 17, 2025
@lmolkova lmolkova changed the title [WIP] MCP semantic conventions MCP semantic conventions Apr 17, 2025
@lmolkova lmolkova moved this from Untriaged to Awaiting SIG approval in Semantic Conventions Triage Apr 17, 2025
@lmolkova
lmolkova marked this pull request as ready for review April 17, 2025 05:19
@lmolkova
lmolkova requested review from a team as code owners April 17, 2025 05:19
Comment thread docs/gen-ai/mcp.md
Comment thread model/mcp/common.yaml Outdated
Comment thread model/mcp/registry.yaml Outdated
Comment thread model/mcp/registry.yaml Outdated
Comment thread model/mcp/common.yaml Outdated
Comment thread docs/gen-ai/mcp.md
@lmolkova
lmolkova requested a review from Copilot May 5, 2025 22:27

This comment was marked as outdated.

Comment thread .github/ISSUE_TEMPLATE/bug_report.yaml

@brunobat brunobat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks!
In general this seems reasonable.
Just added 2 comments.

Comment thread docs/gen-ai/mcp.md Outdated
Comment thread model/mcp/metrics.yaml
lmolkova and others added 3 commits December 29, 2025 11:43
@lmolkova

lmolkova commented Jan 5, 2026

Copy link
Copy Markdown
Member Author

@jsuereth jsuereth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! I like how you've worded the context propagation component to be forward compatible.

@jsuereth jsuereth moved this from Needs More Approval to Ready to be Merged in Semantic Conventions Triage Jan 7, 2026
@github-project-automation github-project-automation Bot moved this from Ready to be Merged to Needs More Approval in Semantic Conventions Triage Jan 12, 2026
@lmolkova
lmolkova added this pull request to the merge queue Jan 12, 2026
Merged via the queue into open-telemetry:main with commit c840084 Jan 12, 2026
21 checks passed
@lmolkova
lmolkova deleted the mcp branch January 12, 2026 18:04
Copilot AI added a commit to modelcontextprotocol/csharp-sdk that referenced this pull request Jan 12, 2026
…en-telemetry/semantic-conventions#2083

- Change mcp.tool.name to gen_ai.tool.name
- Change mcp.prompt.name to gen_ai.prompt.name
- Change mcp.request.id to jsonrpc.request.id
- Change rpc.jsonrpc.error_code to rpc.response.status_code
- Update network.transport values from 'stdio' to 'pipe' and 'sse'/'http' to 'tcp'
- Add gen_ai.operation.name attribute (value: 'execute_tool' for tools/call)
- Update histogram bucket boundaries to match semantic conventions spec
- Update tests to verify new attribute names

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
chrisguidry added a commit to PrefectHQ/fastmcp that referenced this pull request Jan 15, 2026
Updates FastMCP's telemetry to align with the new MCP semantic conventions
from open-telemetry/semantic-conventions#2083. This gives us interoperability
with other MCP implementations while keeping fastmcp.* attributes for things
unique to our framework.

Changes:
- Span names now follow `{method} {target}` format (e.g., `tools/call greet`)
- Added `mcp.method.name` and `mcp.resource.uri` attributes
- Renamed `fastmcp.session.id` to standard `mcp.session.id`
- Kept fastmcp.* attributes for server name, component info, provider details

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vola-trebla

Copy link
Copy Markdown

Hey! We built a TypeScript implementation of these MCP semantic conventions in toad-eye — an open-source observability toolkit for MCP servers.

What we implemented based on this spec:

  • Span names: tools/call {name}, resources/read {uri}, prompts/get {name}, sampling/createMessage {model}
  • Attributes: mcp.method.name, mcp.session.id, mcp.protocol.version, network.transport
  • SpanKind.SERVER for server-side, SpanKind.CLIENT for client-side
  • W3C traceparent propagation via _meta field for distributed tracing across MCP client → server

Also added MCP-specific metrics (gen_ai.mcp.tool.calls, .errors, .duration, .resource.reads, .session.active) and a tool hallucination counter (JSON-RPC -32601 detection).

11 Grafana dashboards auto-provisioned, including 3 MCP-specific ones.

Happy to share feedback on the spec from an implementer's perspective if that's useful.

constantinius added a commit to getsentry/sentry-conventions that referenced this pull request Jun 9, 2026
Align Sentry MCP attributes with the OTel MCP semantic conventions
that merged in open-telemetry/semantic-conventions#2083 (Jan 2026).

OTel's MCP convention is deliberately minimal: only 4 mcp.* registry
attributes, reusing existing gen_ai.*, network.*, jsonrpc.*, and
error.* namespaces for everything else. This commit brings Sentry
conventions in line with that approach.

Changes:

Set is_in_otel=true on 4 direct matches:
- mcp.method.name
- mcp.protocol.version
- mcp.resource.uri
- mcp.session.id

Deprecated 7 attributes with backfill to OTel equivalents:
- mcp.tool.name → gen_ai.tool.name
- mcp.prompt.name → gen_ai.prompt.name
- mcp.tool.result.content → gen_ai.tool.call.result
- mcp.tool.result.is_error → error.type
- mcp.request.id → jsonrpc.request.id
- mcp.transport → network.transport
- mcp.resource.protocol → network.protocol.name

Created 3 new attributes:
- gen_ai.prompt.name (OTel gen_ai registry, aliased from mcp.prompt.name)
- jsonrpc.request.id (OTel MCP common refs, aliased from mcp.request.id)
- jsonrpc.protocol.version (OTel MCP common refs)

27 Sentry-only attributes remain unchanged (mcp.client.*, mcp.server.*,
mcp.logging.*, mcp.progress.*, mcp.prompt.result.*, etc.) — these have
no OTel equivalent.
constantinius added a commit to getsentry/sentry-conventions that referenced this pull request Jun 9, 2026
Align Sentry MCP attributes with the OTel MCP semantic conventions
that merged in open-telemetry/semantic-conventions#2083 (Jan 2026).

OTel's MCP convention is deliberately minimal: only 4 mcp.* registry
attributes, reusing existing gen_ai.*, network.*, jsonrpc.*, and
error.* namespaces for everything else. This commit brings Sentry
conventions in line with that approach.

Changes:

Set is_in_otel=true on 4 direct matches:
- mcp.method.name
- mcp.protocol.version
- mcp.resource.uri
- mcp.session.id

Deprecated 7 attributes with backfill to OTel equivalents:
- mcp.tool.name → gen_ai.tool.name
- mcp.prompt.name → gen_ai.prompt.name
- mcp.tool.result.content → gen_ai.tool.call.result
- mcp.tool.result.is_error → error.type
- mcp.request.id → jsonrpc.request.id
- mcp.transport → network.transport
- mcp.resource.protocol → network.protocol.name

Created 3 new attributes:
- gen_ai.prompt.name (OTel gen_ai registry, aliased from mcp.prompt.name)
- jsonrpc.request.id (OTel MCP common refs, aliased from mcp.request.id)
- jsonrpc.protocol.version (OTel MCP common refs)

27 Sentry-only attributes remain unchanged (mcp.client.*, mcp.server.*,
mcp.logging.*, mcp.progress.*, mcp.prompt.result.*, etc.) — these have
no OTel equivalent.
constantinius added a commit to getsentry/sentry-conventions that referenced this pull request Jun 16, 2026
* feat(mcp): align MCP attributes with OTel semantic conventions

Align Sentry MCP attributes with the OTel MCP semantic conventions
that merged in open-telemetry/semantic-conventions#2083 (Jan 2026).

OTel's MCP convention is deliberately minimal: only 4 mcp.* registry
attributes, reusing existing gen_ai.*, network.*, jsonrpc.*, and
error.* namespaces for everything else. This commit brings Sentry
conventions in line with that approach.

Changes:

Set is_in_otel=true on 4 direct matches:
- mcp.method.name
- mcp.protocol.version
- mcp.resource.uri
- mcp.session.id

Deprecated 7 attributes with backfill to OTel equivalents:
- mcp.tool.name → gen_ai.tool.name
- mcp.prompt.name → gen_ai.prompt.name
- mcp.tool.result.content → gen_ai.tool.call.result
- mcp.tool.result.is_error → error.type
- mcp.request.id → jsonrpc.request.id
- mcp.transport → network.transport
- mcp.resource.protocol → network.protocol.name

Created 3 new attributes:
- gen_ai.prompt.name (OTel gen_ai registry, aliased from mcp.prompt.name)
- jsonrpc.request.id (OTel MCP common refs, aliased from mcp.request.id)
- jsonrpc.protocol.version (OTel MCP common refs)

27 Sentry-only attributes remain unchanged (mcp.client.*, mcp.server.*,
mcp.logging.*, mcp.progress.*, mcp.prompt.result.*, etc.) — these have
no OTel equivalent.

* fix(mcp): add reciprocal alias entries for MCP deprecations

The backfill deprecations on mcp.tool.name and mcp.tool.result.content
point to gen_ai.tool.name and gen_ai.tool.call.result respectively, but
the target attributes were missing the reciprocal alias entries. Add
mcp.tool.name and mcp.tool.result.content to the alias arrays of their
replacement attributes to maintain symmetric alias-group metadata.

Regenerated JS and Python attribute files to reflect the changes.

* fix(mcp): Add symmetric aliases and update name templates for deprecated MCP attributes

Fix CI failures caused by asymmetric alias relationships and deprecated
attribute references in name templates:

- Add reciprocal aliases to mcp.tool.result.content for the full alias
  group (gen_ai.tool.call.result, gen_ai.tool.message, gen_ai.tool.output)
- Add mcp.tool.result.content to gen_ai.tool.message and gen_ai.tool.output
  alias lists
- Add alias list to mcp.tool.name (gen_ai.tool.name, ai.function_call)
- Add mcp.tool.name to ai.function_call alias list
- Update mcp.json name templates to use gen_ai.tool.name and
  gen_ai.prompt.name instead of deprecated mcp.tool.name and mcp.prompt.name

* fix(jsonrpc): Change pii to 'maybe' for jsonrpc.protocol.version and jsonrpc.request.id

Address review feedback from loewenheim: string attributes should default
to pii 'maybe' unless scrubbing would cause product degradation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Semantic conventions for Model Context Protocol