How to Configure Cline SSH MCP Server
You set up a cline ssh mcp server by adding the tool to the agent settings. You then point that local tool to a remote host and an SSH key. Many teams give the coding agent a standard user key on a test or prod box. If that host role has wide rights, the agent can run any shell command at will. How a cline ssh mcp server works Cline is an AI coding agent that runs inside your code editor. It uses the Model Context Protocol to talk to external tools. When you add an SSH tool, the editor starts
SSH Bastion Hosts / Jump Servers + Kubernetes API Server Access: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You set up a cline ssh mcp server by adding the tool to the agent settings. You then point that local tool to a remote host and an SSH key. Many teams give the coding agent a standard user key on a test or prod box. If that host role has wide rights, the agent can run any shell command at will.
How a cline ssh mcp server works
Cline is an AI coding agent that runs inside your code editor. It uses the Model Context Protocol to talk to external tools. When you add an SSH tool, the editor starts a small local process. This local process reads the host name, user name, and key path from a file.
When the agent needs to check a server, it sends a tool call to this process. The local tool opens an SSH session to the remote Linux host. It uses your local private key or an OpenSSH user cert to log in. OpenSSH certs hold a public key, an identity name, and a list of valid user names. A central key signs these certs so the remote host trusts them right away.
Once the login succeeds, the tool runs the shell command on the remote machine. The remote shell sends the text output back through the SSH tunnel. The local MCP process hands that output back to the AI agent. The agent reads the result and decides what step to take next.
How to set up keys and host roles
A safe setup starts with a dedicated Linux user on the remote host. Do not give the agent your personal admin account or root rights. Create a group with read rights to only the log folders the agent needs. Add the agent user to that group and block sudo rights in the host file.
Next, generate a fresh key pair or sign an OpenSSH cert for this user. When you sign a cert, always set a short time window so it expires soon. If you skip the time window, the cert stays valid forever by default. Store the private key on the local machine with strict file read rules.
Finally, register the SSH MCP server in the agent settings file. Give the server a clear name so the model knows when to pick it. Test the setup by asking the agent to check the system uptime or disk space. Check your host auth logs to confirm the right user name logged in.
SSH Bastion Hosts / Jump Servers + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native SSH setup solves and what it misses
Native SSH keys and Linux users solve the basic login problem well. They prove who is logging in to the box at the start of a session. Host groups also keep the agent out of root files if you set them up right. OpenSSH certs help you stop old keys from working after a set time.
Still, host login checks stop working once the SSH tunnel is open. The remote server does not inspect each command the AI agent sends in flight. If the Linux user can write to a folder, the agent can delete files there. If a log file holds user emails, phone numbers, or card numbers, the shell prints them.
The agent can also turn on auto-approve mode inside the code editor. When that happens, a bad prompt or model mistake runs right away on your server. Native SSH logs only show that a user logged in from an IP address. They do not record the exact commands the agent ran or the text it read. Teams need a way to check every command and mask emails or national IDs in results.
Check SSH commands and file transfers on the host
OpenSSH keys and certificates decide who can log into a Linux host. They do not check what a one-shot command or file transfer does once the session starts. With hoop.dev, you run an open-source SSH server with guardrails inline on the host. On every one-shot command or file transfer an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs, and hoop.dev data masking masks matched sensitive patterns in downloads and output. Interactive shells carry no guardrails because keystrokes have no statement boundary. Teams can turn interactive shells off and allow only commands and file tasks. The audit trail logs who connected and what was allowed or refused, without storing keystrokes or file bytes. See the source on GitHub.
Frequently asked questions
Can I use an SSH agent instead of a raw key file?
Yes, most local SSH tools can talk to the system SSH agent socket. This keeps the raw private key passphrase out of the plain text settings file. You still need to load the key into your local agent before you start work.
How do I stop the AI from running destructive shell commands?
Linux file permissions alone are hard to tune for every single shell flag. You can restrict the user shell or list allowed commands in the authorized keys file. For better control, pause risky commands for human review before they reach the host.
What happens if the remote command prints sensitive customer data?
Standard SSH sends all command output straight back to the local tool and the model. If a log contains phone numbers or card numbers, that raw text goes into the prompt. You must rewrite matched fields in results before the output reaches the coding agent.
Related guides
In this post