From c5bfd92c1d39b8101b912e9c42e99cdf10b588ec Mon Sep 17 00:00:00 2001 From: caballeto Date: Wed, 10 Jun 2026 19:10:28 +0200 Subject: [PATCH] fix: keep run_mcp.py stderr to the JSON error contract under fastmcp 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pyproject.toml | 2 +- tests/run_mcp.py | 9 +++++++++ uv.lock | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 32b9318..2fff42e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dependencies = [ # `client.dependencies` (component-level track + alert sensitivity) # that the services/dependencies tool modules call directly. "devhelm>=1.3.0", - "fastmcp>=2.0.0", + "fastmcp>=3.2.3,<4", ] [project.urls] diff --git a/tests/run_mcp.py b/tests/run_mcp.py index 041105d..848cd44 100644 --- a/tests/run_mcp.py +++ b/tests/run_mcp.py @@ -71,6 +71,15 @@ def main() -> None: kwargs = extract_kwargs(args) kwargs["api_token"] = token + # The harness contract is "error JSON on stderr, nothing else" — the + # monorepo surface tests json.loads() the stream. fastmcp >= 3 logs + # tool-call exceptions to stderr as Rich tracebacks, which silently + # degraded every parsed error payload to a raw string. Kill all + # library logging before the server is imported. + import logging + + logging.disable(logging.CRITICAL) + import asyncio from devhelm_mcp.server import mcp # noqa: E402 diff --git a/uv.lock b/uv.lock index 270088d..8bb42ff 100644 --- a/uv.lock +++ b/uv.lock @@ -401,7 +401,7 @@ wheels = [ [[package]] name = "devhelm-mcp-server" -version = "1.1.0" +version = "1.2.0" source = { editable = "." } dependencies = [ { name = "devhelm" }, @@ -420,7 +420,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "devhelm", specifier = ">=1.3.0" }, - { name = "fastmcp", specifier = ">=2.0.0" }, + { name = "fastmcp", specifier = ">=3.2.3,<4" }, ] [package.metadata.requires-dev]