Files
shopdb-flask/.claude/setup/setup-vm-ssh.md
Proudlock a03fd3de4f Fix CI failures: remove unicode and fix lean build
- Replace all unicode (emojis, checkmarks, arrows, em-dashes) with ASCII in .claude/ docs
- Comment out OperatingSystemsList route in core.js - breaks lean builds without computers plugin
- Comment out Operating Systems tab in ModelCatalogHub
- TODO: Plugins should dynamically register their settings routes

Fixes #2 CI check failures on wj branch

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-09-11 16:42:19 -04:00

5.7 KiB

Set Up SSH Access to VM for Claude Code

Guide to configure SSH MCP so Claude can interact with the Windows 11 test VM.


Step 1: Configure VM (Run as Administrator in VM)

# Install OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

# Start SSH service
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

# Allow SSH through firewall
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

# Verify SSH is listening
netstat -ano | findstr :22
# Should show: TCP 0.0.0.0:22 ... LISTENING

# Set password for local user (replace "ShopFloor" with actual username)
net user ShopFloor YourPassword123

Step 2: Test SSH from Host

# From host PC
ssh ShopFloor@192.168.100.10

# Should connect and show Windows command prompt
# If works, type 'exit' to disconnect

Step 3: Install SSH MCP Server

# On host PC
npm install -g ssh-mcp

# Verify installation
npm list -g ssh-mcp

Step 4: Add to Claude Code Config

Edit .claude/mcp-servers.json:

{
  "mcpServers": {
    "gortex": {
      "command": "C:\\Users\\270015376\\Documents\\gortex.exe",
      "args": ["mcp"],
      "cwd": "C:\\Users\\270015376\\Documents\\github\\flask-shopdb"
    },
    "mysql": {
      "command": "npx",
      "args": ["-y", "@benborla29/mcp-server-mysql", "mysql://shopdb:shopdb-dev-password@127.0.0.1:3306/shopdb_flask"]
    },
    "browser": {
      "command": "npx",
      "args": ["-y", "@agent-infra/mcp-server-browser"]
    },
    "vm": {
      "command": "npx",
      "args": [
        "-y",
        "ssh-mcp",
        "--host", "192.168.100.10",
        "--user", "ShopFloor",
        "--password", "YourPassword123"
      ]
    }
  }
}

Note: Replace "ShopFloor" and "YourPassword123" with actual VM credentials.


Step 5: Restart Claude Code

Close and reopen Claude Code completely to load the new MCP server.


Step 6: Verify SSH MCP Works

In Claude Code conversation:

You: "Run 'hostname' on the VM"

Claude: [Calls mcp__vm__exec]
Claude: "VM hostname: DESKTOP-ABC123"

What Claude Can Do with SSH MCP:

Execute Commands:

"Check if agent service is running on VM"
"Get the VM's IP configuration"
"List running processes on VM"
"Read agent logs from VM"

File Operations:

"Copy shopdbagent.exe to VM at C:\Temp"
"Read the agent config file from VM"
"Upload the latest build to VM"
"Download agent logs from VM"

Agent Testing:

"Install the agent on VM"
"Start/stop the agent service"
"Check if tray is running"
"Tail the agent log file"
"Verify agent is connecting to http://192.168.100.1:5000"

Integration Testing:

"Create a fleet alert and verify it appears on VM"
"Submit operator report from VM and check database"
"Test endpoint heartbeat from VM"
"Run script on VM and check results in database"

Security Notes

Password in Config:

  • Config file contains plain-text password
  • Only for test VM on internal network
  • VM has no internet access (internal network only)
  • Not a production concern

Better: Use SSH Key (Optional)

Generate SSH key:

ssh-keygen -t rsa -f ~/.ssh/vm_key

Copy public key to VM:

# In VM, create .ssh directory
mkdir C:\Users\ShopFloor\.ssh

# Copy contents of ~/.ssh/vm_key.pub to:
# C:\Users\ShopFloor\.ssh\authorized_keys

Update .mcp.json:

"vm": {
  "command": "npx",
  "args": [
    "-y",
    "ssh-mcp",
    "--host", "192.168.100.10",
    "--user", "ShopFloor",
    "--key", "C:\\Users\\270015376\\.ssh\\vm_key"
  ]
}

Troubleshooting

SSH Connection Refused:

# Check SSH service on VM
ssh ShopFloor@192.168.100.10
# If fails, verify service running:
# In VM: Get-Service sshd

Authentication Failed:

# Verify password
# In VM: net user ShopFloor NewPassword123

Port 22 Blocked:

# In VM, check firewall rule exists
Get-NetFirewallRule -Name sshd

MCP Server Not Loading:

# Verify ssh-mcp installed
npm list -g ssh-mcp

# Test manually
npx -y ssh-mcp --host 192.168.100.10 --user ShopFloor --password Test123

Example Test Workflow

Full Agent Deployment Test:

You: "Deploy and test the agent on the VM"

Claude:
1. [Builds agent] dotnet publish...
2. [SSH: Upload] Copying shopdbagent.exe to VM...
3. [SSH: Install] Running installer on VM...
4. [SSH: Configure] Setting API endpoint to http://192.168.100.1:5000...
5. [SSH: Start] Starting ShopDBEndpointAgent service...
6. [SSH: Verify] Checking service status... Running
7. [SSH: Logs] Reading agent.log... "Connected to API successfully"
8. [MySQL: Create alert] Inserting test fleet alert...
9. [Wait 5s]
10. [SSH: Check tray] Get-Process shopdb-endpoint-tray... Running
11. [SSH: Screenshot] Capturing tray notification...
12. [X] Complete! Agent installed, connected, and received fleet alert.

VM Requirements Summary:

Requirement Status Command to Check
OpenSSH Server installed [WAIT] Get-WindowsCapability -Online -Name OpenSSH.Server*
SSH service running [WAIT] Get-Service sshd
Port 22 open in firewall [WAIT] Get-NetFirewallRule -Name sshd
User has password set [WAIT] net user ShopFloor
Network connectivity [X] arp -a shows 192.168.100.10
Internal network configured [X] VM has 192.168.100.10

Next Steps:

  1. Run Step 1 commands in VM (as Administrator)
  2. Test SSH connection from host (Step 2)
  3. Install ssh-mcp on host (Step 3)
  4. Update .claude/mcp-servers.json (Step 4)
  5. Restart Claude Code (Step 5)
  6. Test with simple command (Step 6)

Ready to proceed?