A Model Context Protocol (MCP) server that connects AI assistants to Loxone Miniserver smart home systems.
- π Reliable Connection - Connects to Loxone Miniserver via HTTP API
- π Flexible Credentials - Multiple credential sources (env vars, CLI args, Bitwarden)
- π Configuration-Driven - Define tools and resources in YAML without code changes
- π― Dynamic Registration - Tools and resources automatically loaded from configuration
- π Dual Transport - Support for both STDIO and HTTP/SSE modes
- π§Ή Clean Architecture - Type-safe Kotlin codebase with proper resource management
- π¦ Easy Integration - Works with Claude Desktop, Cline, GitHub Copilot Chat, and more
- Java 21 or higher
- Loxone Miniserver (Gen 1 or Gen 2)
- AI assistant that supports MCP (e.g., Claude Desktop, Cline, GitHub Copilot Chat with MCP)
git clone https://github.com/smarteon/lox-mcp.git
cd lox-mcp
./gradlew buildThe server resolves credentials using a fixed priority: Bitwarden (if configured), then command-line arguments (if all are provided), and finally environment variables as a fallback:
java -jar build/libs/lox-mcp-*.jar --stdio \
--address "http://192.168.1.77" \
--username "your_username" \
--password "your_password"# Linux/macOS
export LOXONE_HOST=http://192.168.1.77
export LOXONE_USER=your_username
export LOXONE_PASS=your_password
# Windows PowerShell
$env:LOXONE_HOST="http://192.168.1.77"
$env:LOXONE_USER="your_username"
$env:LOXONE_PASS="your_password"STDIO Mode (for Claude Desktop, Cline):
./gradlew run --args="--stdio"HTTP/SSE Mode (for web clients):
./gradlew run --args="--sse 3001"Many MCP clients have limited or no support for MCP resources. Use the --resources-as-tools flag to expose all resources as callable tools instead:
# STDIO mode with resources as tools
./gradlew run --args="--stdio --resources-as-tools"
# HTTP/SSE mode with resources as tools
./gradlew run --args="--sse 3001 --resources-as-tools"This converts resources like loxone://rooms into tools like get_rooms_list, making them accessible to any MCP client.
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"loxone": {
"command": "java",
"args": [
"-jar",
"/path/to/lox-mcp/build/libs/lox-mcp-*.jar",
"--stdio",
"--resources-as-tools"
],
"env": {
"LOXONE_HOST": "http://192.168.1.77",
"LOXONE_USER": "your_username",
"LOXONE_PASS": "your_password"
}
}
}
}Note: The
--resources-as-toolsflag is recommended because Claude Desktop has limited support for MCP resources.
Configure in your MCP settings using the same format as Claude Desktop.
Configure in Cline's MCP settings using the same format.
lox-mcp/
βββ src/main/kotlin/
β βββ Application.kt # Entry point, command-line parsing
β βββ Constants.kt # Application constants (version, JSON config)
β βββ LoxoneAdapter.kt # Wraps Loxone HTTP client
β βββ credentials/
β β βββ CredentialSource.kt # Credential source interface and implementations
β β βββ CredentialResolver.kt # Resolves credentials from sources
β βββ config/
β β βββ Models.kt # Config data classes
β β βββ ConfigLoader.kt # YAML config loading
β βββ server/
β βββ McpServer.kt # MCP server setup (STDIO & HTTP/SSE)
β βββ ToolsRegistry.kt # Registers tools from config
β βββ ResourcesRegistry.kt # Registers resources from config
β βββ DynamicToolHandler.kt # Executes tool logic
β βββ DynamicResourceHandler.kt # Provides resource content
βββ src/main/resources/
β βββ mcp-config.yaml # Tools and resources configuration
βββ build.gradle.kts # Gradle build configuration
βββ gradle/libs.versions.toml # Dependency versions
βββ README.md # This file
Define tools and resources in src/main/resources/mcp-config.yaml:
tools:
- name: control_device
description: Control a Loxone device
parameters:
- name: device_id
type: string
required: true
- name: action
type: string
required: true
handler:
type: control_device
resources:
- uri: loxone://rooms
name: All Rooms
description: List of all rooms
mimeType: application/json
handler:
type: rooms_listSee docs/DEVELOPER_GUIDE.md for detailed documentation.
# Full build
./gradlew build
# Run tests
./gradlew test
# Run in STDIO mode
./gradlew run --args="--stdio"
# Run in HTTP/SSE mode
./gradlew run --args="--sse 3001"
# Build distribution
./gradlew installDistThis project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
- loxone-client-kotlin - Kotlin client library for Loxone Miniserver
- Model Context Protocol - Protocol specification
- MCP Kotlin SDK - Kotlin SDK for MCP