Skip to main content

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 create or mact join that starts 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)

Run all CLI commands from a git checkout of your project (git init if needed).

# 1. Set your identity
mact init --developer alice

# 2. (Optional) Configure tunnel — needed to expose your local port publicly
mact configure-frp --server-addr m-act.live --server-port 7000 \
  --auth-token YOUR_FRP_TOKEN --vhost-domain tunnel.m-act.live

# 3. Create a room — from the project repo: registers with the API, ensures frpc
#    (download if missing), installs the git post-commit hook, then starts tunnel + heartbeat
mact create --room demo --port 3000
#   → prints join_secret, admin_token, member_token
#   Use --no-live to skip tunnel/heartbeat; --no-hook to skip the hook; --no-tunnel for heartbeat-only.

# 4. Share the join secret with collaborators — they run (same auto-setup):
mact join --room demo --port 3001 --secret <join_secret>

# 5. Check room status anytime
mact status --room demo

# Optional: re-install only the post-commit hook (already done by create/join)
mact hook install --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).

The marketing homepage at / (full product name, PyPI, and GitHub: int33k/M-ACT) is served by this FastAPI app. If https://m-act.live/ still looks old, the droplet is running an older build: deploy the latest code and restart the API (Nginx already proxies / to uvicorn; there is no separate static index.html in the repo).

# On the server (adjust paths / venv / service name to match your setup)
cd /opt/mact   # or your clone of https://github.com/int33k/M-ACT
git pull origin main
./.venv/bin/pip install -e ".[server]"   # or: pip install -e .
sudo systemctl restart mact-server       # or: sudo systemctl restart uvicorn / your unit name
curl -sI https://m-act.live/ | grep -i cache-control   # should show no-store after deploy

CLI commands

Command Description
mact --version Print CLI version
mact ... --secure Optional: enable HTTPS certificate verification to the API
mact init --developer <id> Set developer identity
mact configure-frp ... Configure FRP tunnel settings
mact create --room <id> --port <port> [...] Create room; ensures frpc, installs post-commit hook, then tunnel + heartbeat unless --no-live / --no-hook / --no-tunnel
mact join --room <id> --port <port> --secret <s> [...] Same auto-setup as create
mact leave --room <id> Disconnect from a room
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 m-act.live Wildcard subdomain routing ({room}.m-act.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 https://m-act.live Control-plane API base URL used by CLI commands
MACT_FRP_VERSION v0.61.0 FRP release tag auto-downloaded when frpc is missing
MACT_CA_BUNDLE unset Path to a PEM file for HTTPS to the API (enables verify with that CA)
MACT_SSL_VERIFY false (default) Set to true to verify certificates (same idea as --secure)
REQUESTS_CA_BUNDLE unset Also honored by requests (corporate CA bundle)

By default the CLI does not verify TLS to the API (avoids issues behind proxies/antivirus). Use --secure or MACT_SSL_VERIFY=true when you want full verification, or MACT_CA_BUNDLE / REQUESTS_CA_BUNDLE to trust a custom root CA.

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=m-act.live and DNS *.m-act.live → server:

  • Mirror: https://{room}.m-act.live/
  • Dashboard: https://{room}.m-act.live/dashboard
  • Tunnel vhosts: http://{dev}-{room}.tunnel.m-act.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mact_cli-1.2.3.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mact_cli-1.2.3-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file mact_cli-1.2.3.tar.gz.

File metadata

  • Download URL: mact_cli-1.2.3.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mact_cli-1.2.3.tar.gz
Algorithm Hash digest
SHA256 d9cbb8d1473d121f139eb9a39a80ba9d2676948b7b016370a3575812ea125209
MD5 29501df5b14b6c666b3203be21b6958d
BLAKE2b-256 a3ef66f21bbe498dd9ca35297d41cc1e45621e4af1e32b44cc161017f5386c9d

See more details on using hashes here.

File details

Details for the file mact_cli-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: mact_cli-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mact_cli-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cbcfd9dd9c72c2264f4f98fa19b7ebeda433b384ff1b04b5c6e5016fb0f002d3
MD5 2f40abbf9d2be34062ba16f097df2059
BLAKE2b-256 b01f821940424b71ae57cc6a1b316caf47c45a33ae42a35448e9bc6a8e4ecedb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page