Updated readme.md
This commit is contained in:
parent
82a11e104c
commit
a412690e09
64
README.md
64
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": {
|
||||
"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
|
||||
|
|
Loading…
Reference in New Issue