create_ssh_connection
Establish a new SSH connection by configuring host, port, username, password, and private key path securely on the Windows CLI MCP Server for remote command execution.
Instructions
Create a new SSH connection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connectionConfig | No | ||
| connectionId | No | ID of the SSH connection |
Implementation Reference
- src/index.ts:820-833 (handler)The MCP tool handler for 'create_ssh_connection' that validates input using Zod, calls the createSSHConnection helper, and returns a success response.case 'create_ssh_connection': { const args = z.object({ connectionId: z.string(), connectionConfig: z.object({ host: z.string(), port: z.number(), username: z.string(), password: z.string().optional(), privateKeyPath: z.string().optional(), }) }).parse(request.params.arguments); createSSHConnection(args.connectionId, args.connectionConfig); return { content: [{ type: 'text', text: 'SSH connection created successfully.' }] }; }
- src/index.ts:424-462 (registration)Registration of the 'create_ssh_connection' tool in the ListToolsRequestHandler response, including name, description, and input schema definition.{ name: "create_ssh_connection", description: "Create a new SSH connection", inputSchema: { type: "object", properties: { connectionId: { type: "string", description: "ID of the SSH connection" }, connectionConfig: { type: "object", properties: { host: { type: "string", description: "Host of the SSH connection" }, port: { type: "number", description: "Port of the SSH connection" }, username: { type: "string", description: "Username for the SSH connection" }, password: { type: "string", description: "Password for the SSH connection" }, privateKeyPath: { type: "string", description: "Path to the private key for the SSH connection" } }, required: ["connectionId", "connectionConfig"] } } } },
- src/index.ts:821-833 (schema)Runtime input validation schema using Zod in the tool handler.const args = z.object({ connectionId: z.string(), connectionConfig: z.object({ host: z.string(), port: z.number(), username: z.string(), password: z.string().optional(), privateKeyPath: z.string().optional(), }) }).parse(request.params.arguments); createSSHConnection(args.connectionId, args.connectionConfig); return { content: [{ type: 'text', text: 'SSH connection created successfully.' }] }; }
- src/utils/sshManager.ts:51-55 (helper)Helper function that loads the server config, adds the new SSH connection, and saves it back to the config file.const createSSHConnection = (connectionId: string, connectionConfig: any): void => { const config = loadConfig(); config.ssh.connections[connectionId] = connectionConfig; saveConfig(config); };