Skip to main content

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

1

Start Mori with MCP enabled

The MCP server starts alongside the proxy on a separate port.
2

Tools registered by engine

Mori registers the correct tools based on your database engine (SQL, Redis, or Firestore).
3

Agent connects via HTTP

AI agents connect to http://127.0.0.1:<mcp-port>/mcp using the MCP protocol.
4

Queries routed through proxy

The MCP server connects to the Mori proxy as a regular database client. From its perspective, Mori is just a database.

Tools by Engine

SQL Engines — db_query

All SQL engines share a single db_query tool. The underlying database driver varies by protocol:
EngineDriverProtocol
PostgreSQL, CockroachDB, SQLite, DuckDBpgxpgwire
MySQL, MariaDBgo-sql-driver/mysqlMySQL wire
MSSQLgo-mssqldbTDS
Tool: db_query
ParameterTypeRequiredDescription
querystringYesSQL query to execute
{
  "tool": "db_query",
  "arguments": {
    "query": "SELECT * FROM users WHERE id = 1"
  }
}

Redis — 4 Tools

ToolParametersDescription
redis_commandcommand (string, required)Execute any Redis command (e.g., SET key value, HGETALL myhash)
redis_getkey (string, required)Get the value of a key
redis_hgetallkey (string, required)Get all fields and values of a hash
redis_keyspattern (string, required)Find keys matching a pattern (e.g., user:*)
The Redis MCP handler connects to the Mori proxy using the raw RESP protocol with AUTH support.

Firestore — 3 Tools

ToolParametersDescription
firestore_getcollection (string), document_id (string)Get a document by collection and ID
firestore_listcollection (string), limit (number, optional)List documents in a collection (default 25, max 100)
firestore_querycollection (string), field (string), op (string), value (string), limit (number, optional)Query with a field filter
Supported operators for firestore_query: ==, !=, <, <=, >, >=, in, array-contains The Firestore MCP handler connects to the Mori proxy via gRPC as a Firestore emulator client.

Configuration

# Start Mori with MCP server on port 9000
mori start --mcp --mcp-port 9000
The MCP endpoint is available at 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.