How to Configure n8n SSH MCP Server
To set up an n8n ssh mcp server, link an MCP tool to your agent. Then give that tool a valid SSH key or certificate for your target host. Engineering teams build this setup so chat models can check servers and fix bugs. Yet giving an agent a broad Linux user role creates big risks in production. A model can run bad shell commands or read private files by mistake. How an n8n ssh mcp server works in practice In n8n, the AI Agent node pairs a chat model with one or more tools. You must attach at
SSH Bastion Hosts / Jump Servers + Kubernetes API Server Access: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
To set up an n8n ssh mcp server, link an MCP tool to your agent. Then give that tool a valid SSH key or certificate for your target host. Engineering teams build this setup so chat models can check servers and fix bugs. Yet giving an agent a broad Linux user role creates big risks in production. A model can run bad shell commands or read private files by mistake.
How an n8n ssh mcp server works in practice
In n8n, the AI Agent node pairs a chat model with one or more tools. You must attach at least one tool sub-node to the AI Agent node. The agent then decides which tools to call to finish a task. Starting in n8n 1.82.0, every AI Agent node works as a Tools Agent. Node version 1 and the old agent type setting go away in n8n 3.0.
Along with built-in nodes, n8n offers a registry of MCP servers for agents. You can also attach a Call n8n Workflow Tool or a Custom Code Tool. When you link an SSH MCP server, the agent sends shell tasks to it. The MCP server opens an SSH session to the Linux host and runs them. Then it sends the command output back to the n8n workflow.
To log in, the SSH MCP server needs a key or an OpenSSH certificate. OpenSSH added certificate login for users and hosts in version 5.4. An OpenSSH certificate uses a much simpler format than X.509 certificates. A Certification Authority key signs the user public key to make the certificate. The signed file holds identity info, user or host names, and login options.
Why native SSH setup leaves a runtime command gap
Using OpenSSH certificates solves key sprawl when you set up automated agent workflows. You do not need to copy static public keys to every remote host. Instead, the target host trusts the Certification Authority key that signed the user certificate. You can also set the key identity and list allowed user principals during signing. This native setup controls which host the n8n agent can log into.
Still, SSH login rules only check who can start a session on the box. Once the session starts, the agent gets every right held by that Linux user. The SSH daemon does not check if each shell command is safe to run. A model might try to delete logs, stop a web app, or change permissions. Native Linux user roles cannot pause one risky command while allowing safe reads.
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.
Static command rules inside SSH keys are also hard to manage for AI agents. If you lock a key to one fixed script, the agent loses its value. The agent needs to run varied check commands based on what it finds. If you allow a full shell instead, any prompt error can break the host.
What happens to sensitive data in shell output
There is also a data risk when shell results return to the chat model. Server logs and app files often hold emails, phone numbers, or card numbers. When the SSH MCP server reads a log file, it grabs all raw text. That text goes straight back to the n8n AI Agent node and the model. Native SSH tools do not rewrite matched fields like national IDs in results.
Standard Linux logs also fall short when multiple workflows share one automation account. The host log shows that the shared bot user logged in at a time. It does not tie each shell command back to the person who triggered n8n. Teams need clear command checks and data controls before running an agent in production.
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 on the host. It checks callers with OpenSSH certificates and works with ssh, sftp, scp, and rsync clients.
When a caller runs a one-shot command or moves a file, hoop.dev guardrails check the command or path before it runs. Then 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
How does the n8n AI Agent node run SSH commands?
You attach an MCP server tool or workflow tool to the AI Agent node. The chat model picks that tool and sends the command to the remote host.
Can OpenSSH certificates replace static keys for n8n agents?
Yes, OpenSSH 5.4 and later support user certificates signed by a Certification Authority key. The certificate stores the public key, identity info, allowed user names, and login options.
Why are standard Linux accounts risky for AI agent SSH sessions?
Linux accounts grant the same broad rights for every command in an open session. They cannot require human approval for one risky command or mask emails in output.
Related guides
In this post