From a412690e091edbe965b67ffea839ae5e75ca77f6 Mon Sep 17 00:00:00 2001 From: Steve White Date: Tue, 8 Apr 2025 20:58:53 -0500 Subject: [PATCH] Updated readme.md --- README.md | 74 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c9474cc..5625b19 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ The SSH server can be configured using environment variables or the MCP JSON con | `MCP_SSH_PORT` | SSH server port | 22 | | `MCP_SSH_USERNAME` | SSH username | None | | `MCP_SSH_KEY_FILENAME` | Path to SSH private key file | None | +| `MCP_SSH_SERVER_NAME` | Custom name for the server instance | "SSH Server" | +| `MCP_SSH_TOOL_PREFIX` | Prefix for tool names (e.g., 'server1_' for 'server1_ssh_connect') | "" | ### Claude Desktop MCP Configuration @@ -33,24 +35,68 @@ Add the following to your Claude Desktop MCP configuration file: ```json { - "tools": [ - { - "name": "mcpssh", - "path": "python -m mcpssh", - "environment": { - "MCP_SSH_HOSTNAME": "example.com", - "MCP_SSH_PORT": "22", - "MCP_SSH_USERNAME": "user", - "MCP_SSH_KEY_FILENAME": "/path/to/private_key" - } + "mcpssh": { + "command": "python", + "args": [ + "-m", + "mcpssh" + ], + "env": { + "MCP_SSH_HOSTNAME": "example.com", + "MCP_SSH_PORT": "22", + "MCP_SSH_USERNAME": "user", + "MCP_SSH_KEY_FILENAME": "/path/to/private_key" } - ] + } } ``` +### Multiple SSH Server Configuration + +You can configure multiple SSH servers in Claude Desktop by creating multiple entries with different names and using the `MCP_SSH_SERVER_NAME` and `MCP_SSH_TOOL_PREFIX` environment variables to distinguish them: + +```json +{ + "mcpssh1": { + "command": "python", + "args": [ + "-m", + "mcpssh" + ], + "env": { + "MCP_SSH_HOSTNAME": "production.example.com", + "MCP_SSH_USERNAME": "prod-user", + "MCP_SSH_KEY_FILENAME": "~/.ssh/prod_key", + "MCP_SSH_SERVER_NAME": "Production Server", + "MCP_SSH_TOOL_PREFIX": "prod_" + } + }, + "mcpssh2": { + "command": "python", + "args": [ + "-m", + "mcpssh" + ], + "env": { + "MCP_SSH_HOSTNAME": "dev.example.com", + "MCP_SSH_USERNAME": "dev-user", + "MCP_SSH_KEY_FILENAME": "~/.ssh/dev_key", + "MCP_SSH_SERVER_NAME": "Development Server", + "MCP_SSH_TOOL_PREFIX": "dev_" + } + } +} +``` + +With this configuration: + +1. Claude will have access to two separate SSH server tools +2. Each server will be identified by its custom name in Claude's UI +3. Each server's tools will have unique prefixes to distinguish them (e.g., `prod_ssh_connect` vs `dev_ssh_connect`) + ## Usage -This server implements the Anthropic MCP protocol and provides the following tools: +This server implements the Anthropic MCP protocol and provides the following tools (note that when using `MCP_SSH_TOOL_PREFIX`, the tool names will be prefixed with that value): - `ssh_connect`: Connect to an SSH server using public key authentication (using config or explicit parameters) - `ssh_execute`: Execute a command on the SSH server @@ -97,7 +143,9 @@ server = SSHServerMCP( hostname="example.com", port=22, username="user", - key_filename="/path/to/private_key" + key_filename="/path/to/private_key", + server_name="My Custom Server", # Optional custom server name + tool_prefix="custom_" # Optional tool name prefix ) # Run the server with stdio transport