# anydb-mcp [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/officialalexeev/anydb-mcp  
**GitHub Stars:** 1  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/anydb-mcp

## Description
One MCP server for five databases — PostgreSQL, MySQL, SQLite, MongoDB and Redis — with named connection profiles, so database passwords never enter the model's context window.

## Tools
Capabilities this server exposes over MCP:

- **db_list** — List the connection profiles from the anydb config file (~/.anydb/db.json): name, description, driver, which one is the default, and whether it is read-only. Call this first whenever you do not already know a profile name, then pass the name to the other tools as "profile". The result never contains a connection string, a host, a username or a password -- not masked, absent -- because this text goes into your context window and a config file is writable by anyone who can write files. If there is no config file, use "uri" with the other tools instead.
- **db_query** — Run one statement against one database (PostgreSQL, MySQL/MariaDB, SQLite, MongoDB or Redis, inferred from the connection). READ-ONLY BY DEFAULT: writes are refused unless "readOnly" is false, and statements that change schema or privileges additionally require "allowDestructive" to be true. Call db_list and db_schema first so table and column names are not guessed, and prefer "params" over inlining values in "query" so the values never appear in the statement text. Put a LIMIT in every query: results are capped anyway, and a cap you did not ask for is how a table gets silently half-read. MongoDB: "collection" is required and "action" picks the operation -- find, count, distinct, aggregate and explain read; insert, update, updateOne, replace, delete and deleteOne write and need "readOnly": false. Prefer the *One actions: one document, not every match. Redis: "query" is a single command such as GET or SCAN.
- **db_schema** — Describe the structure of a database: tables and their columns for SQL, collections with their indexes for MongoDB, keyspace statistics for Redis. Call it before writing a query so names are not guessed -- it is almost always cheaper than a failed query. Runs read-only introspection statements only, never a statement of yours, and "table"/"collection" are bound as parameters wherever the driver allows rather than pasted into SQL. "detail": "full" adds foreign keys, index definitions, primary and unique constraints, row estimates, and inferred field schemas for MongoDB.
- **db_explain** — Return the execution plan for a statement WITHOUT running it. Read-only by construction: the statement is planned and not executed, so this is the safe way to catch a sequential scan over a large table and the cheapest way to find a missing index. ANALYZE variants are refused here on purpose, because "EXPLAIN ANALYZE" runs the statement it plans. MongoDB: pass "collection" and a find filter as "query"; a pipeline cannot be explained, use db_query action "aggregate" with a small limit. Redis has no plans, so this tool refuses it.
- **db_health** — Ask the database about itself: reachable or not, server version, the role this server authenticated as, whether that role or the server is read-only, object counts, and this server's pool and cache state. Use it instead of guessing at why a connection or a write failed. Note what "readOnly": false does and does not do: it is a request to THIS server, not a security boundary. The boundary is the database role -- a role holding INSERT will succeed whatever these flags say, and a role without them will fail however many are set.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "anydb-mcp": {
    "command": "npx",
    "args": ["-y","anydb-mcp"]
  }
}
```

## Documentation

## What anydb-mcp MCP server does

The anydb-mcp MCP server connects an MCP-compatible AI client to PostgreSQL, MySQL or MariaDB, SQLite, MongoDB, and Redis. It presents the databases through five shared tools rather than separate tools for each database type. The selected database driver comes from the named connection profile supplied to a tool.

The server is listed in the 🗄️ Databases category and is suited to agents that need to inspect or query several database systems without changing their tool interface. It can also be used with a single database when keeping credentials outside the model context is important.

## How it works

Connection details are stored in named profiles in `~/.anydb/db.json`. Tools receive a profile name instead of requiring the model to provide a connection string or password. `db_list` returns profile names and non-identifying metadata, so an agent can discover available profiles before calling another tool.

The server communicates over MCP using standard input and output. It writes logs to stderr so stdout remains available for protocol messages. Node.js 20.19 or newer is required. The same `npx -y anydb-mcp` command can be registered with supported clients; only the client configuration format changes.

## Setup and configuration

To create an initial local configuration, make the directory and copy the included example:

```bash
mkdir -p ~/.anydb
cp examples/db.json ~/.anydb/db.json
```

That example uses SQLite and does not require a host, account, or secret. For other databases, create profiles using the repository’s example configuration as a guide. The configuration file can be placed elsewhere by setting `ANYDB_CONFIG=/path/to/db.json` in the client environment; the default location is used when it is not set.

Register the server as a stdio process with the MCP client. Other clients that launch standard stdio MCP servers can use the same command. On Windows, a client that cannot launch `npx` through a shell may need `npx.cmd`.

## Tools and capabilities

- `db_list` reports profile names and selected metadata without exposing identifying connection details.
- `db_query` runs one statement against one selected database. It is the only tool described as capable of changing data, so calls should be reviewed when writes are possible.
- `db_schema` returns database structure such as tables, columns, indexes, or keyspace information, depending on the driver.
- `db_explain` returns a statement’s execution plan without running the statement.
- `db_health` checks reachability and reports what the configured role can do.

Four tools are marked read-only in their MCP annotations. `db_query` is marked as non-read-only, destructive, non-idempotent, and open-world because its result and effects depend on the target database and statement.

## Limitations and notes

The server requires Node.js 20.19 or newer because of its database drivers. A profile must exist before the tools that target a database can be used, and callers need to know or discover its name. `db_explain` describes a plan without executing the statement; it is not a substitute for running a query. Credentials remain in the local profile configuration, so protecting that file and the database accounts remains the operator’s responsibility.

_Full upstream README: https://allmcps.com/mcp/anydb-mcp/readme_

