Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: reload SSH server config when files change#40

Merged
bvisible merged 1 commit into
bvisible:mainfrom
EnjoySR:config-hot-reload
Jun 9, 2026
Merged

feat: reload SSH server config when files change#40
bvisible merged 1 commit into
bvisible:mainfrom
EnjoySR:config-hot-reload

Conversation

@EnjoySR

@EnjoySR EnjoySR commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds lazy hot reload for file-backed SSH server configuration.

The MCP server now reloads server config when the TOML config or .env file changes, so tools like
ssh_list_servers can see newly added or updated servers without restarting the MCP process.

Details

  • Adds ServerConfigManager to track TOML and .env file signatures.
  • Reloads server config only when file metadata changes.
  • Keeps the previous valid in-memory config if reload fails.
  • Parses .env without permanently mutating process.env.
  • Preserves real process environment variables as the highest-priority source.
  • Updates policy/audit helpers to read the current reloaded server config.

Testing

  • npm test
  • node tests/test-server-config-manager.js
  • Manual MCP verification: modified TOML while the MCP process was running; second ssh_list_servers call returned the newly added server.

@bvisible bvisible merged commit 97696bc into bvisible:main Jun 9, 2026
5 checks passed
bvisible added a commit that referenced this pull request Jun 9, 2026
…40)

- Add tests/test-lifecycle.js: black-box teardown tests asserting the server
  exits cleanly on stdin EOF, SIGTERM, SIGINT and overlapping signals (regression
  guard for the orphan-process bug).
- Extend test-server-config-manager.js: laziness (no reload without change),
  reload-failure keeps last valid config + recovery, deleted-file robustness.
- Wire test:lifecycle into the npm test chain.
bvisible added a commit that referenced this pull request Jun 9, 2026
- feat: live SSH config hot reload (#40, @EnjoySR)
- fix: exit on stdin EOF / SIGTERM so the stdio server isn't orphaned (#41, @LegendaryGatz)
- test: new lifecycle suite + extended hot-reload edge cases
@bvisible

bvisible commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Merged and shipped in v3.6.0 🎉 Thanks @EnjoySR — really nice work, especially the fail-safe (keeping the last known-good config when a reload throws) and reading .env without mutating process.env.

Because the sync→async conversion touches the security path, I verified it end-to-end before releasing:

  • Hot reload (real MCP session): ssh_list_servers[alpha], edited the TOML live → [alpha, beta], no restart. ✅
  • Policy still enforced after the async change: with a readonly server, rm -rf is denied and ls passes through; with restricted, a non-listed command is denied and an allow-listed one passes. 4/4. ✅
  • process.env semantics: a server defined only in the real environment is still loaded, and real env vars keep priority over file values. ✅

I extended tests/test-server-config-manager.js from 4 to 9 checks (laziness / no-reload-without-change, reload-failure-keeps-last-valid-config + recovery, deleted-file robustness).

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.

2 participants