Skip to content

fix McpTransportContext.create() mutability issue and add tests - #1076

Merged
Kehrlann merged 1 commit into
modelcontextprotocol:mainfrom
iuliiasobolevska:transport-context-immutability
Aug 7, 2026
Merged

fix McpTransportContext.create() mutability issue and add tests#1076
Kehrlann merged 1 commit into
modelcontextprotocol:mainfrom
iuliiasobolevska:transport-context-immutability

Conversation

@iuliiasobolevska

@iuliiasobolevska iuliiasobolevska commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Fixes #1077.

How Has This Been Tested?

Add new tests that reproduce the issue.

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@iuliiasobolevska iuliiasobolevska changed the title add McpTransportContext mutation tests fix McpTransportContext.create() mutability issue and add tests Aug 1, 2026

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

Excellent point. Please fix the header.

@@ -0,0 +1,89 @@
/*
* Copyright 2024-2025 the original author or authors.

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.

Suggested change
* Copyright 2024-2025 the original author or authors.
* Copyright 2026-2026 the original author or authors.

@Kehrlann Kehrlann added this to the 2.0.1 milestone Aug 7, 2026
@Kehrlann Kehrlann added the enhancement New feature or request label Aug 7, 2026
@Kehrlann
Kehrlann force-pushed the transport-context-immutability branch 3 times, most recently from be94a10 to 434db32 Compare August 7, 2026 16:26
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
@Kehrlann
Kehrlann force-pushed the transport-context-immutability branch from 434db32 to 1e123c3 Compare August 7, 2026 16:29
@Kehrlann
Kehrlann self-requested a review August 7, 2026 16:35

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

Updated and ready to merge

@Kehrlann
Kehrlann merged commit 8ee8ccb into modelcontextprotocol:main Aug 7, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

McpTransportContext.create documents an unmodifiable context but stores the caller's map by reference

2 participants