HA-LineBot-MCP
Home assistant Line bot整合,結合MCP(Model Context Protocol) server。 / A Home Assistant integration for LINE Bot, combined with an MCP (Model Context Protocol) server
GitHubスター
1
ユーザー評価
未評価
お気に入り
0
閲覧数
19
フォーク
0
イシュー
1
LINE Bot MCP Integration for Home Assistant
A custom integration for Home Assistant that integrates LINE Bot with the Model Context Protocol (MCP).
🌟 Features
- 🤖 Full LINE Bot Support — Receive and send various LINE message types.
- 🧠 MCP Server — Let AI assistants (Claude, ChatGPT) control your LINE Bot directly.
- 🏠 Home Assistant Native Integration — Offers services and sensors.
- 📱 Rich Message Types — Text, image, video, audio, location, sticker, Flex, and more.
- 🔄 Smart Auto Reply — Integrates conversation agents for intelligent replies.
- 📊 Real-Time Monitoring — Track bot status and quota usage.
[!Warning]
Auto reply is currently an experimental feature and may not always work as expected.
📋 Requirements
- Home Assistant 2025.7.0 or later
- A LINE Developers account
🚀 Getting Started
1. Install the Integration
Using HACS (recommended):
2. Set Up the LINE Bot
- Go to LINE Developers Console
- Create a Messaging API Channel
- Copy your Channel Access Token and Channel Secret
3. Configure the Integration
- In Home Assistant, add the "LINE Bot MCP" integration
- Provide your Bot ID, Channel Access Token, and Channel Secret
- Go to the attributes of the bot info sensor to view the Webhook endpoint
- Enter the Webhook URL in the LINE Developer Console
🎯 Usage
Home Assistant Services
# Send a text message
service: notify.linebot_push_message
data:
name: "@bot123"
to: "U1234567890abcdef1234567890abcdef"
messages:
- type: "text"
text: "Hello from Home Assistant!"
# Reply to a message
service: notify.linebot_reply_message
data:
name: "@bot123"
reply_token: "{{ trigger.event.data.reply_token }}"
messages:
- type: "text"
text: "Got your message!"
Example Automation
automation:
- alias: "LINE Bot Reply"
trigger:
platform: event
event_type: linebot_@bot123_message_received
action:
service: notify.linebot_reply_message
data:
name: "@bot123"
reply_token: "{{ trigger.event.data.reply_token }}"
messages:
- type: "text"
text: "Hello! This is the Home Assistant LINE Bot"
MCP Tools
Available tools for AI assistants:
push_message
— Send a messagereply_message
— Reply to a messageget_quota
— Get usage quota
MCP SSE Endpoint:
http://your-ha-url:8123/linebotmcp/sse
📱 Supported Message Types
Type | Description | Example |
---|---|---|
text | Plain text message | {"type": "text", "text": "Hello"} |
textV2 | Text with mentions/emojis | Includes mentions and emojis |
image | Image message | Requires image and preview URLs |
video | Video message | Requires video and preview URLs |
audio | Audio message | Requires audio URL and duration |
location | Location message | Includes coordinates and address |
sticker | Sticker message | Requires package ID and sticker ID |
flex | Flex message | Custom layout design |
imagemap | Imagemap message | Image map with actions |
template | Template message | Buttons and text layout |
🔧 Advanced Settings
Options
- Agent ID — Specify which conversation agent to use (default:
conversation.google_generative_ai
) - Auto Reply — Enable or disable automatic responses
Events
This integration emits the following events:
linebot_mcp_{bot_name}_message_received
— When a message is receivedlinebot_mcp_{bot_name}_postback
— When a postback is received
Events include the user ID, message content, reply token, and other metadata.
🐛 Troubleshooting
Common Issues
Webhook not receiving messages:
- Check the webhook URL configuration
- Ensure Home Assistant is accessible from the internet
- Verify the Channel Secret
MCP connection failed:
- Check your network connection
- Check Home Assistant logs
Failed to send messages:
- Verify Channel Access Token
- Ensure message format is correct
- Confirm the recipient's user ID
Debug Logging
logger:
default: warning
logs:
linebot_mcp: debug
📚 Resources
🙏 Acknowledgements
The MCP server part was developed with reference to homeassistant-mcp-server.