Are you the author? Sign in to claim
Persistent Terminal Sessions + File Transfer for AI Assistants
Persistent Terminal Sessions + File Transfer for AI Assistants
SSH into servers, run commands, transfer files — all through your AI assistant. No more stateless limitations.
Real-World Example • Installation • Core Features • Use Cases • Tools
AI assistants like Cursor execute commands statelessly — each command runs in a fresh environment:
❌ ssh user@server # Hangs forever - no output until exit
❌ Can't run commands after SSH
❌ Each command starts from scratch
❌ No way to transfer files to/from servers
❌ Must re-authenticate for every operation
ShellKeeper transforms AI assistants into stateful operators with persistent sessions and file transfer capabilities.
🔄 Stateful ExecutionTraditional AI (Stateless) hljs language-vbnet ShellKeeper (Stateful) hljs language-vbnet AI maintains full context between your questions! |
🎯 Persistent SessionsNatural Conversation Flow hljs language-vbnet The AI remembers everything:
|
📁 Seamless File TransferJust Ask in Natural Language hljs language-yaml It just works:
|
Watch how a natural conversation becomes automated operations:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👤 YOU ASK:
"Debug the slow API on prod-server-01"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 AI EXECUTES:
[Connecting...]
→ ssh user@prod-server-01
✅ Connected to prod-server-01
[Investigating processes...]
→ ps aux | grep api
📊 API process found: PID 1234, using 98% CPU
[Checking logs...]
→ cd /var/log/api && tail -n 100 error.log
🔍 ERROR: Memory leak in /api/v1/users endpoint
[Downloading for analysis...]
→ Download: /var/log/api/error.log → ./local-debug/
✅ Downloaded 2.4MB (analyzed: 500+ memory errors)
[Applying fix...]
→ Upload: ./fixed-config.yml → /app/config/
✅ Uploaded new rate-limiting config
[Restarting service...]
→ systemctl restart api-service
→ systemctl status api-service
✅ Service restarted, CPU now at 12%
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 AI RESPONDS:
"Fixed! The API had a memory leak in the users endpoint.
• Downloaded logs and found 500+ memory allocation errors
• Applied rate-limiting configuration
• Restarted service - CPU dropped from 98% to 12%
• All operations completed in one persistent session"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✨ All in ONE session, NO re-authentication needed! ✨
npm install -g mcp-shellkeeper
|
Cursor Settings JSON: hljs language-json ( |
Claude Code Config file: hljs language-json ( |
VS Code (Cline) Settings JSON: hljs language-json |
Restart your AI assistant and you're ready! 🎉
| Scenario | What You Ask | What AI Does |
|---|---|---|
| 🔍 Debug Production | "Why is prod-api slow?" | SSH → Check CPU/memory → Download logs → Analyze → Upload fix → Restart |
| 🚀 Deploy Updates | "Deploy v2.0 to staging" | SSH → Backup → Upload files → Migrate DB → Restart → Verify |
| 🔧 Update Configs | "Update SSL certs on web servers" | SSH → Download old certs → Upload new → Test → Reload nginx |
| 🗄️ Backup Database | "Backup prod DB to local" | SSH through bastion → Dump DB → Compress → Download → Verify |
| 📊 Analyze Logs | "Find all 500 errors today" | SSH → Parse logs → Download → Analyze locally → Report patterns |
| 🔄 Batch Operations | "Update configs on all servers" | Parallel sessions → Upload → Restart → Download results |
All through natural conversation with your AI! No scripts, no manual SSH juggling.
The AI uses these tools automatically, but you can reference them for advanced use:
| Tool | Purpose | Key Features |
|---|---|---|
terminal_execute | Run commands in persistent session | Timeout config, exit code capture, clean output |
terminal_upload_file | Upload local → remote (max 10MB) | Auto-detect directory, handle duplicates, works through SSH |
terminal_download_file | Download remote → local (max 10MB) | Auto-create dirs, preserve permissions, verify integrity |
terminal_new_session | Create isolated session | Parallel operations, separate environments |
terminal_list_sessions | View all active sessions | Status, uptime, last command |
terminal_close_session | Clean up session | Free resources when done |
terminal_get_buffer | Debug raw output | Useful for troubleshooting |
💡 Tip: The AI handles these automatically based on your natural language requests!
✅ DO:
ssh-keygen -t ed25519ssh -J bastion.com user@prod/etc, /root, .ssh/)❌ DON'T:
Persistent Sessions:
File Transfer:
// Increase timeout for long-running commands
terminal_execute({
command: "npm install",
timeout: 120000 // 2 minutes
})
// Check if SSH keys are set up correctly
ssh -v user@server
# Set up passwordless authentication
ssh-keygen -t ed25519
ssh-copy-id user@server
# Verify
ssh user@server "echo Success"
// Check if in SSH session first
terminal_execute({ command: "pwd" }) // Verify you're on remote server
// Ensure remote directory exists
terminal_execute({ command: "mkdir -p /app/uploads" })
// Then upload
terminal_upload({ local_path: "file.txt", remote_path: "/app/uploads/file.txt" })
// Verify remote file exists
terminal_execute({ command: "ls -lh /path/to/file" })
// Check permissions
terminal_execute({ command: "cat /path/to/file | wc -l" })
// Try download with absolute path
terminal_download({ remote_path: "/full/path/to/file", local_path: "./" })
// List all sessions
terminal_list_sessions()
// Close problematic session
terminal_close_session({ session_id: "stuck-session" })
// Create fresh session
terminal_new_session({ session_id: "new-session" })
# Clone repository
git clone https://github.com/tranhuucanh/mcp-shellkeeper.git
cd mcp-shellkeeper
# Install dependencies
npm install
# Build
npm run build
# Test locally with stdio transport
node dist/index.js
# Test with MCP Inspector
npm run inspector
Contributions welcome! Help make AI-assisted server management better.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)MIT License - see LICENSE file for details.
You can:
Built with ❤️ for the AI developer community
Stateful execution + File transfer = Limitless possibilities
Run analytics queries on ClickHouse — explore schemas, execute SQL, fetch results
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases