Skip to content

Initial proposal for MCP semantic conventions #2045

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

Closed
wants to merge 12 commits into from

Conversation

samsp-msft
Copy link

Fixes #2043

Changes

Creates a doc version of semantic conventions for Model Context Protocol (MCP).

The Model Context Protocol (MCP) is an open protocol for interactions between applications and AI models, supporting structured input and output formats. As MCP adoption grows, there's a need to establish semantic conventions for telemetry to ensure consistent observability across implementations.

Note: if the PR is touching an area that is not listed in the existing areas, or the area does not have sufficient domain experts coverage, the PR might be tagged as experts needed and move slowly until experts are identified.

Merge requirement checklist

Copy link

linux-foundation-easycla bot commented Apr 1, 2025

CLA Missing ID CLA Not Signed

Copy link
Contributor

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

We define semantic conventions formally in YAML and generate MD from it, please refer to the contributing.md for the details.

It also seems that MCP is heavily based on JSON RPC and we have conventions defined for it here.

I assume there is some MCP specifics that's worth recording, so we'll need to also figure out whether it should be expressed on JSON RPC spans/metrics with extra attributes or as a separate set of conventions.

@github-project-automation github-project-automation bot moved this from Untriaged to Blocked in Semantic Conventions Triage Apr 2, 2025
@eranra
Copy link

eranra commented Apr 2, 2025

Hi @samsp-msft, very interesting.

@samsp-msft can you generalize the semantic to something like "genai.tools.repo" with broader focus beyond just the focus on MCP. This will allow future extensions to other types of tool repositories and protocols for GenAI. I am aware that MCP is beyond just tools, but this seems to be the most needed area to observe.

Also, you can add a specific semantic for "genai.tools.repo.type" that will enum value of "mcp"

@samsp-msft
Copy link
Author

It also seems that MCP is heavily based on JSON RPC and we have conventions defined for it here.

There are multiple transports, including stdio, JSON RPC and a new Http Streaming one. The MCP standard is evolving rapidly at this point. I would expect the spans for MCP to be wrapped by those for http / RPC based on the way that the communication is used. The attributes here are more about the MCP aspect of calling tools.

@samsp-msft can you generalize the semantic to something like "genai.tools.repo" with broader focus beyond just the focus on MCP. This will allow future extensions to other types of tool repositories and protocols for GenAI. I am aware that MCP is beyond just tools, but this seems to be the most needed area to observe.

This makes sense. MCP is codifying its own transport semantics, but stepping back the same concepts exist when exposing other mechanisms for integrating data sources, tools and prompts into gen_ai. Most of this is not specific to MCP - probably just the concept of a session with an id, and some of the semantics of the type of data being requested, but the latter could be a namespaced value.

For example, if the generalized namespace is gen_ai.integration then we could use a namespaced attribute value that indicates the type eg gen_ai.integration.request = mcp.tools.call.

gen_ai already has a section on tool calling - I think MCP is extending that concept further. What should the base namespace be for the attributes and I can rework this based on that?

@lmolkova
Copy link
Contributor

lmolkova commented Apr 2, 2025

@samsp-msft thanks for the details! let's start with MCP - specific things inside mcp namespace. I'd suggest talking generalized tool calling integrations separately.

@samsp-msft
Copy link
Author

Duplicate #2083

@samsp-msft samsp-msft closed this Apr 21, 2025
@samsp-msft samsp-msft deleted the samsp-msft/MCP branch April 21, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Semantic conventions for Model Context Protocol
3 participants