MCP SDK missing causes unclear NameError at runtime
Cluster 30904 · hermes cli. Data as of
3 open items. Fix merged in #31450. Check it covers your case.
The short answer
- Known?
- Yes. 8 related items grouped here, 2 issues already closed.
- Fix event
- A fix was merged to main in PR #31450. Check it covers your case. No release data is tracked.
- Tracker
- The maintainers' tracker marks this
partially resolved, deciding PR #31450. That is separate from the fix event. - Still open
- 1 issue and 2 PRs.
Next step: read #31450, then check whether your report is one of the 1 still open.
Read #31450Pick up a Lab taskMultiple issues and fixes address a problem where missing MCP or related SDK packages produce confusing NameError exceptions instead of clear ImportError messages. The fixes aim to provide actionable error messages when the MCP SDK is not installed.
Open issues1
- Issue#31005Homebrew bottle 2026.5.16 missing 'mcp' and 'websockets' packages — MCP and browser tools fail at runtime
Open PRs2
Fixes on record
-
#31450 fix(mcp): raise ImportError instead of NameError when stdio SDK missing
files:
tests/tools/test_mcp_tool.py,tools/mcp_tool.pyShow the diff
-
tests/tools/test_mcp_tool.py@@ -1462,6 +1462,27 @@ async def _test(): asyncio.run(_test()) + def test_stdio_unavailable_raises_importerror_not_nameerror(self): + """Regression test for #30904. + + When the mcp SDK isn't installed, ``_run_stdio`` previously leaked a + bare ``NameError: name 'StdioServerParameters' is not defined``. The + gate now raises a clear ``ImportError`` with install instructions, + mirroring ``_run_http``'s behaviour when the HTTP transport is + unavailable. + """ + from tools.mcp_tool import MCPServerTask + + server = MCPServerTask("local") + config = {"command": "python3", "args": ["/tmp/echo.py"]} + + async def _test(): + with patch("tools.mcp_tool._MCP_AVAILABLE", False): + with pytest.raises(ImportError, match=r"mcp.*SDK"): + await server._run_stdio(config) + + asyncio.run(_test()) + def test_http_seeds_initial_protocol_header(self): from tools.mcp_tool import LATEST_PROTOCOL_VERSION, MCPServerTask -
tools/mcp_tool.py@@ -1255,6 +1255,15 @@ async def _wait_for_lifecycle_event(self) -> str: async def _run_stdio(self, config: dict): """Run the server using stdio transport.""" + if not _MCP_AVAILABLE: + raise ImportError( + f"MCP server '{self.name}' requires the 'mcp' Python SDK, but " + "it is not installed. Install with:\n" + " pip install 'hermes-agent[mcp]'\n" + "or (full install):\n" + " pip install 'hermes-agent[all]'" + ) + command = config.get("command") args = config.get("args", []) user_env = config.get("env")
-
2 PRs closed without merging
From the close comments: superseded by another PR 2
Closed issues · 2
How this cluster was grouped
-
Link evidence (
partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text. - Members outside that structural core may belong to a different underlying problem.
-
Pairwise link density
0.20: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36.1.00means every pair is linked.
Pick up a Lab task
Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.
Open the LabAt a glance
- Subsystem
- hermes cli
- Merged PRs
- #31450
- Closed issues
- 2
- Attempts
- 2 PRs closed without merging
- Fix link checked
- 24 May 2026