[REF] mcp: move to 2.x - #195
Merged
Merged
Conversation
The pin has been at <2.0.0 since 2.0.0 removed the decorators every server here was built on. Servers now use the ergonomic API, which is FastMCP on 1.x and MCPServer on 2.x and identical for this usage, so both majors run the same code and the version is chosen in pyproject alone. ms365 keeps _call_tool_impl as its dispatch, so no tool logic moved and the existing tests still cover it; the eighteen schemas are now derived from typed wrappers instead of hand-written JSON. Wrappers omit arguments left unset so the defaults inside the implementation still apply. Surface verified against the live server before and after: same eighteen names, descriptions, required arguments and per-argument descriptions, zero diffs. The stdio round-trip test passes on 2.1.1 — the case that broke last time.
Tool calls raised AttributeError on mcp 2.x because the gateway read isError off the result object, which 2.0 renamed to is_error. Listing was already fixed; calling was not, so servers connected and then failed on every call. The reads now go through a helper that resolves a field by its protocol alias, which the spec fixes and both majors keep, rather than by attribute. The round-trip test called the session directly and so passed while the wrapper around it was broken — the exact blind spot it existed to remove. It now also routes a call through the gateway, and that case fails without this fix.
mcp-google-sheets imports mcp.server.fastmcp, which mcp 2.x removed, and no release supports 2.x — the newest predates it. Sharing the application's site-packages meant our SDK version decided a third-party server's, and it stopped starting the moment we moved. It runs as its own process, so the image now builds it a private virtualenv holding mcp 1.x. The provider points at that binary and falls back to PATH where the venv is absent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #190.
mcphas been pinned below 2.0.0 since that release took every stdio serverdown. This moves to 2.x and unpins.
How the servers move
The ergonomic server API is
FastMCPon mcp 1.x andMCPServeron 2.x, and thetwo are identical for the way these files use them — same
@toolparameters,same
run_stdio_async, same emitted schema, checked by running one file underboth. Importing whichever is present means the same code runs on either major
and the version is chosen in
pyprojectalone, so trying 2.x cost one line andwould have rolled back in one line.
ms365keeps_call_tool_implas its dispatch, so no Graph logic moved and theexisting 53 tests still cover it. Its eighteen schemas are now derived from typed
wrappers rather than hand-written JSON, and the wrappers omit arguments left
unset so the defaults inside the implementation still apply.
Two things this turned up
isErroroff the result object, which 2.0 renamed the sameway it renamed
inputSchema. Servers connected and then failed on every calluntil the circuit breaker opened. Both reads now resolve fields by their
protocol alias, which the spec fixes and both majors keep.
mcp-google-sheetsimportsmcp.server.fastmcpand has no 2.x-compatiblerelease — the newest predates 2.0. It is a separate process, but it shared the
application's site-packages, so our SDK version decided a third-party server's.
The image now builds it a private virtualenv holding mcp 1.x.
The round-trip test had the blind spot it was built to remove
It called the session directly, so it passed while the gateway's own wrapper was
broken. It now also routes a call through
call_tool; that case fails withoutthe
isErrorfix and passes with it.Verified
required arguments and per-argument descriptions — zero diffs.
google-sheetsstarts again.
before the move.