add_server_config
Easily add and manage SSH server configurations by specifying name, IP, user, password, and port for remote server access. Supports default and custom SSH settings.
Instructions
动态添加服务器配置 参数:
name: 服务器名称
ip: 服务器IP地址
user: SSH用户名
password: SSH密码
port: SSH端口,默认22
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes | ||
| name | Yes | ||
| password | Yes | ||
| port | No | ||
| user | Yes |
Implementation Reference
- main.py:532-559 (handler)MCP tool handler for add_server_config. Decorated with @mcp.tool() for registration. Calls mcp_manager.add_server and returns structured response.@mcp.tool() def add_server_config(name: str, ip: str, user: str, password: str, port: int = 22) -> Dict[str, Any]: """ 动态添加服务器配置 参数: - name: 服务器名称 - ip: 服务器IP地址 - user: SSH用户名 - password: SSH密码 - port: SSH端口,默认22 """ try: mcp_manager.add_server(name, ip, user, password, port) return { "success": True, "message": f"服务器配置添加成功: {name}", "server": { "name": name, "ip": ip, "user": user, "port": port } } except Exception as e: return { "success": False, "error": str(e) }
- main.py:69-78 (helper)Core helper method in MCPManager class that stores the new server configuration in the server_configs dictionary using ServerConfig.def add_server(self, name: str, ip: str, user: str, password: str, port: int = 22): """添加服务器配置""" self.server_configs[name] = ServerConfig( name=name, ssh_ip=ip, ssh_user=user, ssh_password=password, ssh_port=port ) logger.info(f"添加服务器配置: {name} ({ip}:{port})")
- main.py:534-542 (schema)Docstring describing the input parameters for the add_server_config tool, serving as schema documentation.""" 动态添加服务器配置 参数: - name: 服务器名称 - ip: 服务器IP地址 - user: SSH用户名 - password: SSH密码 - port: SSH端口,默认22 """