- Python 99.5%
- Dockerfile 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| data | ||
| docs | ||
| mautrix_max | ||
| tests | ||
| tools | ||
| vendor/pymax | ||
| .dockerignore | ||
| .editorconfig | ||
| .env.example | ||
| .gitattributes | ||
| .gitignore | ||
| AGENTS.md | ||
| API.md | ||
| CHANGELOG.md | ||
| CITATION.cff | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| example-config.yaml | ||
| LICENSE | ||
| Makefile | ||
| MANIFEST.in | ||
| pyproject.toml | ||
| README.en.md | ||
| README.md | ||
| requirements.lock | ||
| ROADMAP.md | ||
| SECURITY.md | ||
| SUPPORT.md | ||
| THIRD_PARTY_NOTICES.md | ||
Русский · English
Your MAX chats in Element or any other Matrix client: direct chats, groups, channels and media.
Plus a searchable archive, scheduled messages and a local API for scripts and AI agents.
Quick start · Features · Logging in · API · Documentation
Note
This project is not affiliated with MAX, VK, the Matrix.org Foundation or Element. It uses the unofficial MAX client protocol, so changes on the MAX side may require a bridge update. The bot, the detailed guides and most messages are in Russian, since MAX is a Russian messenger.
Why
MAX lives in its own app. With the bridge, its chats sit next to the rest of your conversations in Matrix: one client on every device, history on your own Synapse server. For automation the bridge exposes a local API, so a script or an agent can find the right conversation, read its history and schedule a message.
Features
|
🔐 QR login |
🗂️ Archive and search |
|
⏰ Scheduled messages |
🤖 API for agents |
What the bridge carries:
| Matrix → MAX | MAX → Matrix | |
|---|---|---|
| Text | ✅ | ✅ |
| Photos, audio, voice messages, files | ✅ | ✅ |
| Video | ✅ | ✅ including MPEG-DASH → MP4 |
| Replies and quotes | ✅ | ✅ |
| Reactions | ✅ | ⚠️ experimental |
| Direct chats by phone number | ✅ | — |
| Groups and channels | ✅ | ✅ |
| Joining by invite link | ✅ | — |
| Leaving and locally blocking a chat | ✅ | — |
| Contact's phone in the direct chat topic | — | ✅ if MAX provides it |
How it works
flowchart LR
client["Element or another<br/>Matrix client"] <--> synapse["Synapse"]
synapse <-->|Application Service| bridge["matrix-max-bridge"]
bridge <-->|PyMax| max["MAX"]
bridge --- db[("Bridge database<br/>and archive")]
tools["matrix-max,<br/>scripts and agents"] -->|Unix socket| bridge
classDef matrix fill:#0a9a74,stroke:#2be3b0,color:#ffffff
classDef maxnode fill:#6f4bff,stroke:#a98bff,color:#ffffff
classDef core fill:#11132e,stroke:#8f6bff,color:#ffffff
class client,synapse matrix
class max maxnode
class bridge,db,tools core
- Every Matrix user connects their own MAX account; sessions are stored separately.
- A direct chat is a room with a "ghost" user
@max_<id>:your-domain. - By default the bridge bot posts group messages with the author's name in the text, so the bridge does not register a Matrix user for every member of a large group.
Quick start
You need Synapse with access to its Application Service configuration, Docker with Compose, and Linux.
1. Get the bridge and prepare the config
git clone https://github.com/rodmanvictor/matrix-max-bridge.git
cd matrix-max-bridge
cp .env.example .env
mkdir -p data
cp example-config.yaml data/config.yaml
In data/config.yaml set your Matrix domain, the Synapse address, the Application Service address and user permissions. All options are described in docs/configuration.md (in Russian).
2. Generate the registration file
docker compose build
docker compose run --rm mautrix-max python -m mautrix_max -g \
-c /opt/mautrix-max/data/config.yaml \
-r /opt/mautrix-max/data/registration.yaml
3. Add the registration to Synapse in homeserver.yaml and restart Synapse:
app_service_config_files:
- /path/to/matrix-max-bridge/data/registration.yaml
4. Start the bridge
docker compose up -d
docker compose logs -f mautrix-max
5. Log in to MAX with a QR code as described below.
The full guide with Docker networks, PostgreSQL and upgrades is in docs/installation-docker.md; running without Docker is covered in docs/installation-systemd.md. Both are in Russian.
Logging in to MAX
You log in from an interactive terminal on the server, not from a Matrix chat, so codes and passwords never end up in room history.
docker compose exec -e MAX_AUTH_MXID=@you:example.org \
-e MAX_DATA_DIR=/opt/mautrix-max/data \
mautrix-max python -m mautrix_max.qr_cli
- Scan the QR code in the terminal with the MAX app on your phone.
- If two-factor protection is on, enter the password. It is not echoed.
- The bridge picks up the new session within 15 seconds. Check it with
!max pingin the chat with@maxbot:your-domain.
The tool never overwrites an active session. To log in again or switch accounts, send !max logout to the bot first.
Tip
Your Matrix ID needs the
useroradminlevel inbridge.permissions.MAX_DATA_DIRis the directory that containssessions/frombridge.max.session_dir.
Bot commands
Send the commands in a direct chat with the bridge bot.
| Command | What it does |
|---|---|
!max login |
Reminds you how to log in with a QR code |
!max logout |
Ends the MAX session |
!max ping |
Checks the bridge and the login |
!max add +79991234567 |
Creates or opens a direct chat by phone number |
!max contact [MAX ID] |
Shows the name, MAX ID and phone, if available |
!max join <link> |
Joins a group or channel by invite link |
!max syncgroups [chat_id or room_id] |
Checks group rooms and invites |
!max leave [chat_id] |
Leaves a MAX group or channel |
!max block [chat_id] |
Leaves the chat and leaves again whenever you are re-added |
!max unblock [chat_id] |
Removes the local block |
!max blocked |
Lists blocked chats |
The full reference is in docs/commands.md (in Russian).
API for scripts and agents
The API is off until you name its owner. Add these environment variables to the mautrix-max service in docker-compose.yml and restart the bridge:
MAX_RPC_MXID: "@you:example.org"
MAX_RPC_SOCKET: /opt/mautrix-max/data/run/max.sock
The tools/matrix-max tool then talks to the bridge over the socket. Only the user running the bridge can open the socket, so run the tool as that user or as root:
export MATRIX_MAX_SOCKET=$PWD/data/run/max.sock
tools/matrix-max contacts 'Anna' # find a contact and its ID
tools/matrix-max history --chat 123456 --pages 1 # recent history of a chat
tools/matrix-max archive-search 'contract' --limit 20 # search the archive
tools/matrix-max send-delayed --chat 0 \
--at '2026-12-01 09:00' --text-file note.txt # schedule a message
Chat 0 is your own "Saved messages", a safe place to test sending. send-delayed reads the time in Moscow time; set another zone with --tz. The tools/matrix-agent tool uses the standard Matrix API: rooms, history, search, sending text and files.
Caution
Anyone who can open the socket can read the archive and send messages as you. The socket is created with mode
0600; do not share it with other containers or users.
Every API method and tool option is described in API.md.
Limitations
- no Matrix end-to-end encryption;
- old history is not imported into Matrix rooms; the archive complements them but does not replace them;
- archive search is incomplete, every answer is marked
partial; - edits and deletions are not bridged;
- MAX → Matrix reactions depend on protocol push events and may not arrive;
- inline keyboards and some service attachments of MAX are not shown;
- no double puppeting.
See ROADMAP.md for plans (in Russian).
Security
A MAX session gives full access to the account. Never publish data/config.yaml, data/registration.yaml, the bridge database, the data/sessions/ directory, tokens or full debug logs. The archive stores message text, so restrict access to the database and its backups.
Run python tools/check_release.py before publishing changes. Report vulnerabilities privately as described in SECURITY.md.
Documentation
| Document | About |
|---|---|
| Docker installation | Step-by-step setup, networks, upgrades, backups |
| systemd installation | Running without Docker |
| Configuration | config.yaml options, permissions, databases |
| Commands | Every bot command |
| API and tools | Local API, matrix-max, matrix-agent (in English) |
| Architecture | Sessions, portals, groups |
| Troubleshooting | Common errors and what to do |
| Changelog | What each version brought |
Documents without a note are in Russian.
Development
python -m venv .venv
source .venv/bin/activate
python -m pip install --no-build-isolation -e .
python -m unittest discover -s tests -p 'test_*.py'
python tools/check_release.py
The tests run offline against fakes. How to propose a change is described in CONTRIBUTING.md.
Origin and credits
This project continues pymatrix-max by NijazKa: the bridge core comes from version 0.12.0 (commit 9aca964) and is developed separately since then.
How it differs from pymatrix-max 0.12.0
| pymatrix-max 0.12.0 | matrix-max-bridge 0.14 | |
|---|---|---|
| MAX login | phone, code and password in a Matrix chat | QR code in a server terminal |
| Archive and search | — | ✅ |
| Local API and tools | — | ✅ |
| Scheduled messages | — | ✅ |
| PyMax | 2.3.1 | 2.5.0 |
| Automated tests | — | ✅ |
Details are in CHANGELOG.md.
Thanks to the projects the bridge is built on:
- pymatrix-max, the original bridge by NijazKa;
- PyMax, the MAX client, vendored in
vendor/pymax; - mautrix-python, the Matrix bridge framework;
- FFmpeg, which turns MPEG-DASH video into MP4.
License
MIT. The license file keeps the copyright lines of NijazKa and of the current author. Notes on PyMax and other components are in THIRD_PARTY_NOTICES.md.
If the project helps you, give it a ⭐ — it makes it easier for others to find.