hcloud-mcp-server

hcloud-mcp-server

An MCP server that exposes the Huawei Cloud CLI as a single tool for AI assistants to discover and execute commands interactively via --help navigation, with built-in safety for destructive operations.

Category
访问服务器

README

hcloud-mcp-server

An MCP (Model Context Protocol) server that exposes the Huawei Cloud CLI (hcloud) as a single tool that AI assistants can navigate interactively — just like a human would.

Usage Options

  • MCP server: It maps the main hcloud functions as MCP functions and instructs for the use of --help in order to get the other functions, it uses hcloud cli in the background and as such, hcloud cli must be set up beforehand with hcloud configure init and configure obs as well. It works faster than the CLI + Skill vertion
  • CLI + Skill: As stated by Microsoft: Modern coding agents increasingly favor CLI–based workflows exposed as SKILLs over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context, allowing agents to act through concise, purpose-built commands.

It is recommended to uses the CLI + Skill option, you'll only need to copy the skills folder to your tool's skills folder. .opencode/skills or .claude/skills

How It Works

The server registers one tool: hcloud_cli. The AI navigates hcloud using --help at each level:

hcloud_cli("--help")                        → list all services
hcloud_cli("IAM --help")                    → list IAM operations
hcloud_cli("IAM ListCustomPolicies --help") → show parameters
hcloud_cli("IAM ListCustomPolicies")        → execute

This mirrors how a human discovers and uses the CLI, requires only 1 tool definition in the LLM context (~300 tokens), and works within any model's context window.

Features

  • Single tool — minimal context footprint, works with any model size
  • Interactive discovery — AI navigates --help menus naturally
  • Safety layer — destructive operations (Delete, Detach, Revoke, etc.) require confirm=true; default is dry-run mode
  • Structured output — JSON output forced automatically (--cli-output=json)
  • Configurable — timeout, binary path, safety settings

Requirements

  • Python 3.10+
  • hcloud CLI installed and configured with authentication

Installation

pip install hcloud-mcp-server

Or from source:

git clone <repo-url>
cd hcloud-mcp-server
pip install -e .

Verify:

hcloud-mcp --help

Running

# Start the MCP server (stdio transport)
hcloud-mcp

# With a config file
hcloud-mcp --config /path/to/config.json

# With debug logging
hcloud-mcp --debug

Configuration

Config file

Create a JSON config file (see config.example.json):

{
  "execution": {
    "timeout_seconds": 30,
    "cli_output": "json",
    "hcloud_binary": "hcloud"
  }
}

Environment variables

Variable Description
HCLOUD_MCP_CONFIG Path to config JSON file

Tool Reference

hcloud_cli

Parameter Type Required Description
command string Yes hcloud CLI arguments (everything after hcloud)
confirm boolean No Set true to execute destructive operations (default: false = dry-run)

Navigation flow:

  1. command="--help" — list all available services
  2. command="<Service> --help" — list operations for a service
  3. command="<Service> <Operation> --help" — show parameters and descriptions
  4. command="<Service> <Operation> --param1=value1" — execute the operation

Parameter format: Always use --param=value (equals sign required by hcloud).

Safety: Operations containing Delete, Remove, Revoke, Detach, Disassociate, Cancel, or Force are classified as destructive. Without confirm=true, they run with --dryrun first.

Adding to AI Tools

The hcloud MCP server uses standard stdio transport, compatible with any MCP client.

opencode

Add to ~/.opencode/opencode.json:

{
  "mcp": {
    "hcloud": {
      "type": "local",
      "command": ["hcloud-mcp"],
      "enabled": true
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "hcloud": {
      "command": "hcloud-mcp",
      "args": []
    }
  }
}

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "hcloud": {
      "command": "hcloud-mcp",
      "args": []
    }
  }
}

VS Code (GitHub Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "hcloud": {
      "type": "stdio",
      "command": "hcloud-mcp",
      "args": []
    }
  }
}

Windsurf

Add to ~/.windsurf/mcp.json:

{
  "mcpServers": {
    "hcloud": {
      "command": "hcloud-mcp",
      "args": []
    }
  }
}

Goose

Add to ~/.config/goose/config.yaml:

extensions:
  hcloud:
    type: stdio
    command: hcloud-mcp
    args: []

Any MCP Client (generic)

Setting Value
Command hcloud-mcp
Args []
Transport stdio

Example AI Session

User: How many custom IAM policies do I have?

AI: Let me check your IAM policies.

→ hcloud_cli(command="--help")
  [sees IAM in the service list]

→ hcloud_cli(command="IAM --help")
  [sees ListCustomPolicies in the operations list]

→ hcloud_cli(command="IAM ListCustomPolicies --help")
  [sees no required parameters]

→ hcloud_cli(command="IAM ListCustomPolicies")
  { "total_number": 2, "roles": [...] }

AI: You have 2 custom IAM policies.
User: Delete the policy with ID abc123

AI: This is a destructive operation. Let me run it in dry-run mode first.

→ hcloud_cli(command="IAM DeleteCustomPolicy --role_id=abc123")
  ⚠️ DRY RUN — no changes made.
  Set confirm=true to execute for real.

→ hcloud_cli(command="IAM DeleteCustomPolicy --role_id=abc123", confirm=true)
  ✅ Executed (confirmed destructive operation):
  { "message": "Delete success" }

AI: The policy has been deleted.

Development

# Install in editable mode
pip install -e .

# Run tests
pytest tests/ -v

# Run with debug logging
hcloud-mcp --debug

Troubleshooting

Server fails to start:

  • Ensure hcloud is installed and in PATH: which hcloud
  • Verify auth: hcloud IAM ListCustomPolicies

Tool calls return errors:

  • Check hcloud profile: hcloud configure list
  • Enable debug logging: hcloud-mcp --debug

AI doesn't know how to use the tool:

  • The tool description includes navigation instructions
  • Remind the AI: "Use hcloud_cli with --help to discover operations"

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选