Connecting Claude to Production SSH Servers Safely: Designing a 16-Tool Read-Only-by-Default MCP Server in Rust
Giving an AI agent direct shell access to production Linux servers is terrifying—and for good reason. One hallucinated rm -rf or accidental service restart can take down a cluster. When I built the built-in Model Contex
Giving an AI agent direct shell access to production Linux servers is terrifying—and for good reason. One hallucinated rm -rf or accidental service restart can take down a cluster.
When I built the built-in Model Context Protocol (MCP) server for Gimotty (a Rust-based Windows SSH/SFTP workspace), the #1 design goal was: let Claude and other MCP clients inspect servers and assist during incidents without ever risking blind destructive execution.
Here is the 4-layer permission and audit architecture I ended up with.
1. 16 Focused stdio MCP Tools (Not a Single Unrestricted Shell)
Instead of exposing one raw run_shell tool, Gimotty splits capabilities into 16 narrowly scoped stdio JSON-RPC tools across four groups:
| Group | Tools |
|---|---|
| Discovery |
sessions_list, sessions_get, diagnostics
|
| Terminal |
terminal_open, terminal_list, terminal_read, terminal_wait, terminal_write, terminal_resize, terminal_close
|
| Command | command_execute |
| Files (SFTP) |
file_list, file_read, file_write, file_download, file_upload
|
A subtle detail that drastically reduces token waste: terminal_wait accepts a regex or prompt pattern, so the agent does not have to poll terminal_read in a tight loop while waiting for a command or build to finish.
2. Read-Only by Default — Escalation Only via Startup Flags
Permissions cannot be escalated by the LLM or prompt injection at runtime. They are controlled strictly by server startup flags:
# Default: read-only inspection only (cannot connect, write, or execute)
gimotty.exe mcp-config
# Explicitly opt in to SSH connect + command/file write
gimotty.exe mcp-config --allow-connect --allow-write
# Explicitly opt in to local shell / arbitrary local paths
gimotty.exe mcp-config --allow-connect --allow-write --allow-local
Without --allow-local, file transfer tools are sandboxed inside Gimotty's dedicated transfers/ directory so an agent cannot read arbitrary files from your Windows workstation.
3. Per-Folder Exposure Rules (hidden / read-only)
Most ops engineers keep Dev, Staging, and Production sessions in the same workspace. Gimotty lets you set MCP exposure per folder or per session:
-
hidden: TheProductionfolder does not even appear insessions_list—the AI never knows those hosts exist. -
read-only: The AI can inspect logs and disk usage onStaging, butterminal_write,command_execute, andfile_writeare rejected at the MCP server layer.
And for credentials: the encrypted password vault (Argon2id + XChaCha20-Poly1305) is never readable by MCP or the built-in AI assistant.
4. Full Audit Logs + Human-in-the-Loop GUI Approval
- Every MCP call (timestamp, client name, target session, tool, and outcome) is written to an append-only Audit Log viewable in both the GUI and
gimotty audit. - Inside the desktop workspace itself, the tab-aware AI assistant uses the same tool layer with explicit human approval before executing any state-changing command—and triggers a second confirmation with a reason for high-risk operations (
rm -rf,sudo, service restarts). - It also works seamlessly on sessions launched from existing Enterprise Server Access Control (PAM / Bastion) portals via drop-in PuTTY (
-ssh,-load) and SecureCRT (/SSH2) CLI compatibility.
Try It Yourself
If you want to connect Claude Desktop or Claude Code to your Windows SSH sessions with proper guardrails—without paying a monthly SSH subscription—Gimotty offers a 15-day full free trial (one-time purchase on Microsoft Store):
- Docs & MCP Setup Guide: https://gimotty.irumx.app/en
- Microsoft Store (15-Day Free Trial): https://apps.microsoft.com/detail/9P229B0D3840?hl=en-us&gl=US
How are you sandboxing MCP tools when connecting LLMs to infrastructure? Curious to hear what patterns are working in your team!
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.