Loxone MCP Server

Loxone MCP Server

Connects AI assistants to Loxone smart home systems for controlling devices, managing scenes, and monitoring real-time states through natural language. Supports lights, blinds, climate control, and automation with secure PIN-protected commands.

Category
访问服务器

README

Loxone MCP Server

A Model Context Protocol (MCP) server that connects AI assistants and IDEs to your Loxone smart home system. Control lights, blinds, climate, and scenes through natural language or code.

What it does

  • Device Control: Turn lights on/off, adjust dimmers, control blinds and climate
  • Scene Management: Trigger Loxone scenes and automation scenarios
  • Real-time Updates: Live device state monitoring via WebSocket
  • Secure Access: PIN-protected commands for security devices
  • Auto Discovery: Finds all your Loxone devices automatically

Requirements

  • Python 3.10+
  • Loxone Miniserver (Gen 1/2, firmware 10.0+)
  • Network access to your Miniserver
  • Valid Miniserver credentials

Local Setup

Install uv (Python package manager)

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows (PowerShell)  
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Install and run the server

# Clone and setup
git clone <repository-url>
cd loxone-mcp-server

# Install dependencies
uv venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"

# Run the server (no configuration needed)
uv run loxone-mcp-server

Configuration

The server is stateless and does not require environment credentials. Each MCP client provides credentials when calling tools.

Optional server configuration:

# Optional server settings
MCP_TRANSPORT=http    # Set to 'http' for HTTP mode (default: 'stdio')
MCP_HOST=127.0.0.1    # HTTP host (default: '127.0.0.1')
MCP_PORT=8000         # HTTP port (default: 8000)
LOG_LEVEL=INFO        # Logging level

Running the MCP Server

The server supports two transport modes:

1. Stdio Mode (Default)

For MCP clients like Claude Desktop that connect via stdio:

# Run with stdio transport (default)
uv run loxone-mcp-server

2. HTTP Mode

For web-based clients or Amazon Q CLI that connect via HTTP:

# Run with HTTP transport
MCP_TRANSPORT=http uv run loxone-mcp-server

# Or use the dedicated HTTP command
uv run loxone-mcp-server-http

# Server will be available at: http://127.0.0.1:8000/mcp

Amazon Q CLI MCP Configuration

Setup Amazon Q CLI Agent (Stdio Mode)

The project includes a pre-configured Amazon Q CLI agent:

# Activate the agent (no credentials needed - provided per tool call)
q use agent loxone-smart-home

The agent configuration is in .amazonq/cli-agents/loxone-agent.json and includes:

  • MCP server setup with uv runner
  • Allowed tools for safe operation
  • Resource access to docs and config files

Note: Credentials are now provided per tool call, not stored in settings.

Setup Amazon Q CLI with HTTP Transport

To use Amazon Q CLI with HTTP transport, run the server in one console and configure Q CLI to connect via HTTP:

Console 1 - Start the HTTP server:

# Start HTTP server (no credentials needed)
MCP_TRANSPORT=http uv run loxone-mcp-server

# Server will show: "MCP endpoint will be available at: http://127.0.0.1:8000/mcp"

Console 2 - Configure Amazon Q CLI:

# Create HTTP-based agent configuration
q agent create loxone-http --mcp-server http://127.0.0.1:8000/mcp

# Or modify existing agent to use HTTP endpoint
q settings set agent.loxone-smart-home.mcp_endpoint http://127.0.0.1:8000/mcp

# Use the agent
q use agent loxone-http

Using with Other MCP Clients

Claude Desktop (Stdio Mode)

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "loxone": {
      "command": "uv",
      "args": ["--directory", "/path/to/loxone-mcp-server", "run", "loxone-mcp-server"]
    }
  }
}

Claude Desktop (HTTP Mode)

For HTTP mode, start the server separately and configure Claude Desktop to connect via HTTP:

  1. Start the server in HTTP mode:
MCP_TRANSPORT=http uv run loxone-mcp-server
  1. Configure Claude Desktop for HTTP:
{
  "mcpServers": {
    "loxone": {
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

Other MCP Clients

  • Stdio mode: Use the command-line pattern shown above
  • HTTP mode: Connect to http://127.0.0.1:8000/mcp endpoint

Available MCP Tools

The server provides these tools for AI assistants. All tools require Miniserver credentials as parameters:

  • loxone_list_devices - List all devices (requires: host, username, password)
  • loxone_get_device_state - Get current device state (requires: host, username, password, uuid)
  • loxone_set_switch - Turn switches on/off (requires: host, username, password, uuid, state)
  • loxone_set_dimmer - Control light brightness (requires: host, username, password, uuid, brightness)
  • loxone_set_cover_position - Control blinds/covers (requires: host, username, password, uuid, position)
  • loxone_set_temperature - Set climate target temperature (requires: host, username, password, uuid, temperature)
  • loxone_list_scenes - List available scenes (requires: host, username, password)
  • loxone_trigger_scene - Activate a scene (requires: host, username, password, uuid)
  • loxone_send_command - Send raw commands (requires: host, username, password, uuid, value)
  • loxone_send_secured_command - PIN-protected commands (requires: host, username, password, uuid, value, code)

Example usage:

  • "List devices on my Miniserver at 192.168.1.100 with username admin and password mypass"
  • "Turn on device uuid abc123 on Miniserver 192.168.1.100 with credentials admin/mypass"

Development

Setup Development Environment

# Install dependencies
uv pip install -e ".[dev]"

# Setup pre-commit hooks (optional but recommended)
make setup-pre-commit

Running Tests and Checks

# Run all CI checks locally
make ci-check

# Individual commands
make test          # Run tests with coverage
make lint          # Check code with ruff
make format        # Format code with black
make type-check    # Type check with mypy

Testing with Real Miniserver

# Integration tests now use credentials passed to tools
uv run pytest tests/integration/

Testing HTTP Transport

# Start server in HTTP mode (no credentials needed)
MCP_TRANSPORT=http uv run loxone-mcp-server

# In another terminal, test the endpoint
curl -X POST http://127.0.0.1:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "ping"}'

Troubleshooting

Common Issues

Connection Failed

  • Check Miniserver IP and credentials
  • Verify network connectivity: ping <miniserver-ip>
  • Ensure ports 80/443 are accessible

Authentication Failed

  • Verify username/password in Loxone Config
  • Delete token file and restart: rm loxone_token.json
  • Check user permissions in Loxone Config

Device Not Found

  • Restart server to reload device structure
  • Check device UUID in Loxone Config
  • Ensure device is not hidden/disabled

Debug Logging

export LOG_LEVEL=DEBUG
uv run loxone-mcp-server

License

MIT License - see LICENSE file for details.

Related Projects

推荐服务器

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 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选