Skip to content

Adopt LukasHaas codebase (newer whatsmeow, LID support, unified tools) + bugfixes - #343

Open
vkpeter wants to merge 6 commits into
lharries:mainfrom
vkpeter:pr/lukashaas-plus-ours
Open

Adopt LukasHaas codebase (newer whatsmeow, LID support, unified tools) + bugfixes#343
vkpeter wants to merge 6 commits into
lharries:mainfrom
vkpeter:pr/lukashaas-plus-ours

Conversation

@vkpeter

@vkpeter vkpeter commented Aug 30, 2026

Copy link
Copy Markdown

What this PR does

This PR brings the whatsapp-mcp codebase up to date in two layers:

1. Sync with LukasHaas/whatsapp-mcp (single tree-snapshot commit)

The two repositories have unrelated git histories, so the LukasHaas state is applied as one tree snapshot on top of main rather than as a merge. Highlights of what that brings:

  • Newer whatsmeow (2026-06 vs 2025-03): WhatsApp LID (phone-number identifier) support, which is required for messages to resolve correctly on current WhatsApp accounts
  • LID resolution in the Python server (_get_lid_map, _get_whatsmeow_contacts): chat/contact lookups work for LID-migrated chats
  • Unified tools: send_message (text + media_path + �s_audio in one), get_chat (by chat_jid / phone_number / contact_jid)
  • Bridge: /api/sync endpoint (per-chat + general), waitForConnection robustness, reconnect event handling
  • Better contact search: full address book merge, accent-insensitive multi-word matching

2. Bugfixes on top (5 commits)

  • parse Go-format timestamps (+0200 CEST) in the Python MCP server
  • Media download 403 fix: keep the signed URL query string (oe/oh/mms3) in the direct path so downloads work
  • General sync fetches recent messages: /api/sync now anchors on "now" per chat instead of requesting history before the oldest stored message
  • modernc sqlite (no CGO) for the bridge, plus raw-QR printing and WA_PAIR_PHONE pairing
  • .gitignore: ignore *.exe

All commits use a neutral author. No personal data included.

Replaces the lharries codebase with the current LukasHaas/whatsapp-mcp
state (newer whatsmeow, LID resolution, unified send_message/get_chat
tools, /api/sync endpoint, robust reconnection) as a single tree
snapshot, because the two repositories have unrelated git histories.

This is the base for the follow-up fixes (timestamp parsing, media 403,
general sync) that are stacked on top.
extractDirectPathFromURL() stripped the query parameters (oe expiry,
oh origin hash, mms3) before handing the path to whatsmeow, which then
rebuilt the media URL without them. mmg.whatsapp.net answered 403 for
every download, including fresh media. Keep the full path+query so the
download works; whatsmeow appends its own hash/mms-type params after.
…lder history

requestHistorySync anchored on the oldest stored message and asked for
history *before* it, so POST /api/sync never recovered messages that
arrived while the bridge was offline. It now requests recent messages
for every known chat by anchoring on 'now' (same synthetic-anchor
pattern as requestChatSync for chats without stored messages).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants