Documentation / Integrations
MCP server
Connect Claude Code, Cursor, Zed or another MCP client to an OpenDB project, read-only and with your privileges.
The Model Context Protocol (MCP) lets an external agent use another application's tools. OpenDB exposes its read tools this way: your coding assistant can query a project's database, with the same safeguards as OpenDB's own agent.
Create a token
A token gives access to one project, for one user.
From the interface
- Open Settings → MCP access.
- Name the token, for example after the client.
- Choose the project, then click Create.

From a terminal
opendb mcp:token-create "Claude Code" --project=shopWarning The configuration that contains the token is shown only once. Copy it right away. OpenDB only stores the token's hash and cannot show it to you again.
Configure the client
OpenDB shows the configuration to paste into your MCP client. It looks like this:
{
"mcpServers": {
"opendb-shop": {
"command": "opendb",
"args": ["mcp:serve"],
"env": {
"OPENDB_MCP_TOKEN": "odb_..."
}
}
}
}The token goes through an environment variable, not through the command's arguments: it does not show up in your machine's process list.
Paste this configuration where your client expects it: the MCP configuration file of Claude Code, Cursor or Zed. Always use the exact configuration shown by OpenDB, which contains the right path for your installation.
Available tools
| Tool | Purpose |
|---|---|
ListTables |
Lists the project's tables |
FocusTable |
Details a table and its relationships |
DatabaseSchema |
Returns the full schema |
ReadQuery |
Runs a read query |
ExplainQuery |
Computes the execution plan of a query |
ProfileTable |
Returns the statistical profile of a table |
These are the same tools as OpenDB's own agent, with the same parameters and the same checks.
What the external agent can do
- Read only. No write tool is exposed.
- With your privileges. It sees the tables you see, nothing more.
- On a single project, the token's.
Access to the project is checked again every time the server starts. If your privileges on the project are revoked, the token stops working, without you having to revoke it.
Note Rows read by an external agent are sent to that agent's provider. OpenDB's protections limit what it can read, not what its provider does with it.
List and revoke
In Settings → MCP access, each token shows its project and when it was last used. The delete button revokes it.
From a terminal:
opendb mcp:token-list
opendb mcp:token-revokeA revoked token stops working immediately.
Log
Every call from an external agent is recorded in ~/.opendb/logs/mcp.log: who, on which project, with which tool. The log is kept for fourteen days.
Limits
- Read-only. An external agent cannot change the database.
- Local only. The MCP client starts OpenDB on the same machine. There is no remote access.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| The server does not start | The token is missing or revoked, or your privileges on the project were removed |
| A table is missing | You have no privilege on that table |
| A query is refused | It writes, mentions a table out of your sight or contains several statements |
The reason for a refusal at startup is written to the server's error output, which most MCP clients show in their logs.