Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

list_servers

Retrieve a list of all server instances with their details from your Hetzner Cloud account to monitor and manage your infrastructure.

Instructions

List all servers in your Hetzner Cloud account.

Returns a list of all server instances with their details.

Example:
- Basic list: list_servers()

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'list_servers' MCP tool. It fetches all servers from the Hetzner Cloud API using the client and converts each to a dictionary using the server_to_dict helper, returning them in a 'servers' list or an error message.
    @mcp.tool()
    def list_servers() -> Dict[str, Any]:
        """
        List all servers in your Hetzner Cloud account.
        
        Returns a list of all server instances with their details.
        
        Example:
        - Basic list: list_servers()
        """
        try:
            servers = client.servers.get_all()
            return {
                "servers": [server_to_dict(server) for server in servers]
            }
        except Exception as e:
            return {"error": f"Failed to list servers: {str(e)}"}
  • Helper function that converts a Hetzner Server object to a dictionary containing key details like id, name, status, networking info, protection settings, and labels. Used by list_servers and other server-related tools.
    def server_to_dict(server: Server) -> Dict[str, Any]:
        """Convert a Server object to a dictionary with relevant information."""
        return {
            "id": server.id,
            "name": server.name,
            "status": server.status,
            "created": server.created.isoformat() if server.created else None,
            "server_type": server.server_type.name if server.server_type else None,
            "image": server.image.name if server.image else None,
            "datacenter": server.datacenter.name if server.datacenter else None,
            "location": server.datacenter.location.name if server.datacenter and server.datacenter.location else None,
            "public_net": {
                "ipv4": server.public_net.ipv4.ip if server.public_net and server.public_net.ipv4 else None,
                "ipv6": server.public_net.ipv6.ip if server.public_net and server.public_net.ipv6 else None,
            },
            "included_traffic": server.included_traffic,
            "outgoing_traffic": server.outgoing_traffic,
            "ingoing_traffic": server.ingoing_traffic,
            "backup_window": server.backup_window,
            "rescue_enabled": server.rescue_enabled,
            "locked": server.locked,
            "protection": {
                "delete": server.protection["delete"] if server.protection else False,
                "rebuild": server.protection["rebuild"] if server.protection else False,
            },
            "labels": server.labels,
            "volumes": [volume.id for volume in server.volumes] if server.volumes else [],
        }
  • The @mcp.tool() decorator registers the list_servers function as an MCP tool in the FastMCP server instance.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns a list of server instances with details, which is helpful, but lacks critical information such as pagination behavior, rate limits, authentication requirements, or error conditions. For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded: the first sentence states the core purpose, the second explains the return value, and the example illustrates usage. There's minimal waste, though the example could be more informative (e.g., showing output structure). It efficiently conveys key information in three sentences.

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

Completeness3/5

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

Given the tool's low complexity (0 parameters, read-only operation) and the presence of an output schema (which handles return values), the description is mostly adequate. However, with no annotations, it should ideally mention authentication needs or data scope (e.g., all servers in the account). It covers the basics but lacks depth for a tool in a cloud management context.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so the schema fully documents the absence of parameters. The description adds no parameter-specific information, which is appropriate since there are none. It correctly implies no filtering or arguments are needed, aligning with the schema. Baseline is 4 for zero parameters.

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's purpose: 'List all servers in your Hetzner Cloud account.' It specifies the verb ('List') and resource ('servers'), and distinguishes it from sibling tools like 'get_server' (which retrieves a specific server) and 'create_server' (which creates a new server). However, it doesn't explicitly differentiate from other list tools like 'list_firewalls' or 'list_volumes' beyond the resource name.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication), compare it to similar tools like 'get_server' for retrieving a single server, or indicate scenarios where it might be preferred over other list tools. The example only shows basic usage without 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/dkruyt/mcp-hetzner'

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