Date: 2026-02-09
This session implemented and iterated on the hot MCP runtime attach/detach feature set described in:
plan/hot-mcp.mdplan/hot-mcp-slices.md
A review document was written to:
plan/hot-mcp-impl-review.md
Implemented end-to-end runtime MCP server management across:
- core runtime (
MCPAggregator,MCPConnectionManager,McpAgent) - app wiring (
AgentApp,FastAgent) - TUI (
/mcp,/connect) - ACP slash commands (
/mcp list|connect|disconnect)
Also implemented auth unification for runtime URL connect:
/mcp connect ... --auth <token>now supported- URL auth/HF token behavior now reuses CLI URL parser path (
parse_server_urls+ HF auth header logic)
570e4fa2- Message:
Implement runtime MCP connect/disconnect across core, TUI, and ACP - Includes:
- runtime attach/detach models + APIs
- startup MCP load path routed through attach path
- TUI
/mcp+/connect - ACP
/mcp - command handlers + tests
- implementation review doc
After 570e4fa2, additional fixes were made but not committed yet:
- Scoped npm shorthand improvements for
/mcp connect(@scope/pkg->npx+ args) - Better already-attached messaging (suggest
--reconnect) - Removed earlier delay/retry behavior from aggregator attach path (by user request)
- Added runtime
/mcp connect --authsupport + shared CLI URL/HF auth handling - Reduced noisy network-failure output:
- suppress MCP SDK
Error in post_writertracebacks for streamable-http - dedupe repeated
MCP server ... offlineprints during outage
- suppress MCP SDK
You should inspect working tree and commit these follow-up changes.
src/fast_agent/mcp/mcp_aggregator.pysrc/fast_agent/mcp/mcp_connection_manager.pysrc/fast_agent/mcp/mcp_agent_client_session.pysrc/fast_agent/mcp/types.pysrc/fast_agent/mcp/interfaces.pysrc/fast_agent/agents/mcp_agent.py
src/fast_agent/core/agent_app.pysrc/fast_agent/core/fastagent.pysrc/fast_agent/acp/server/agent_acp_server.pysrc/fast_agent/acp/slash_commands.py
src/fast_agent/ui/command_payloads.pysrc/fast_agent/ui/enhanced_prompt.pysrc/fast_agent/ui/interactive_prompt.pysrc/fast_agent/commands/handlers/mcp_runtime.py
tests/unit/fast_agent/mcp/test_mcp_aggregator_runtime_attach.pytests/unit/fast_agent/core/test_agent_app_mcp_callbacks.pytests/unit/fast_agent/ui/test_parse_mcp_commands.pytests/unit/fast_agent/ui/test_agent_completer.pytests/unit/fast_agent/commands/test_mcp_runtime_handlers.pytests/unit/fast_agent/acp/test_slash_commands_mcp.py
plan/hot-mcp-impl-review.md- (this file)
handover.md
-
Startup uses attach path
- User explicitly requested startup MCP server loading to use same attach/detach routines.
- Implemented by routing
load_servers()throughattach_server(...).
-
Delay/retry on attach removed
- There was a brief retry/delay heuristic added for empty tool lists.
- User rejected this as cargo-cult; it was removed.
- Current behavior: no delay; rely on proper initialize + tool fetch.
-
Scoped npm shorthand support
/mcp connect @modelcontextprotocol/server-everythingnow treated as npx form.
-
Auth parity request
- User requested runtime TUI/ACP connect to share CLI auth/HF_TOKEN logic.
- Implemented via
parse_server_urlsreuse for URL mode.
-
Network sleep/wake failure handling
- User reported huge traceback spam (
Error in post_writer) + repeated offline lines after laptop sleep/network change. - Added logging filter for streamable-http post_writer noise.
- Added deduping for repeated offline notices.
- User reported huge traceback spam (
-
Stuck Ctrl+C in interactive session
- User could not break with Ctrl+C;
SIGQUIT(Ctrl+) worked. - No code change yet for this specific SIGINT robustness; follow-up recommended.
- User could not break with Ctrl+C;
Repeatedly ran:
uv run scripts/lint.py --fixuv run scripts/typecheck.py- targeted unit tests for changed areas
Known unrelated/environment-sensitive failures in full unit suite remain in this workspace:
tests/unit/core/test_prompt_templates.py::test_load_skills_for_context_handles_missing_directorytests/unit/fast_agent/session/test_session_manager.py::test_apply_session_window_appends_pinned_overflow
These were pre-existing and align with repo notes about environment/session ordering effects.
- Runtime
/mcp connectnow works in scenarios that previously failed. - User observed one session where Ctrl+C no longer interrupted; SIGQUIT terminated it.
- User wants robust behavior around long-lived remote MCP connections over sleep/wake.
-
Commit pending follow-up changes
- Check
git status - Commit post-
570e4fa2fixes as a new commit
- Check
-
Run focused regression checks
- hot MCP TUI commands (
/mcp,/connect,--auth) - ACP
/mcp ... - sleep/wake or temporary DNS failure behavior for streamable-http MCP server
- hot MCP TUI commands (
-
Optional hardening
- Improve SIGINT handling in interactive loop:
- first Ctrl+C -> graceful cancel
- second Ctrl+C within timeout -> forced exit
- Consider user-facing reconnect status line for network outages
- Improve SIGINT handling in interactive loop:
-
Operator e2e
- Ask operator to run e2e scenarios (as required by project workflow)
uv run scripts/lint.py --fixuv run scripts/typecheck.pyuv run pytest tests/unit/...- log checks:
tail -n 80 fastagent.jsonlrg -n "..." fastagent.jsonl