Hi everyone,
I’ve been working on a Model Context Protocol (MCP) server for OpenHAB that goes beyond basic REST API exposure. I created this because I couldn’t find any other MCP implementations that offered the “agentic” capabilities needed for high-level AI assistance.
While other MCPs pipe the API through, this version is designed to let an AI assistant perform complex, autonomous tasks—like rebuilding your entire Semantic Model, converting legacy Sitemaps to modern MainUI, and performing deep-dive forensic troubleshooting that would otherwise take hours of manual effort.
Performance & Token Efficiency
Speed and efficiency were a major focus in this implementation:
-
Parallel Execution: Uses
execute_batchto fire multiple commands simultaneously, drastically reducing the “latency drag” of sequential AI actions. -
Token-Optimized Summaries: Instead of the AI reading your entire item list (which can blow through context windows), tools like
get_system_summaryandsummarize_persistence_rangedeliver high-density data that uses ~90% fewer tokens. -
API Caching: Built-in TTL caching ensures that repeated AI queries for things or items are served instantly without hitting the OpenHAB REST API every time.
Full Capability List (84 Tools)
I’ve categorized the tools below. The “Mastery” tools are highlighted at the top as they are the ones that really empower an AI agent to manage your home autonomously.
Mastery & Agentic Intelligence
-
get_system_summary: High-density overview of items, things, rooms, and health. -
shadow_run: Virtual simulation of command sequences. -
simulate_system_state: Predict outcome including rule triggers for a single command. -
explain_item_state: Forensic review of item history, hardware links, and rule influence. -
create_equipment_from_thing: Rapidly generates semantic hierarchy from hardware. -
audit_semantic_model: Structural audit for loose items or misaligned tags. -
find_orphans_and_broken_links: Scans for dead links and missing semantics. -
analyze_system_health: Proactive scan for OFFLINE nodes and battery issues. -
predictive_rule_generator: Intent-to-JS rule generation. -
get_visual_chart: ASCII sparkline trend analysis. -
calculate_energy_insights: Power/efficiency consumption reporting. -
bulk_item_remediation: Mass-update tags, categories, and groups. -
discover_automation_patterns: Finds temporal correlations for automation ideas. -
standardize_naming_convention: Proposes unified semantic naming formats. -
optimize_persistence_strategy: Performance recommendations for DB bloat. -
summarize_persistence_range: Statistical persistence summaries to save tokens. -
optimize_mcp_focus: Lock the AI’s “vision” to a specific room or group. -
generate_home_blueprint: Creates a full Markdown manual of your setup. -
audit_system_safety: Security audit for locks and alarms. -
get_mcp_health&get_mcp_capabilities: Real-time server metrics and feature status.
Items & Semantic Model
-
get_items/get_item: Retrieval with advanced filtering. -
send_command/update_state: The core control loop. -
create_or_update_item/delete_item: Full managed-mode lifecycle. -
add_tag/remove_tag: Dynamic semantic tagging. -
set_metadata/remove_metadata: Namespace management. -
get_room_status: Concise occupancy/device summary by room. -
find_equipment_by_type: Spatial queries (e.g., “all lights in the kitchen”). -
get_item_statistics: Persistence analysis (peaks, duty cycles). -
search_items: Fuzzy search across names and labels. -
get_schema: Zero-token name/type mapping. -
suggest_semantic_tags: AI-driven tagging suggestions.
Things, Channels & Links
-
get_things/get_thing: Hardware layer inspection. -
create_thing/update_thing/delete_thing: Lifecycle management. -
enable_thing/get_thing_status: Real-time node monitoring. -
update_thing_config: Remote parameter adjustment. -
get_links/link_item_to_channel/unlink_item_from_channel: The bridge between hardware and logic. -
configure_link_profile: Advanced link behaviors (Follow, Offset, Transform).
Rules & Automation
-
get_rules/get_rule: Logic layer inspection. -
create_rule/update_rule/delete_rule: Scripts and triggers. -
run_rule/enable_rule: Manual execution and logic toggle. -
detect_rule_conflicts: Race condition and logic collision detection. -
validate_rule_logic: Pre-flight syntax and safety (loop) check.
Persistence & Historian
-
get_persistence_services: View active DB connectors. -
get_item_persistence_data: Raw value retrieval. -
store_item_persistence_data: Manual state injection.
Media, Voice & Habot
-
control_media: Context-aware Play/Pause/Volume controls. -
voice_say: TTS announcement system. -
voice_interpret: OpenHAB native NLP interpreter. -
get_voices/get_audio_sinks/get_audio_sources: Hardware audio routing. -
chat_with_habot: Direct link to the official Habot assistant.
System, Sitemaps & UI
-
get_inbox/approve_inbox_item/ignore_inbox_item: Discovery management. -
get_addons/install_addon/uninstall_addon: Extension management. -
get_system_info/get_loggers/set_logger_level: Diagnostic control. -
get_services/get_service_config/update_service_config: System-wide settings. -
get_sitemaps/sitemap_to_main_ui: Legacy migration tools. -
generate_ui_widget: Professional MainUI YAML generation. -
generate_topology: Mermaid graph spatial visualization. -
get_recent_logs: Real-time log buffer (tail) for the AI.
Getting Started
It is a standard Node.js MCP server.
Latest Release: Release v1.2.0: Community Enhancements · deswong/Openhab-MCP · GitHub
Repository: deswong/Openhab-MCP
Quick Setup:
-
Clone the repo and
npm install && npm run build. -
Configure your
OPENHAB_URLandOPENHAB_API_TOKEN. -
Add it to your MCP client (Claude Desktop, Roo Code, Cline, etc.).
Detailed instructions are in the README.
I’d love to get some feedback if you find this useful and let me know if you come across issues.
Cheers,
Des