Skip to main content

Secure SSH gateway for AI assistants โ€” MCP server with connection pooling, session isolation, and command safety

Project description

๐Ÿš€ Shuttle

Secure SSH gateway for AI assistants

CI codecov PyPI Python License

Shuttle lets AI assistants (Claude Code, Cursor, etc.) securely execute commands on your remote SSH servers โ€” with connection pooling, session isolation, command safety rules, and a web audit panel.

Getting Started ยท MCP Tools ยท Web Panel ยท Security Rules ยท ไธญๆ–‡ๆ–‡ๆกฃ


Why Shuttle?

When AI coding assistants need to operate remote servers (run tests on GPU machines, deploy to staging, check logs), they need a secure bridge. Shuttle provides:

  • ๐Ÿ” 4-Level Command Security โ€” Block dangerous commands, require confirmation for risky ones, warn on installs, allow the rest
  • ๐Ÿ”„ Connection Pooling โ€” Reuse SSH connections across commands, no repeated handshakes
  • ๐Ÿ“ฆ Session Isolation โ€” Each AI conversation gets its own working directory context
  • ๐ŸŒ Web Audit Panel โ€” See every command the AI ran, per node, with full stdout/stderr
  • ๐Ÿ›ก๏ธ Per-Node Rules โ€” Different security policies for prod vs dev servers
  • โšก Jump Host Support โ€” Connect through bastion/jump servers

Getting Started

1. Install

# Via uvx (recommended)
uvx shuttle-mcp

# Or pip
pip install shuttle-mcp

2. Add your first node

shuttle node add
# Follow the prompts: name, host, username, password/key

3. Connect to your AI assistant

Claude Code / Cursor (stdio mode):

// .mcp.json
{
  "mcpServers": {
    "shuttle": {
      "command": "uvx",
      "args": ["shuttle-mcp"]
    }
  }
}

Service mode (with Web UI):

# Start the service
shuttle serve

# Then configure your AI client with the URL
// .mcp.json
{
  "mcpServers": {
    "shuttle": {
      "url": "http://localhost:9876/mcp/"
    }
  }
}

That's it. Your AI assistant can now execute commands on your remote servers.

Two Running Modes

Mode Command MCP Transport Web UI Use Case
CLI shuttle stdio โŒ Quick use, AI client manages lifecycle
Service shuttle serve streamable-http โœ… http://localhost:9876 Audit logs, manage rules, cloud deploy

Both modes share the same SQLite database โ€” commands logged in CLI mode are visible in the Web UI when you switch to service mode.

MCP Tools

AI assistants get these tools automatically:

Tool Description
ssh_execute Run a command on a remote node
ssh_upload Upload a file via SFTP
ssh_download Download a file via SFTP
ssh_list_nodes List all configured nodes
ssh_add_node Add a new SSH node
ssh_remove_node Remove a node
ssh_session_start Start a stateful session (preserves working directory)
ssh_session_end End a session
ssh_session_list List active sessions

Example conversation

You: Check the GPU usage on my training server
AI:  โ†’ ssh_execute(node="gpu-server", command="nvidia-smi")
AI:  Your GPU server has 7x A100-80GB, all idle at 0% utilization.

You: Start a training run
AI:  โ†’ ssh_session_start(node="gpu-server")
AI:  โ†’ ssh_execute(session_id="abc123", command="cd /workspace && python train.py")
AI:  Training started. Epoch 1/10...

Security Rules

Commands are evaluated against a 4-level security system:

Level Behavior Example
๐Ÿ”ด block Rejected immediately rm -rf /, mkfs, fork bomb
๐ŸŸก confirm Requires user confirmation sudo, rm -rf, shutdown
๐ŸŸ  warn Executes with warning logged apt install, pip install
๐ŸŸข allow Executes normally Everything else

Default rules are seeded on first startup. Customize via Web UI or directly in the database.

Per-Node Overrides

Different servers can have different rules:

Global: sudo .* โ†’ confirm
GPU Server: sudo .* โ†’ allow (trusted environment)
Prod Server: DROP TABLE โ†’ block (extra protection)

Web Panel

Start with shuttle serve, open http://localhost:9876:

  • Overview โ€” Node cards with status, quick stats
  • Activity โ€” Per-node command log (console-style, with stdout/stderr)
  • Security Rules โ€” Manage global defaults and per-node overrides
  • Settings โ€” Connection pool and cleanup configuration

The Web UI requires a bearer token (displayed when you run shuttle serve).

CLI Reference

# MCP Server
shuttle                      # Start MCP server (stdio mode)
shuttle serve                # Start service mode (MCP + Web)
shuttle serve --port 8080    # Custom port
shuttle serve --host 0.0.0.0 # Bind to all interfaces

# Node Management
shuttle node add             # Add node interactively
shuttle node list            # List all nodes
shuttle node test <name>     # Test SSH connection
shuttle node edit <name>     # Edit a node
shuttle node remove <name>   # Remove a node

# Configuration
shuttle config show          # Display current config

Configuration

All settings can be overridden with environment variables (prefix SHUTTLE_):

Variable Default Description
SHUTTLE_DB_URL sqlite:///~/.shuttle/shuttle.db Database URL
SHUTTLE_WEB_PORT 9876 Web panel port
SHUTTLE_POOL_MAX_TOTAL 50 Max total SSH connections
SHUTTLE_POOL_MAX_PER_NODE 5 Max connections per node
SHUTTLE_POOL_IDLE_TIMEOUT 300 Idle connection timeout (seconds)

Using PostgreSQL

SHUTTLE_DB_URL=postgresql+asyncpg://user:pass@host:5432/shuttle shuttle serve

Requires: pip install asyncpg

Development

# Clone and install
git clone https://github.com/enwaiax/shuttle.git
cd ssh-mcp
uv sync

# Run tests
uv run pytest tests/ -v

# Lint
uv run ruff check src/ tests/

# Frontend dev (hot reload)
cd web && npm install && npm run dev
# Backend: uv run shuttle serve (in another terminal)

Architecture

Developer โ†” AI Assistant โ†” Shuttle (MCP) โ†” SSH โ†” Remote Servers
                              โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   Core Engine       โ”‚
                    โ”‚  โ”œ ConnectionPool   โ”‚
                    โ”‚  โ”œ SessionManager   โ”‚
                    โ”‚  โ”œ CommandGuard     โ”‚
                    โ”‚  โ”” SQLAlchemy ORM   โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Service mode: Single ASGI app serving both MCP (at /mcp/) and Web UI (at /) on the same port.

License

ISC


Built for developers who let AI do the SSH-ing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shuttle_mcp-0.2.1.tar.gz (415.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shuttle_mcp-0.2.1-py3-none-any.whl (165.3 kB view details)

Uploaded Python 3

File details

Details for the file shuttle_mcp-0.2.1.tar.gz.

File metadata

  • Download URL: shuttle_mcp-0.2.1.tar.gz
  • Upload date:
  • Size: 415.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for shuttle_mcp-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4ef74bdaf96bf21e5d4f97ace64efb76a670db003fec39b2c92961f1cd79fd07
MD5 b0db1ad7ce29f6192fd1833482287c2f
BLAKE2b-256 76df6045af62cd77968a9bb0dc4874b3ade99bb2778cd6c998d2b6177ec84c86

See more details on using hashes here.

File details

Details for the file shuttle_mcp-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: shuttle_mcp-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 165.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for shuttle_mcp-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fbb5a19c44b14f74b02b6da73f8888c13e0ececdd2d89f6824e5b4f2bd97edde
MD5 933ab88a8516bfb729cd88319d77638b
BLAKE2b-256 78d49a5368b9f668ab88d6121045e7d723133bcdeaaac6d5906fe2d9f94d0346

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page