Content-Length: 372032 | pFad | https://github.com/traceloop/openllmetry/pull/2956

D2 fix(mcp): Added support for newer version of MCP by fali007 · Pull Request #2956 · traceloop/openllmetry · GitHub
Skip to content

fix(mcp): Added support for newer version of MCP #2956

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

Merged
merged 9 commits into from
May 20, 2025
Merged

Conversation

fali007
Copy link
Contributor

@fali007 fali007 commented May 20, 2025

  • I have added tests that cover my changes.
  • If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change.
  • PR name follows conventional commits format: feat(instrumentation): ... or fix(instrumentation): ....
  • (If applicable) I have updated the documentation accordingly.

This PR intends to add support for MCP version >1.6.0


Important

Adds support for MCP version >1.6.0 by updating InstrumentedStreamReader and InstrumentedStreamWriter to handle SessionMessage and JSONRPCMessage.

  • Behavior:
    • Adds support for MCP version >1.6.0 in instrumentation.py.
    • Updates __aiter__() in InstrumentedStreamReader to handle SessionMessage and JSONRPCMessage.
    • Updates send() in InstrumentedStreamWriter to handle SessionMessage and JSONRPCMessage.
  • Imports:
    • Adds from mcp.shared.message import SessionMessage in instrumentation.py.

This description was created by Ellipsis for ff941cd. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to ff941cd in 1 minute and 38 seconds. Click for details.
  • Reviewed 38 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_ZMCsAewgwXEb6l8F

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

fali007 and others added 4 commits May 20, 2025 16:46
…umentation/mcp/instrumentation.py

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
…umentation/mcp/instrumentation.py

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@galkleinman
Copy link
Contributor

galkleinman commented May 20, 2025

Can you please use this decorator: https://github.com/traceloop/openllmetry/blob/1648905598915776956ef46a077c8fb941094662/packages/opentelemetry-semantic-conventions-ai/opentelemetry/semconv_ai/utils.py

In the instrumentation methods? So if there will be failures in the instrumentation it won't crash the user's app.

@fali007
Copy link
Contributor Author

fali007 commented May 20, 2025

Can you please use this decorator: https://github.com/traceloop/openllmetry/blob/1648905598915776956ef46a077c8fb941094662/packages/opentelemetry-semantic-conventions-ai/opentelemetry/semconv_ai/utils.py

In the instrumentation methods? So if there will be failures in the instrumentation it won't crash the user's app.

Made the change @galkleinman

@galkleinman
Copy link
Contributor

Can you please use this decorator: https://github.com/traceloop/openllmetry/blob/1648905598915776956ef46a077c8fb941094662/packages/opentelemetry-semantic-conventions-ai/opentelemetry/semconv_ai/utils.py
In the instrumentation methods? So if there will be failures in the instrumentation it won't crash the user's app.

Made the change @galkleinman

💪

tests are failing now tho :X

fali007 added 2 commits May 20, 2025 17:47
Signed-off-by: fali007 <felixpv007@gmail.com>
@nirga nirga changed the title feat(bug fix) : Added support for newer version of MCP fix(mcp): Added support for newer version of MCP May 20, 2025
@nirga nirga merged commit effe0e8 into traceloop:main May 20, 2025
9 checks passed
async def __aiter__(self) -> AsyncGenerator[Any, None]:
from mcp.types import JSONRPCMessage, JSONRPCRequest
from mcp.shared.message import SessionMessage
Copy link

Choose a reason for hiding this comment

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

It appears that the 1.6.0 version of MCP doesn't have a message module within the mcp.shared module. This will result in a ModuleNotFoundError: No module named 'mcp.shared.message', causing the instrumentation of MCP 1.6.0 to fail. Could you please fix this to make it compatible with mcp version 1.6.0?

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.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/traceloop/openllmetry/pull/2956

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy