Skip to main content
Glama
dkruyt

Hetzner Cloud MCP Server

by dkruyt

delete_ssh_key

Permanently remove an SSH key from Hetzner Cloud by specifying its ID to manage server access and security.

Instructions

Delete an SSH key. Permanently deletes an SSH key identified by its ID. Example: - Delete SSH key: {"ssh_key_id": 12345}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the delete_ssh_key tool. It retrieves the SSH key by ID using the Hetzner Cloud client and deletes it if found.
    @mcp.tool() def delete_ssh_key(params: SSHKeyIdParam) -> Dict[str, Any]: """ Delete an SSH key. Permanently deletes an SSH key identified by its ID. Example: - Delete SSH key: {"ssh_key_id": 12345} """ try: ssh_key = client.ssh_keys.get_by_id(params.ssh_key_id) if not ssh_key: return {"error": f"SSH key with ID {params.ssh_key_id} not found"} success = client.ssh_keys.delete(ssh_key) return {"success": success} except Exception as e: return {"error": f"Failed to delete SSH key: {str(e)}"}
  • Pydantic BaseModel defining the input schema for the delete_ssh_key tool, requiring an integer ssh_key_id.
    class SSHKeyIdParam(BaseModel): ssh_key_id: int = Field(..., description="The ID of the SSH key")
  • Helper function to convert SSHKey objects to dictionaries, used in related SSH key tools like list_ssh_keys and get_ssh_key.
    def ssh_key_to_dict(ssh_key: SSHKey) -> Dict[str, Any]: """Convert an SSHKey object to a dictionary with relevant information.""" return { "id": ssh_key.id, "name": ssh_key.name, "fingerprint": ssh_key.fingerprint, "public_key": ssh_key.public_key, "labels": ssh_key.labels, "created": ssh_key.created.isoformat() if ssh_key.created else None, }

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