Mirrored Active Collaborative Tunnel — CLI to share live localhost previews with your team
Project description
MACT
Mirrored Active Collaborative Tunnel — route a stable public URL to the localhost of the developer who last committed, with automatic fallback and an offline page when nobody is connected.
Progress and planning live in project-tracking/ (PROGRESS.md,
ROADMAP.md).
Install
pip install mact-cli # from PyPI (once published) — CLI only (requests + frpc download on first tunnel use)
# Self-host the control-plane API from the same repo / sdist:
pip install "mact-cli[server]"
# Editable for development (CLI + server deps + tests):
pip install -e ".[dev]"
If frpc is not on your PATH, the first mact up with a tunnel downloads a matching frp release into ~/.cache/mact/frp/<version>/ (override the tag with MACT_FRP_VERSION, e.g. v0.61.0).
Quick start (developer)
# 1. Set your identity
mact init --developer alice
# 2. (Optional) Configure tunnel — needed to expose your local port publicly
mact configure-frp --server-addr mact.live --server-port 7000 \
--auth-token YOUR_FRP_TOKEN --vhost-domain tunnel.mact.live
# 3. Create a room
mact create --room demo --port 3000
# → prints join_secret, admin_token, member_token
# 4. Share the join secret with collaborators — they run:
mact join --room demo --port 3001 --secret <join_secret>
# 5. Start the tunnel + heartbeat (keep this running while developing)
mact up --room demo --port 3000
# 6. Install the git post-commit hook (reports commits automatically)
mact hook install --room demo
# 7. Check room status anytime
mact status --room demo
Quick start (server)
Operators run the FastAPI app with uvicorn (not published as a separate console script on PyPI):
pip install "mact-cli[server]"
uvicorn mact.server.main:app --host 0.0.0.0 --port 8000
Default data store is SQLite at ./mact.db. For production, use
PostgreSQL and run migrations (see Database migrations).
CLI commands
| Command | Description |
|---|---|
mact init --developer <id> |
Set developer identity |
mact configure-frp ... |
Configure FRP tunnel settings |
mact create --room <id> --port <port> |
Create room, get tokens |
mact join --room <id> --port <port> --secret <s> |
Join with secret |
mact up --room <id> [--port <p>] [--no-tunnel] |
Start tunnel + heartbeat |
mact status --room <id> |
Fetch room status |
mact rooms |
List locally saved rooms |
mact hook install --room <id> |
Install git post-commit hook |
mact commit-report --room <id> |
Report HEAD commit (used by hook) |
Environment (server)
| Variable | Default | Meaning |
|---|---|---|
DATABASE_URL |
sqlite:///./mact.db |
SQLAlchemy URL (postgresql+psycopg://... for Postgres) |
MACT_AUTO_CREATE_TABLES |
true |
Create tables on startup (dev only) |
MACT_PRESENCE_TTL_SECONDS |
60 |
Member liveness TTL |
MACT_PUBLIC_BASE_DOMAIN |
mact.live |
Wildcard subdomain routing ({room}.mact.live). Empty disables. |
MACT_DEV_DASHBOARD |
unset/false | Enable dev-only path dashboard routes (/rooms/{id}/dashboard) |
Environment (CLI)
| Variable | Default | Meaning |
|---|---|---|
MACT_BACKEND_URL |
http://127.0.0.1:8000 |
Control-plane API base URL used by CLI commands |
MACT_FRP_VERSION |
v0.61.0 |
FRP release tag auto-downloaded when frpc is missing |
API endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
GET |
/health |
— | Liveness check |
GET |
/ready |
— | Readiness (DB reachable) |
POST |
/rooms |
— | Create room → tokens |
POST |
/rooms/{id}/join |
join_secret in body | Join room → member_token |
POST |
/rooms/{id}/commits |
Bearer member_token | Report commit |
PATCH |
/rooms/{id}/commits/{hash}/comment |
Bearer admin_token | Set/clear admin comment |
GET |
/rooms/{id}/status |
— | Room status JSON |
POST |
/rooms/{id}/presence/heartbeat |
Bearer member_token | Heartbeat (+ optional upstream update) |
POST |
/rooms/{id}/presence/disconnect |
Bearer member_token | Disconnect |
GET |
/r/{id}[/path] |
— | Mirror HTTP proxy to active upstream |
WS |
/r/{id}[/path] |
— | Mirror WebSocket to active upstream (same path/query as HTTP) |
GET |
/dashboard |
— | Room dashboard (subdomain only) |
Public URLs (production)
With MACT_PUBLIC_BASE_DOMAIN=mact.live and DNS *.mact.live → server:
- Mirror:
https://{room}.mact.live/ - Dashboard:
https://{room}.mact.live/dashboard - Tunnel vhosts:
http://{dev}-{room}.tunnel.mact.live(via frps)
Path-based routing (/r/{room}) remains for local dev or when subdomain routing
is disabled.
Expose the API only behind trusted network controls (private network, VPN, or auth gateway). By design, room creation/status endpoints are open unless you add an external access-control layer.
Database migrations
cd "/path/to/M ACT"
alembic upgrade head
Set MACT_AUTO_CREATE_TABLES=false when using Alembic in production.
Tests
pip install -e ".[dev]"
pytest -v
Architecture
See ARCHITECTURE.md for the full design, phased delivery plan, security notes,
and distributed systems considerations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mact_cli-1.1.0.tar.gz.
File metadata
- Download URL: mact_cli-1.1.0.tar.gz
- Upload date:
- Size: 44.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4bb814be19338c8765a9df8e30d0b19fd0dc63798544cd248c624408d8aed4b
|
|
| MD5 |
047c3bd4d2699b620c4f406cf1096421
|
|
| BLAKE2b-256 |
46f4d565950ba2429575d82c782208c94d269bfae3cf6d8d9853e80aacd1e872
|
File details
Details for the file mact_cli-1.1.0-py3-none-any.whl.
File metadata
- Download URL: mact_cli-1.1.0-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88fe8e645f0fe4940df0f14f9e299c106f122ce9f747870a4cda40fc9f793a07
|
|
| MD5 |
33cb8fc22bac1901de1316f0552b07e1
|
|
| BLAKE2b-256 |
cc8ccafbf136e5a3ad935b34b739372e6f54b3c231d1a3e1cb8f000b44312a8e
|