UNPKG

@tb.p/terminai

Version:

MCP (Model Context Protocol) server for secure SSH remote command execution. Enables AI assistants like Claude, Cursor, and VS Code to execute commands on remote servers via SSH with command validation, history tracking, and web-based configuration UI.

173 lines (172 loc) 5.28 kB
export const TOOL_DEFINITIONS = [ { name: 'terminai_list_connections', description: 'List all configured SSH connections with their descriptions, hostnames, and command permissions. Use this to determine which connection is appropriate for a task. Descriptions explain what each server is for and what commands/tools are available on it.', inputSchema: { type: 'object', properties: {}, required: [] } }, { name: 'terminai_exec', description: 'Execute a shell command on a remote server via SSH. Use terminai_list_connections first to see available servers and their descriptions. Commands are validated against allow/deny rules before execution.', inputSchema: { type: 'object', properties: { connection: { type: 'string', description: 'The name of the SSH connection to use' }, command: { type: 'string', description: 'The shell command to execute on the remote server' } }, required: ['connection', 'command'] } }, { name: 'terminai_get_history', description: 'Get the command execution history for a connection, including timestamps, exit codes, duration, and optionally stdout/stderr output.', inputSchema: { type: 'object', properties: { connection: { type: 'string', description: 'The name of the connection to get history for' }, limit: { type: 'number', description: 'Maximum number of history entries to return (default: 50)' } }, required: ['connection'] } }, { name: 'terminai_get_config', description: 'Get the current SSH MCP server configuration including global rules and all connection settings.', inputSchema: { type: 'object', properties: {}, required: [] } }, { name: 'terminai_add_connection', description: 'Add a new SSH connection configuration. Requires name, host, username, and identity file path. Optionally set allowed/disallowed commands.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Unique name for this connection' }, description: { type: 'string', description: 'Human-readable description for AI context (what the server is for)' }, host: { type: 'string', description: 'Hostname or IP address' }, port: { type: 'number', description: 'SSH port (default: 22)' }, username: { type: 'string', description: 'SSH username' }, identityFile: { type: 'string', description: 'Path to private key file' }, allowedCommands: { type: 'array', items: { type: 'string' }, description: 'List of allowed command patterns (supports wildcards)' }, disallowedCommands: { type: 'array', items: { type: 'string' }, description: 'List of disallowed command patterns (supports wildcards)' } }, required: ['name', 'host', 'username', 'identityFile'] } }, { name: 'terminai_update_connection', description: 'Update settings for an existing SSH connection. Only provided fields are updated; others remain unchanged.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the connection to update' }, description: { type: 'string', description: 'Human-readable description for AI context' }, host: { type: 'string', description: 'Hostname or IP address' }, port: { type: 'number', description: 'SSH port' }, username: { type: 'string', description: 'SSH username' }, identityFile: { type: 'string', description: 'Path to private key file' }, allowedCommands: { type: 'array', items: { type: 'string' }, description: 'List of allowed command patterns' }, disallowedCommands: { type: 'array', items: { type: 'string' }, description: 'List of disallowed command patterns' } }, required: ['name'] } }, { name: 'terminai_remove_connection', description: 'Remove an SSH connection configuration by name.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the connection to remove' } }, required: ['name'] } }, { name: 'terminai_open_config_ui', description: 'Open the web-based configuration UI in the default browser. The UI allows you to manage SSH connections, view history, and configure settings through a graphical interface.', inputSchema: { type: 'object', properties: { port: { type: 'number', description: 'Port number for the UI server (default: 8374)' } }, required: [] } } ];