mcpssh/test_ssh.py

24 lines
932 B
Python

#!/usr/bin/env python
"""
Test script for the MCP SSH server.
"""
import os
import sys
from mcpssh.server import SSHServerMCP
# Set required environment variables for testing
os.environ["MCP_SSH_HOSTNAME"] = "10.0.1.232" # Replace with your server
os.environ["MCP_SSH_USERNAME"] = "stwhite" # Replace with your username
os.environ["MCP_SSH_KEY_FILENAME"] = "~/.ssh/id_ed25519" # Replace with your key path
# os.environ["MCP_SSH_PORT"] = "22" # Optional, defaults to 22
# Create and run the server
server = SSHServerMCP()
print("Server created with configuration:")
print(f"Hostname: {server.default_hostname}")
print(f"Port: {server.default_port}")
print(f"Username: {server.default_username}")
print(f"Key filename: {server.default_key_filename}")
print("\nServer ready. In a real scenario, server.run(transport='stdio') would be called.")
print("To fully integrate with Claude, add the configuration to Claude Desktop.")