hermes - 💡(How to fix) Fix mcp add / mcp test raise NameError when mcp package not installed

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

hermes mcp add and hermes mcp test both raise NameError: name 'StdioServerParameters' is not defined when the mcp Python package is not installed in the pipx venv.

Error Message

A clear error message: mcp package not installed — run pipx inject hermes-agent mcp to enable MCP support.

Root Cause

tools/mcp_tool.py imports StdioServerParameters inside a module-level try/except ImportError block. When the mcp package is absent, the import fails silently (_MCP_AVAILABLE stays False) and StdioServerParameters is never bound. The mcp test and mcp add code paths then reference StdioServerParameters directly without first checking _MCP_AVAILABLE, producing a NameError instead of an actionable message.

Fix Action

Fix

Either:

  1. Add mcp as an optional extras dependency (hermes-agent[mcp]) and document pipx inject hermes-agent mcp for manual installs, or
  2. Guard all references to StdioServerParameters (and the other lazy-imported names) behind if not _MCP_AVAILABLE: raise RuntimeError("mcp package required — run: pipx inject hermes-agent mcp")

Code Example

# Fresh pipx install (mcp not in Requires-Dist, so not auto-installed)
pipx install hermes-agent

# Add an mcp server to config.yaml manually or via add command
hermes mcp add   # or: hermes mcp test <server-name>

---

Connection failed (7925ms): name 'StdioServerParameters' is not defined

---

pipx inject hermes-agent mcp
RAW_BUFFERClick to expand / collapse

Summary

hermes mcp add and hermes mcp test both raise NameError: name 'StdioServerParameters' is not defined when the mcp Python package is not installed in the pipx venv.

Environment

  • Hermes Agent: v0.14.0 (2026.5.16)
  • Python: 3.14.4
  • Platform: macOS (darwin 25.5.0, arm64)
  • Install method: pipx

Steps to reproduce

# Fresh pipx install (mcp not in Requires-Dist, so not auto-installed)
pipx install hermes-agent

# Add an mcp server to config.yaml manually or via add command
hermes mcp add   # or: hermes mcp test <server-name>

Expected behavior

A clear error message: mcp package not installed — run pipx inject hermes-agent mcp to enable MCP support.

Actual behavior

✗ Connection failed (7925ms): name 'StdioServerParameters' is not defined

Root cause

tools/mcp_tool.py imports StdioServerParameters inside a module-level try/except ImportError block. When the mcp package is absent, the import fails silently (_MCP_AVAILABLE stays False) and StdioServerParameters is never bound. The mcp test and mcp add code paths then reference StdioServerParameters directly without first checking _MCP_AVAILABLE, producing a NameError instead of an actionable message.

Fix

Either:

  1. Add mcp as an optional extras dependency (hermes-agent[mcp]) and document pipx inject hermes-agent mcp for manual installs, or
  2. Guard all references to StdioServerParameters (and the other lazy-imported names) behind if not _MCP_AVAILABLE: raise RuntimeError("mcp package required — run: pipx inject hermes-agent mcp")

Workaround (confirmed working)

pipx inject hermes-agent mcp

After inject, hermes mcp test <server> connects and discovers tools correctly (tested with a local stdio MCP server, 30 tools discovered in ~1s).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

A clear error message: mcp package not installed — run pipx inject hermes-agent mcp to enable MCP support.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING