fix: keep run_mcp.py stderr to the JSON error contract under fastmcp 3#37
Merged
Conversation
The SDK 1.3.0 re-lock floated fastmcp from 2.x to 3.2.3 (constraint had no upper bound), and fastmcp 3 logs tool-call exceptions to stderr as Rich tracebacks. The monorepo surface harness json.loads()'s stderr on non-zero exit, so every parsed error payload silently degraded to a raw string and test_get_nonexistent failed with AttributeError. - run_mcp.py: disable all library logging before the server import — the harness owns the "error JSON on stderr, nothing else" contract - pyproject: pin fastmcp>=3.2.3,<4 so a major can't float in on an unrelated re-lock again Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
fastmcp2.x → 3.2.3 because the constraint (>=2.0.0) had no upper bound. fastmcp 3 logs tool-call exceptions to stderr as Rich tracebacks, polluting the test harness's "error JSON on stderr" contract — the monorepo surface testsjson.loads()stderr on non-zero exit, so error payloads degraded to raw strings (test_get_nonexistentfailed withAttributeError: 'str' object has no attribute 'get').tests/run_mcp.py:logging.disable(logging.CRITICAL)before the server import; the harness now enforces its stderr contract regardless of library logging behavior.pyproject.toml: pinfastmcp>=3.2.3,<4so the next major can't slide in on an unrelated re-lock.run_mcp.pyis a repo-only harness file (not in the published package), so merging this fixes the monorepo surface-integration + nightly flows immediately — no release needed.Test plan
{"error": "ApiError (...)", ...}), no tracebacksurfaces/mcp_server/test_status_pages.pyagainst the mono test stack: 25/25 pass, includingtest_get_nonexistentMade with Cursor