Overview
Mori includes an MCP (Model Context Protocol) server that lets AI coding agents interact with databases through Mori’s copy-on-write proxy. The server registers engine-specific tools and exposes them over HTTP using the Streamable HTTP transport. All queries from the MCP server go through the Mori proxy — reads hit prod, writes go to shadow. The AI agent gets real production data for context while mutations are safely isolated.How It Works
Tools registered by engine
Mori registers the correct tools based on your database engine (SQL, Redis, or Firestore).
Agent connects via HTTP
AI agents connect to
http://127.0.0.1:<mcp-port>/mcp using the MCP protocol.Tools by Engine
SQL Engines — db_query
All SQL engines share a single db_query tool. The underlying database driver varies by protocol:
| Engine | Driver | Protocol |
|---|---|---|
| PostgreSQL, CockroachDB, SQLite, DuckDB | pgx | pgwire |
| MySQL, MariaDB | go-sql-driver/mysql | MySQL wire |
| MSSQL | go-mssqldb | TDS |
db_query
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | SQL query to execute |
Redis — 4 Tools
| Tool | Parameters | Description |
|---|---|---|
redis_command | command (string, required) | Execute any Redis command (e.g., SET key value, HGETALL myhash) |
redis_get | key (string, required) | Get the value of a key |
redis_hgetall | key (string, required) | Get all fields and values of a hash |
redis_keys | pattern (string, required) | Find keys matching a pattern (e.g., user:*) |
Firestore — 3 Tools
| Tool | Parameters | Description |
|---|---|---|
firestore_get | collection (string), document_id (string) | Get a document by collection and ID |
firestore_list | collection (string), limit (number, optional) | List documents in a collection (default 25, max 100) |
firestore_query | collection (string), field (string), op (string), value (string), limit (number, optional) | Query with a field filter |
firestore_query: ==, !=, <, <=, >, >=, in, array-contains
The Firestore MCP handler connects to the Mori proxy via gRPC as a Firestore emulator client.
Configuration
http://127.0.0.1:9000/mcp.
Use Cases
Safe Production Queries
AI agents query real production data. All reads go through Mori’s read-only prod connection.
Risk-Free Mutations
Agents can INSERT, UPDATE, DELETE freely. All writes are captured in shadow — production is never touched.
Test-Verify Loops
Agents make changes, verify results, and iterate. Reset shadow to start fresh at any time.
Schema Exploration
Agents inspect table structures, run diagnostic queries, and understand the database safely.
The MCP server connects to Mori’s proxy using the standard database driver for your engine. It doesn’t need to know about the prod/shadow split — that’s handled transparently by the proxy.

