Skip to main content

Manual Setup

Prerequisites

  • Docker (for shadow containers — required for all engines except SQLite and DuckDB)

Install

curl -fsSL https://moridb.sh/install.sh | sh

Steps

1

Initialize a connection

Point Mori at your production database. The interactive setup walks you through engine, provider, and credentials.
mori init
For a non-interactive setup, you can pass a connection string directly:
mori init --from "postgres://user:pass@host:5432/mydb?sslmode=require"
This saves the connection config to mori.yaml. No containers or connections are created yet.
2

Start the proxy

mori start
On first run, Mori:
  1. Connects to your production database
  2. Discovers schema and structure (SQL engines dump tables/types/sequences; Firestore discovers collections; Redis scans key prefixes)
  3. Spins up a shadow database (Docker container, local file copy, or emulator)
  4. Replicates structure to shadow (SQL engines replay schema; Firestore seeds documents; Redis starts empty)
  5. Detects and replicates extensions to shadow (PostgreSQL — auto-installs via apt-get if needed; use --image on mori init for custom images)
  6. Offsets auto-increment sequences to prevent PK collisions (SQL engines only)
  7. Starts the proxy and listens on a local port
Use --port to pick a specific port, or let Mori auto-assign. Subsequent starts are faster since the shadow already exists.If complex queries over large tables are slow, you can limit how many rows Mori hydrates from prod per query:
mori start --max-rows 10000
3

Point your app at Mori

Swap your application’s connection string to point at 127.0.0.1 on the proxy port. Same driver, same protocol — your app won’t know the difference.
# Before (direct to prod)
DATABASE_URL=postgres://user:pass@prod-host:5432/mydb

# After (through Mori)
DATABASE_URL=postgres://user:pass@127.0.0.1:5432/mydb
4

Stop Mori

Closes the connection to prod and spins down the shadow container. State is persisted for future runs.
mori stop
5

Soft reset between runs

Wipe all local state to quickly start fresh on the next run.
mori reset
6

Hard reset when schema changes

Wipes all local state and deletes the shadow container. Use this when the production schema has changed since the last init. This takes longer than a soft reset.
mori reinit

Enabling the MCP Server

Start Mori with the MCP server for AI agent integration:
mori start --mcp --mcp-port 9000
AI agents connect to http://127.0.0.1:9000/mcp and get engine-specific tools (SQL queries, Redis commands, or Firestore operations) — all safely routed through the proxy.

Lifecycle

mori init         Connect to prod, discover structure, spin up shadow
     |
mori start        Start proxy, load state, accept connections
     |
  [app runs]      CRUD operations routed transparently
     |
mori stop         Persist state, shut down proxy
     |
mori reset        Wipe shadow data + metadata, clean slate

For AI Agents

If you’re setting up Mori with an AI coding agent, download the skill.md file and add it to your project root. Point your agent at it — it contains everything needed to install, initialize, and start Mori.
curl -fsSL https://moridb.sh/skill.md -o skill.md
Your agent can read skill.md and handle the rest autonomously.