feat: write outbound MCP messages to homelab bot inbox

MCP bot now writes to ~/homelab/telegram/inbox alongside posting
to the group chat, so the homelab bot can process the messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mikkel Georgsen 2026-03-30 12:29:37 +00:00
parent 8ede43395e
commit 65f84f9552

View file

@ -258,6 +258,16 @@ class BridgeBot:
return "".join(result)
async def _write_to_homelab_inbox(self, text: str, attribution: str = "claude.ai"):
"""Write message to the homelab bot's inbox file for processing."""
inbox_path = Path.home() / "homelab" / "telegram" / "inbox"
try:
with open(inbox_path, "a") as f:
f.write(f"[{attribution}] {text}\n")
logger.info(f"Wrote to homelab inbox: {text[:50]}...")
except Exception as e:
logger.error(f"Failed to write to homelab inbox: {e}")
async def _outbound_loop(self):
"""Poll outbound queue and send messages."""
while True:
@ -266,6 +276,7 @@ class BridgeBot:
for msg in pending:
try:
await self.send_to_group(msg["content"], msg["attribution"])
await self._write_to_homelab_inbox(msg["content"], msg["attribution"])
self.db.mark_outbound_sent(msg["id"])
logger.info(f"Sent outbound message {msg['id']}")
except Exception as e: