ANDI AI · Secure MongoDB query compiler

Your AI agent can talk to MongoDB. It shouldn't write the query.

ANDI compiles natural-language intent into validated, index-aware, read-only BSON—without sending your production records to an LLM.

01 Records stay local02 Read-only by design03 Native PyMongo & Motor
query.compilerLOCAL
Agent intent

“Find Alex's language and wallet balance.”

email = ${target_email}
schema-aware compilation
01Resolve schemaPASS
02Map relationsPASS
03Order stagesPASS
04Bind inputsPASS
01$matchindex first
02$lookupusers → wallets
03$project2 fields

Zero records sent to the modelExecution stays inside your environment

BUILT FORAI agentsInternal copilotsDynamic analyticsEnterprise MongoDB
The problem

The dangerous part starts after the agent connects.

A standardized tool call does not make a generated query correct, efficient, or safe to execute against production.

01

Production data exposure

Most text-to-database tools send records or user data through an external model. ANDI sends structural schema metadata—not your documents.

02

Hallucinated BSON

Raw LLM output breaks on nested $lookup, $unwind, $facet, and $group stages. ANDI compiles against the schema and validates the result.

03

An open write path

Prompt injection should never become a database command. ANDI rejects insert, update, delete, $out, and $merge at the core engine.

VectorDBA vs. Mongo MCP Server

MCP is the pipe. ANDI is the engine.

They solve different layers of the stack—and work best together.

CapabilityM Mongo MCP ServerA ANDI
Primary jobStandardize how an agent connectsCompile what the agent is allowed to run
Query authorThe LLM writes raw MongoDBA schema-aware deterministic engine
Complex pipelinesModel-dependentPlanned and validated stage by stage
Runtime inputsOften embedded in generated stringsBound separately with typed placeholders
Production recordsDepends on the implementationRemain inside your environment
Write operationsDepends on exposed toolsBlocked at the core library
The production stack

Use them together.

MCP gives every agent the same doorway. ANDI checks what comes through it.

CLIENTAI Agent
→
TRANSPORTMCP
→
COMPILERANDI
→
DATABASEMongoDB
How it works

Five deterministic stages. One predictable query.

ANDI separates model reasoning from runtime execution so every stage can be inspected, constrained, and validated.

01

Intent

Split the goal into filters, projections, aggregation, and sort.

02

Schema

Resolve real collection keys and isolate local BSON types.

03

Relations

Map cross-collection references into correct joins.

04

Plan

Order $match before memory-heavy stages to preserve indexes.

05

Validate

Bind runtime inputs and emit executable, read-only BSON.

One request, compiled safely

Natural language in. Native BSON out.

Runtime values are declared as typed placeholders, then bound locally at execution time. The model never gets a chance to turn an email address into query logic.

  • ✓ Fields checked against the live schema
  • ✓ Relationships resolved across collections
  • ✓ Index-friendly stage ordering enforced
  • ✓ Mutation operators blocked before execution
intent.pycompiled.jsonREAD ONLY
intent = {
  "goal": "Find the preferred language and
           wallet balance for this user",
  "runtime_inputs": [{
    "email": "${target_email}",
    "datatype": "string"
  }],
  "projection": [
    "preferred_language",
    "wallet.balance"
  ]
}

plan = andi.build_nlp_query(intent=intent)

result = andi.run_query_executor(
  plan,
  target_email="alex@example.com"
)
schema validated 3 stages local execution
GET /usersGET /walletsPOST /analyticsGET /leaderboardPOST /summaryGET /metrics
→
ONE SAFE GATEWAYPOST /nlp_queryfind() + aggregate()
The dynamic backend

Stop shipping a new endpoint for every question.

Give product teams and agents one flexible read layer—without handing them unrestricted access to your cluster.

1query endpoint
2safe operations
0records sent to LLMs
Quick start

From install to first safe query in minutes.

ANDI is open-source, MIT licensed, and works with the MongoDB connection you already have.

View ANDI-AI on PyPI
terminal
$ pip install andi-aifrom andi import Andi agent = Andi(db_session="", analyzed_schemas=[]) agent.initialize_connection( connection_string="mongodb://localhost:27017", database_name="production") agent.analyze_schemas(["users", "wallets"])# Your records stay here. Your agent gets a safe plan.
FAQ

The questions your security team will ask.

Is ANDI an MCP server?

No. MCP is a transport standard; ANDI is the query compiler and safety layer. Wrap ANDI in an MCP server to give any compatible agent a standardized, production-safe MongoDB tool.

Does the model see my MongoDB records?

No. ANDI reasons over structural schema metadata. Query execution happens locally through the native MongoDB driver, so production documents and returned results do not need to leave your environment.

What MongoDB operations are supported?

ANDI supports read-only find() and aggregate() workloads, including filters, projections, sorting, limits, joins, unwinds, and grouping. Mutating operations are intentionally denied.

Do I need to replace my existing MCP server?

No. Use the MCP server as the universal connection layer and call ANDI inside it. MCP provides the pipe; ANDI provides the engine and guardrails.

Built for production agents

Ship the agent.
Keep the database boring.

Predictable queries. Local data. Guardrails all the way down.