the-bastion-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
the-bastion-mcp
the-bastion-mcp is a Model Context Protocol (MCP) server. It lets an AI coding agent (for example Claude Code or Kilo Code) do two things on remote servers:
Run one-shot commands.
Copy single files to a server and from a server.
All access goes through The Bastion. The bastion authenticates, authorizes and records each action.
The MCP server has no allowlists, no deny lists and no read-only mode. The bastion decides which targets the agent can reach. The target hosts decide what the remote user can do.
How it works
The project has two parts:
The MCP server. It gives the tools to the agent. It has no Secure Shell (SSH) key.
Five backend commands. They do all checks, write the audit log and use the bastion key.
There are two deployment modes:
Mode | The backend commands run as | Use |
Split mode | A second operating system (OS) user, through | Production. The agent cannot read the bastion key |
Single-user mode | The current user | Development and tests only |
Related MCP server: rustscp-mcp
Tools
Tool | What it does |
| Shows the targets that the bastion account can reach, and the file transfer protocol ( |
| Runs one command on one target. Returns the exit code, stdout, stderr, the status and the bastion session ID |
| Copies one local file to a target, through the sftp support of the bastion |
| Copies one file from a target to a local file, through the sftp support of the bastion |
Each tool except list_hosts needs a reason. The backend writes the reason to the audit log.
Requirements
On the admin machine: Python 3.11 or later, and the OpenSSH
sshandsftpclients.A bastion account for the agent. the-bastion-mcp does not support accounts with multi-factor authentication (MFA).
What you configure
You configure two files.
Backend config
Path: ~/.config/the-bastion-mcp/backend.toml in the home directory of the user that runs the
backend commands. Template: backend.example.toml.
Setting | Value |
| Hostname or IP address of the bastion |
| SSH port of the bastion. Default: |
| The bastion account, for example |
| The key file of the bastion account. The key must have no passphrase. Mode |
| Path of the local audit log. Default: |
| Directory for the temporary files of the file transfers. Default: |
| Syslog socket. Default: |
The other settings have default values. The template describes them.
MCP config
Path: ~/.config/the-bastion-mcp/config.toml of the user that runs the agent, or the path in
THE_BASTION_MCP_CONFIG. Template: config.example.toml.
Setting | Value |
| The command that runs each backend command, for example |
All five commands are necessary. If one is missing or empty, the MCP server does not start.
Quick start (single-user mode)
Use this procedure for development and tests only. For split mode, use docs/setup.md.
Install the package:
python3 -m venv venv venv/bin/pip install -e .Copy the templates:
install -d -m 0700 ~/.config/the-bastion-mcp ~/.the-bastion-mcp ~/.the-bastion-mcp/transfer install -m 0600 backend.example.toml ~/.config/the-bastion-mcp/backend.toml install -m 0600 config.example.toml ~/.config/the-bastion-mcp/config.tomlIn
backend.toml, set[bastion] host,port,userandidentity_file.For file transfer, the bastion account needs the
sftpprotocol access on the target. See docs/setup.md, section 1.In
config.toml, replace/opt/the-bastion-mcp/venv/bin/python3in the five[backend]commands with the absolute path ofvenv/bin/python3.Connect to the bastion one time, to add its host key to
~/.ssh/known_hosts:ssh -i <identity_file> -o IdentitiesOnly=yes <user>@<host> -- --osh infoDo a check of the setup:
venv/bin/the-bastion-mcp check --probeRegister
venv/bin/the-bastion-mcp servein your MCP client. See docs/setup.md, section 4.3.
Build and install
To build the wheel and the source archive in dist/:
make dev # one time: creates venv/ and installs the development tools
make buildTo install the wheel on the admin machine:
python3 -m venv /opt/the-bastion-mcp/venv
/opt/the-bastion-mcp/venv/bin/pip install -c constraints.txt dist/the_bastion_mcp-<version>-py3-none-any.whlconstraints.txt holds the exact dependency versions. Run make lock on the build machine to
write it. Install it together with the wheel. Keep it in the repository.
To remove the build artifacts and the caches, run make clean. To also remove venv/, run
make distclean.
Development
Run make help to see all targets.
Target | What it does |
| Creates |
| Runs the unit tests. They use a fake ssh. For the file transfer tests, they also use the local |
| Runs the unit tests without the tests that wait for real timeouts |
| Checks the code style |
| Corrects the code style |
| Runs the integration tests against a real bastion |
To prepare the integration tests:
Copy
tests/integration/integration.example.tomltotests/integration/integration.toml.Set your bastion and target in
integration.toml. Git ignores this file.Run
make test-integration.
For all settings and for the split-mode tests, see docs/integration_tests.md.
License
The Apache License 2.0 applies to this project. See LICENSE.txt.
This server cannot be deployed
Maintenance
Related MCP Connectors
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Manage remote servers, SSH terminals, files, databases and proxies with scoped access and approvals.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to securely execute commands on remote hosts via SSH and SFTP, with persistent shells, file transfers, screenshots, and an audit log.5MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI tools to securely inspect remote servers by listing directories, reading configuration files, and performing authorized actions through permission controls, human-in-the-loop approvals, and audit logging. It acts as a bastion that never reveals raw SSH credentials or root passwords to the model.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to remotely execute shell commands and transfer files on SSH hosts, including jump-host tunneling, background tasks, resumable transfers, and optional approval of destructive commands, while SSH credentials remain in the local process. It runs over stdio or a streamable HTTP daemon and supports auditing, allow/deny lists, and multiple authentication methods.ISC
- AlicenseAqualityAmaintenanceEnables AI agents to inspect and manage remote hosts over SSH with tiered blast-radius containment that classifies and blocks destructive commands, plus forensic post-flight assertions that verify ports, processes, files, and HTTP health. It also provides long-running background task envelopes and atomic SFTP file editing with automatic backups, unified diffs, and one-click rollback.12MIT