home / mcp / universal db mcp server

Universal DB MCP Server

Provides natural-language access to multiple databases by querying and exploring schemas, enabling safe read-only analysis and cross-database operations via Claude Desktop.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "anarkh-lee-universal-db-mcp": {
      "command": "npx",
      "args": [
        "universal-db-mcp",
        "--type",
        "mysql",
        "--host",
        "localhost",
        "--port",
        "3306",
        "--user",
        "root",
        "--password",
        "your_password",
        "--database",
        "your_database"
      ]
    }
  }
}

You can connect Claude Desktop to your databases through the MCP framework, enabling natural language queries and on-demand data analysis across multiple database systems with safe, read-only defaults.

How to use

Start Claude Desktop and let it connect to your databases via the MCP server you configure. Then you can ask questions in natural language, such as asking for the structure of a table, counting recent orders, or identifying high-value customers. Claude will translate your requests into SQL (or the appropriate query for the connected database), execute it, and present the results. The system understands your database schema, so your queries stay accurate and you get immediate insights without writing SQL yourself.

How to install

Prerequisites you need before installation:

• Node.js version 20 or newer

• Claude Desktop application

• At least one database instance to connect to (such as MySQL, PostgreSQL, Redis, Oracle, DM, SQL Server, or MongoDB)

Install the MCP server client

npm install -g universal-db-mcp

Or run directly with npx

npx universal-db-mcp

Configure Claude Desktop to connect to the MCP server

Edit Claude Desktop's configuration to add a new MCP server. Use the following example configuration to connect to a MySQL instance running on localhost with a read-only MCP setup.

{
  "mcpServers": {
    "universal-db": {
      "command": "npx",
      "args": [
        "universal-db-mcp",
        "--type", "mysql",
        "--host", "localhost",
        "--port", "3306",
        "--user", "root",
        "--password", "your_password",
        "--database", "your_database"
      ]
    }
  }
}

Start using the MCP server

1. Restart Claude Desktop after adding the new MCP server entry.

2. Open a chat and ask questions like: - “Help me view the structure of the users table” - “Count orders from the last 7 days” - “Find the top 10 customers by spend”

Security mode

By default, the MCP server operates in read-only mode. It will reject write operations such as DELETE, UPDATE, DROP, or TRUNCATE. If you explicitly need to enable write privileges, you must provide a special flag in the MCP configuration.

Supported databases and flags

The MCP server supports multiple database types. For each type, the MCP flag is passed to select the right adapter when starting the server.

Command-line parameters

The MCP server accepts a set of CLI options to specify the database type and connection details. Examples shown here illustrate the typical flags you will configure when launching the server.

universal-db-mcp [options]

Options:
  --type <db>              Database type (mysql|postgres|redis|oracle|dm|sqlserver|mssql|mongodb)
  --host <host>              Database host (default: localhost)
  --port <port>              Database port
  --user <user>              Username
  --password <password>      Password
  --database <database>      Database name
  --danger-allow-write       Enable write mode (dangerous!)
  --help                     Show help information

Architecture and how it works

The system uses a modular adapter approach to support different databases. It loads the appropriate adapter based on the type you specify and then handles natural language requests by translating them into database queries. This design makes it straightforward to add new database drivers in the future.

Notes on usage and safety

Because the default is safe, avoid enabling write access on production data unless you fully understand the implications. Always test queries in a development environment before running them against live data.

Troubleshooting tips

If Claude cannot access your database, verify the host, port, and credentials in the MCP configuration. Ensure the database user has the necessary permissions for read operations and that network access is allowed from the machine running Claude Desktop.

Universal DB MCP Server - anarkh-lee/universal-db-mcp