Skip to content

fix: keep run_mcp.py stderr to the JSON error contract under fastmcp 3#37

Merged
caballeto merged 1 commit into
mainfrom
fix/test-harness-stderr-contract
Jun 10, 2026
Merged

fix: keep run_mcp.py stderr to the JSON error contract under fastmcp 3#37
caballeto merged 1 commit into
mainfrom
fix/test-harness-stderr-contract

Conversation

@caballeto

Copy link
Copy Markdown
Member

Summary

  • The devhelm SDK 1.3.0 re-lock (223fa24) floated fastmcp 2.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 tests json.loads() stderr on non-zero exit, so error payloads degraded to raw strings (test_get_nonexistent failed with AttributeError: '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: pin fastmcp>=3.2.3,<4 so the next major can't slide in on an unrelated re-lock.

run_mcp.py is 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

  • Manual harness invocation: stderr is pure JSON ({"error": "ApiError (...)", ...}), no traceback
  • surfaces/mcp_server/test_status_pages.py against the mono test stack: 25/25 pass, including test_get_nonexistent

Made with Cursor

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>
@caballeto caballeto merged commit eefd67d into main Jun 10, 2026
4 checks passed
@caballeto caballeto deleted the fix/test-harness-stderr-contract branch June 10, 2026 17:11
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.

1 participant