Skip to main content
Glama
nwnusun-cool

MCP SSH Tools Server

by nwnusun-cool

add_server_config

Add a new server configuration to the SSH Tools Server by specifying name, IP address, SSH credentials, and optional port for remote management.

Instructions

动态添加服务器配置 参数:

  • name: 服务器名称

  • ip: 服务器IP地址

  • user: SSH用户名

  • password: SSH密码

  • port: SSH端口,默认22

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
ipYes
userYes
passwordYes
portNo

Implementation Reference

  • main.py:532-559 (handler)
    The primary handler function for the 'add_server_config' tool. It is decorated with @mcp.tool() which registers it with the MCP server. Validates inputs via type hints, delegates to MCPManager.add_server, and returns a standardized JSON 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)
    Helper method in the MCPManager class that performs the actual server configuration addition by instantiating a ServerConfig object and storing it in the server's config dictionary.
    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:532-532 (registration)
    The @mcp.tool() decorator registers the add_server_config function as an MCP tool.
    @mcp.tool()

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