Skip to main content
Glama
gjenkins20

webmin-mcp-server

get_ssh_config

Retrieve SSH server (sshd) configuration settings including port, authentication methods, and security options to audit or verify current setup.

Instructions

Get SSH server (sshd) configuration settings including port, authentication methods, and security options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverNoServer alias (e.g., 'pi1', 'web-server'). Uses default server if not specified.

Implementation Reference

  • The main handler function for the get_ssh_config tool. Calls Webmin's sshd::get_sshd_config via XML-RPC, parses common SSH settings (port, auth methods, etc.) with fallback for lowercase keys, and returns them as a ToolResult.
    async def get_ssh_config(client: WebminClient) -> ToolResult:
        """Get SSH server (sshd) configuration.
    
        Returns key SSH daemon configuration settings.
    
        Args:
            client: Authenticated WebminClient instance.
    
        Returns:
            ToolResult with SSH configuration.
        """
        try:
            config_raw = await client.call("sshd", "get_sshd_config")
    
            if isinstance(config_raw, dict):
                # Parse common SSH settings
                config = {
                    "port": config_raw.get("Port", config_raw.get("port")),
                    "permit_root_login": config_raw.get(
                        "PermitRootLogin", config_raw.get("permit_root_login")
                    ),
                    "password_authentication": config_raw.get(
                        "PasswordAuthentication", config_raw.get("password_authentication")
                    ),
                    "pubkey_authentication": config_raw.get(
                        "PubkeyAuthentication", config_raw.get("pubkey_authentication")
                    ),
                    "x11_forwarding": config_raw.get(
                        "X11Forwarding", config_raw.get("x11_forwarding")
                    ),
                    "max_auth_tries": config_raw.get(
                        "MaxAuthTries", config_raw.get("max_auth_tries")
                    ),
                    "permit_empty_passwords": config_raw.get(
                        "PermitEmptyPasswords", config_raw.get("permit_empty_passwords")
                    ),
                    "challenge_response": config_raw.get(
                        "ChallengeResponseAuthentication",
                        config_raw.get("challenge_response_authentication"),
                    ),
                    "use_pam": config_raw.get("UsePAM", config_raw.get("use_pam")),
                    "listen_address": config_raw.get(
                        "ListenAddress", config_raw.get("listen_address")
                    ),
                    "protocol": config_raw.get("Protocol", config_raw.get("protocol")),
                    "config_file": config_raw.get("file"),
                }
    
                # Clean up None values for readability
                config = {k: v for k, v in config.items() if v is not None}
    
                return ToolResult.ok({
                    "settings": config,
                    "raw_config": config_raw,
                })
            else:
                return ToolResult.ok({
                    "raw": config_raw,
                })
    
        except Exception as e:
            return ToolResult.fail(
                code="SSH_CONFIG_ERROR",
                message=f"Failed to get SSH configuration: {e}",
            )
  • src/server.py:860-871 (registration)
    Registration of the get_ssh_config tool in the TOOLS list with its MCP metadata (name, description, input schema). Only accepts the optional 'server' parameter for multi-server support.
    Tool(
        name="get_ssh_config",
        description=(
            "Get SSH server (sshd) configuration settings including port, "
            "authentication methods, and security options."
        ),
        inputSchema={
            "type": "object",
            "properties": {**SERVER_PARAM},
            "required": [],
        },
    ),
  • Dispatch in call_tool handler that routes 'get_ssh_config' tool calls to the admin.get_ssh_config() handler function.
    if name == "get_ssh_config":
        return await admin.get_ssh_config(client)
  • ToolResult helper model used by get_ssh_config to wrap success/failure responses with data or error details.
    class ToolResult(BaseModel):
        """Generic result wrapper for MCP tool responses."""
    
        success: bool = Field(
            description="Whether the operation succeeded",
        )
        data: dict[str, Any] | None = Field(
            default=None,
            description="Result data on success",
        )
        error: WebminError | None = Field(
            default=None,
            description="Error details on failure",
        )
    
        @classmethod
        def ok(cls, data: dict[str, Any]) -> "ToolResult":
            """Create a successful result."""
            return cls(success=True, data=data)
    
        @classmethod
        def fail(
            cls,
            code: str,
            message: str,
            details: dict[str, Any] | None = None,
        ) -> "ToolResult":
            """Create a failure result."""
            return cls(
                success=False,
                error=WebminError(code=code, message=message, details=details),
            )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description provides no behavioral details beyond 'Get' (implying read-only). It does not mention permissions, side effects, or return characteristics, leaving significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that conveys the tool's purpose without extraneous words. Every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one optional param, no output schema), the description provides adequate information about the type of data returned (port, auth, security). It could mention the output format or scope, but it is sufficient for most use cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema adequately describes the single optional parameter. The description adds no further parameter information, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves SSH server configuration, listing examples like port, authentication, and security options. It distinguishes itself from sibling tools since no other tool targets SSH config.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives is provided. The purpose is implied by the name and description, but there is no 'when to use' or 'when not to use' context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/gjenkins20/webmin-mcp-server'

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