# MCP database permissions: limiting what an AI agent can do

Source: https://osevel.com/learn/mcp-database-permissions/ · reviewed 2026-11-28

> An MCP server can do whatever its database login can. Limit three things: the login (its own role with only the rights it needs), the tools each agent is offered (read, write or schema), and the rules, enforced in the database so that a bypassed server changes nothing.

## Three places to limit

- The login: one role per job, not the admin’s, with only the rights it needs.
- The tools: an agent that only reads should not be offered a tool that writes.
- The rules: which statements run, which wait for a person, which are refused, enforced in the database.

## One more: one writable database per agent

Text an agent reads in one database can steer a write in another. Letting each agent write to one database by default keeps a prompt injection from crossing over.


## What OsBase does

- Each agent has its own key and a level: read (query, inspect, get_schema and more), write (adds execute and backfill) or schema (adds migrate).
- Tools above the level are neither listed nor callable; no tool approves, undoes or edits the rules.
- The database refuses what a role may not do, so the rules hold even if the bridge were bypassed.
- An agent writes to one database of a project by default; a second needs its own confirmation.

## Questions

### Do MCP clients not ask before running a tool?

Many do, but they show the tool call, not its effect. Limits that live in the database do not depend on someone reading every prompt.

### Can I lower an agent’s access later?

Yes, at once, from the terminal or the dashboard. Raising it needs a typed confirmation at the terminal.
