hetzner-mcp

🚀 Hetzner MCP Server

Python License Hetzner Cloud MCP

Hetzner Logo

Disclaimer: This project is not affiliated with or endorsed by Hetzner. The Hetzner logo is used solely to visually associate this repository with Hetzner Cloud services.

A next-generation Model Context Protocol (MCP) server for Hetzner Cloud, providing seamless, programmatic access to the entire Hetzner API via the official hcloud-python SDK.


✨ Key Features

🔒 Security & Considerations


Environment Variables & VS Code Integration

Prerequisites

1. Configure Your .env File

  1. Copy the provided example:
     cp .env.example .env
    
  2. Open .env and paste your Hetzner API token:
     HETZNER_API_TOKEN=your_hetzner_api_token_here
    

    Never commit your real .env file to version control!

    Need a token? See the Hetzner docs:
    👉 How to generate your Hetzner API Token

2. Integrate with VS Code

To enable agent/LLM workflows in VS Code:

  1. Create a .vscode folder in your workspace if it doesn’t exist.
  2. Create or edit the file .vscode/mcp.json and add the following configuration:
{
	"servers": {
		"hetzner-mcp": {
			"command": "docker",
			"args": [
				"run",
				"-i",
				"--rm",
				"-v",
				"${workspaceFolder}/.env:/app/.env:ro",
				"betancourtosmar/hetzner-mcp"
			]
		}
	}
}

This will allow you to launch the MCP server with your credentials for agent-driven workflows.


🐍 Local Development (No Docker Needed)

  1. Install dependencies:
      pip install -r requirements.txt
    
  2. Ensure your .env file is present and contains your Hetzner API token.
  3. Run the server:
      python src/main.py
    


🛠️ Available Tools

Tool Description
call_hetzner Execute any Hetzner SDK call as a string, e.g. client.servers.get_all()
hetzner_help List all SDK resources, methods, signatures, and docstrings for full discoverability
echo Echo back any text (for testing)
mcp_health Health check endpoint

💡 Example Usage

List all servers:

call_hetzner("client.servers.get_all()")

Create a server:

call_hetzner("client.servers.create(name='my-server', server_type='cx11', image='ubuntu-20.04')")

Delete a server:

call_hetzner("client.servers.delete(server)")

List all images:

call_hetzner("client.images.get_all()")

Discover all possible actions:

hetzner_help()

🌐 What Can You Do?


❓ FAQ

Q: Can I run this MCP outside Docker?

A: You can, but it is strongly discouraged. Running outside Docker gives the agent/LLM a wildcard to execute any Python code on your real machine—just like agentic Copilot or Cursor. The main difference is that the MCP provides explicit instructions and helpers for the Hetzner SDK, making it easier for the LLM to automate cloud operations. For safety, always use Docker or another isolated environment.

Q: What is the value of the MCP tools?

A: The MCP tools (like call_hetzner and hetzner_help) provide structured, discoverable interfaces and documentation for the Hetzner SDK. This abstracts the SDK logic from the user and makes it much easier for LLMs and agents to use the full power of Hetzner Cloud without manual setup or research.




📝 License

This project is licensed under the MIT License. See LICENSE for details.

📬 Support / Contact

For questions, feedback, or support, contact: oaba.dev@gmail.com

Made with ❤️ for Hetzner Cloud automation.
Ready for the future of cloud operations.

The best part: This MCP always uses the latest version of the Hetzner Python SDK.
Every new feature released by Hetzner is instantly available here—no manual updates required!