How to Configure Goose MongoDB Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up goose mongodb approval by turning on prompt checks in your local agent. You also assign strict database roles to limit what the AI tool can change. Engineering teams often connect AI agents to local or staging databases for fast debugging. When teams use broad database roles, the agent can change or delete records by mistake. A clear approval setup stops bad writes before they hit your data. How goose mongodb approval works with database roles A safe setup starts with two parts wor

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up goose mongodb approval by turning on prompt checks in your local agent. You also assign strict database roles to limit what the AI tool can change. Engineering teams often connect AI agents to local or staging databases for fast debugging. When teams use broad database roles, the agent can change or delete records by mistake. A clear approval setup stops bad writes before they hit your data.

How goose mongodb approval works with database roles

A safe setup starts with two parts working together. First, the AI agent asks a human before it runs a tool action. Second, the database enforces role rules on the user account the agent uses. MongoDB grants access through role-based rules that allow actions on set resources. A role applies to its defined database and works down to the collection level. MongoDB Atlas users have different built-in roles than self-hosted users. Still, both types use the same core set of privilege actions.

For most AI tasks, teams start by assigning a read role to the agent. The read role lets the agent view all non-system collections in that database. It allows actions like finding documents, listing collections, and checking index or database stats. The read role does not allow inserting, updating, or removing records. It also blocks the agent from dropping a collection. When the agent must fix data, teams often switch to a read and write role. That role adds actions to insert, update, and remove documents. It also allows the user to create or drop collections and indexes.

What native setup solves and what it misses

Local agent prompts and database roles solve the basic problem of who can log in. Database roles set a hard ceiling on what the account can do overall. If an agent only has read rights, it cannot drop a collection. Meanwhile, local prompt checks let a developer read a command before it runs. This stops simple mistakes during a coding session on one machine.

Still, this basic setup leaves a big gap during daily team operations. Database roles check who logs in, not what each command does in flight. Once a user has write rights, the database allows any update or drop action. The database cannot pause a risky delete command to ask a team lead first. Local agent prompts also stay on one developer laptop. A user can turn off the local check or click yes without reading closely. There is no shared team log of which person approved a risky database change.

Approval Chains & Escalation + MongoDB Authentication & Authorization: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing sensitive data and team reviews

When an AI agent reads a collection, it pulls whole documents into its context window. Those documents often hold private fields like emails, phone numbers, card numbers, or national IDs. Standard database roles work at the collection level, not the field level. If the agent can read a collection, it gets every field in those records. Masking rules that rewrite matched fields in results help keep private data out of prompts.

Teams also need a better way to handle write actions across many developers. Instead of giving every laptop full write rights, teams can route agent requests through shared checks. Read queries can run right away while write commands wait for a peer review. This keeps the AI agent useful without risking production data.

Inspect MongoDB wire traffic in flight

Built-in MongoDB roles govern collection access at setup time. They cannot score command risk per call or mask sensitive document values on the fly. By design, hoop.dev is an open-source proxy that sits next to MongoDB as a sidecar for your MongoDB. It reads every command from mongosh, drivers, or agent tools.

First, hoop.dev guardrails block bad deletes, drops, and write pipelines. Next, hoop.dev data masking rewrites sensitive values in returned documents based on your rules and logs each decision. Explore the repo on GitHub.

Frequently asked questions

Can MongoDB roles stop an AI agent from dropping a collection?

Yes, the built-in read role blocks drop collection actions. Still, the standard read and write role allows dropping collections and indexes. You must create a custom role if you want writes without drop rights.

Why are local agent prompts not enough for goose mongodb approval?

Local prompts only ask the person sitting at that laptop. They do not enforce team rules or create a central audit log. A tired developer can click approve on a bad query by mistake.

How do we protect private fields when Goose reads documents?

Built-in database roles grant access down to the collection level, not to single fields. To protect emails or card numbers, use a tool that rewrites matched fields in results.

The query runs. The emails stay hidden.