Skip to main content
Glama
nwnusun-cool

MCP SSH Tools Server

by nwnusun-cool

test_connection

Verify server connectivity by testing the connection to a specified server using the MCP SSH Tools Server, ensuring remote management readiness.

Instructions

测试服务器连接 参数:

  • server_name: 服务器名称

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_nameYes

Implementation Reference

  • main.py:491-531 (handler)
    The handler function for the 'test_connection' tool. It is decorated with @mcp.tool() which registers it with the MCP server. The function tests the SSH connection to the specified server by attempting to connect using paramiko and returns success or error details.
    @mcp.tool() def test_connection(server_name: str) -> Dict[str, Any]: """ 测试服务器连接 参数: - server_name: 服务器名称 """ if server_name not in mcp_manager.server_configs: return { "success": False, "error": f"未找到服务器配置: {server_name}" } config = mcp_manager.server_configs[server_name] try: client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect( hostname=config.ssh_ip, port=config.ssh_port, username=config.ssh_user, password=config.ssh_password, timeout=10 ) client.close() return { "success": True, "server": server_name, "ip": config.ssh_ip, "port": config.ssh_port, "message": "连接测试成功" } except Exception as e: return { "success": False, "server": server_name, "ip": config.ssh_ip, "port": config.ssh_port, "error": str(e) }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nwnusun-cool/mcp-server-ssh-tools'

If you have feedback or need assistance with the MCP directory API, please join our Discord server