Skip to content

Conversation

@CocaineCong
Copy link
Contributor

@CocaineCong CocaineCong commented Dec 27, 2025

Description

Fixes #658

  1. add version 2025-11-25 in LATEST_PROTOCOL_VERSION
  2. update README.md
  3. add unit test for Version Negotiation Tests

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • MCP spec compatibility implementation
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Tests only (no functional changes)
  • Other (please describe):

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the documentation accordingly

MCP Spec Compliance

  • This PR implements a feature defined in the MCP specification
  • Link to relevant spec section: Link text
  • Implementation follows the specification exactly

Additional Information

Summary by CodeRabbit

  • New Features

    • Updated to MCP protocol version 2025-11-25 with backward compatibility for versions 2025-06-18, 2025-03-26, and 2024-11-05.
    • Expanded server capabilities documentation.
  • Tests

    • Added comprehensive test coverage for protocol version negotiation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2025

Walkthrough

Updates MCP protocol version from 2025-06-18 to 2025-11-25 while maintaining backward compatibility with previous versions. Includes documentation updates in README, version constant changes in mcp/types.go, and comprehensive test coverage for version negotiation scenarios.

Changes

Cohort / File(s) Summary
Protocol Version Constants
mcp/types.go
Updated LATEST_PROTOCOL_VERSION constant to "2025-11-25"; expanded ValidProtocolVersions array to include "2025-06-18" alongside existing supported versions (2025-03-26, 2024-11-05).
Documentation & README
README.md
Added implementation note in "What is MCP?" section specifying protocol version 2025-11-25 with backward compatibility for 2025-06-18, 2025-03-26, and 2024-11-05. Appended "And more!" bullet to capabilities list.
Version Negotiation Tests
server/version_test.go
Added new test file with TestMCPServer_VersionNegotiation_Explicit covering multiple negotiation scenarios: latest version, previous versions, unsupported versions (fallback to latest), and default behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

documentation

Suggested reviewers

  • ezynda3
  • pottekkat
  • robert-jackson-glean

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Linked Issues check ❓ Inconclusive The PR addresses core requirements from #658: updated LATEST_PROTOCOL_VERSION to 2025-11-25, added it to ValidProtocolVersions with backward compatibility, updated README, and added version negotiation tests. HTTP transport defaults and changelog updates were not addressed. Consider whether HTTP transport default version (currently 2025-03-26) should be updated and document changelog/release notes as outlined in issue #658.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: adding version 2025-11-25 and unit tests for version negotiation, which matches the PR's primary objectives.
Description check ✅ Passed The PR description follows the template structure with issue reference, type of change selection, checklist completion, and MCP spec compliance section, though spec link is not filled in.
Out of Scope Changes check ✅ Passed All changes in the PR directly relate to the version update objectives: protocol version constant updates, README documentation, and version negotiation tests align with issue #658 requirements.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
server/version_test.go (1)

82-88: Consider using require for type assertions to prevent cascade failures.

If the type assertion on line 82 or 85 fails, assert.True will log the failure but continue execution, causing a panic when accessing resp.Result or initResult.ProtocolVersion. Using require.True would stop the test immediately on failure.

🔎 Proposed fix
+	"github.com/stretchr/testify/require"
...
-			resp, ok := response.(mcp.JSONRPCResponse)
-			assert.True(t, ok)
+			resp, ok := response.(mcp.JSONRPCResponse)
+			require.True(t, ok, "expected JSONRPCResponse type")

-			initResult, ok := resp.Result.(mcp.InitializeResult)
-			assert.True(t, ok)
+			initResult, ok := resp.Result.(mcp.InitializeResult)
+			require.True(t, ok, "expected InitializeResult type")
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 498341a and e818a00.

📒 Files selected for processing (3)
  • README.md
  • mcp/types.go
  • server/version_test.go
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Order imports: standard library first, then third-party, then local packages (goimports enforces this)
Follow Go naming conventions: exported identifiers in PascalCase; unexported in camelCase; acronyms uppercase (HTTP, JSON, MCP)
Error handling: return sentinel errors, wrap with fmt.Errorf("context: %w", err), and check with errors.Is/As
Prefer explicit types and strongly-typed structs; avoid using any except where protocol flexibility is required (e.g., Arguments any)
All exported types and functions must have GoDoc comments starting with the identifier name; avoid inline comments unless necessary
Functions that are handlers or long-running must accept context.Context as the first parameter
Ensure thread safety for shared state using sync.Mutex and document thread-safety requirements in comments
For JSON: use json struct tags with omitempty for optional fields; use json.RawMessage for flexible/deferred parsing

Files:

  • server/version_test.go
  • mcp/types.go
**/*_test.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*_test.go: Testing: use testify/assert and testify/require
Write table-driven tests using a tests := []struct{ name, ... } pattern
Go test files must end with _test.go

Files:

  • server/version_test.go
🧠 Learnings (3)
📚 Learning: 2025-06-30T07:13:17.052Z
Learnt from: ezynda3
Repo: mark3labs/mcp-go PR: 461
File: server/sampling.go:22-26
Timestamp: 2025-06-30T07:13:17.052Z
Learning: In the mark3labs/mcp-go project, the MCPServer.capabilities field is a struct value (serverCapabilities), not a pointer, so it cannot be nil and doesn't require nil checking. Only pointer fields within the capabilities struct should be checked for nil.

Applied to files:

  • server/version_test.go
  • README.md
📚 Learning: 2025-04-21T21:26:32.945Z
Learnt from: octo
Repo: mark3labs/mcp-go PR: 149
File: mcptest/mcptest.go:0-0
Timestamp: 2025-04-21T21:26:32.945Z
Learning: In the mcptest package, prefer returning errors from helper functions rather than calling t.Fatalf() directly, giving callers flexibility in how to handle errors.

Applied to files:

  • server/version_test.go
📚 Learning: 2025-03-04T07:00:57.111Z
Learnt from: xinwo
Repo: mark3labs/mcp-go PR: 35
File: mcp/tools.go:0-0
Timestamp: 2025-03-04T07:00:57.111Z
Learning: The Tool struct in the mark3labs/mcp-go project should handle both InputSchema and RawInputSchema consistently between MarshalJSON and UnmarshalJSON methods, even though the tools response from MCP server typically doesn't contain rawInputSchema.

Applied to files:

  • README.md
🧬 Code graph analysis (1)
server/version_test.go (1)
mcp/types.go (10)
  • Implementation (581-587)
  • ClientCapabilities (509-523)
  • JSONRPCRequest (359-364)
  • JSONRPC_VERSION (146-146)
  • NewRequestId (294-296)
  • Request (203-206)
  • Params (212-212)
  • JSONRPCResponse (373-377)
  • Result (281-285)
  • InitializeResult (484-498)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (5)
mcp/types.go (2)

135-143: LGTM! Protocol version update aligns with PR objectives.

The version constant update to "2025-11-25" and the explicit listing of "2025-06-18" in ValidProtocolVersions correctly maintains backward compatibility with all four supported versions as documented.


1370-1375: Struct field ordering is consistent.

The reordering of Header and Params fields maintains consistency across task-related request types. Since Header has json:"-", there's no serialization impact.

server/version_test.go (2)

1-11: LGTM! Good test structure following coding guidelines.

The test file follows Go conventions with table-driven tests and uses testify/assert as specified in the coding guidelines.


44-48: No action needed. The test correctly reflects the server's empty version default behavior. The protocolVersion() function in server/server.go (lines 794-808) explicitly defaults empty clientVersion to "2025-03-26" per the MCP specification requirement for backward compatibility. The test's inline comment already explains this behavior adequately.

README.md (1)

201-207: LGTM! Documentation accurately reflects the version changes.

The README correctly documents protocol version 2025-11-25 with backward compatibility for 2025-06-18, 2025-03-26, and 2024-11-05, matching the ValidProtocolVersions in mcp/types.go.

@ezynda3 ezynda3 merged commit d9be117 into mark3labs:main Jan 5, 2026
4 checks passed
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.

Update protocol version to 2025-11-25 and ensure backward compatibility

2 participants