Skip to content
MCP server

Databases (read-only, switchable)

Read-only SQL, MongoDB, Redis and Elasticsearch access, switchable mid-conversation.

Runs locallyStatus and history
Install
Pricing
Open source
Runs
Locally
Version
1.1.0
Listing updated
4 days ago

About Databases (read-only, switchable)

Databases (read-only, switchable) is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

Install

Run in a terminal

claude mcp add mcp-db-read-only --env DB_PASSWORD='<DB_PASSWORD>' --env DB_PROFILES='<DB_PROFILES>' --env MYSQL_PASSWORD='<MYSQL_PASSWORD>' -- npx -y @shibbirweb/mcp-db-read-only

Add to claude_desktop_config.json

{
  "mcpServers": {
    "mcp-db-read-only": {
      "command": "npx",
      "args": [
        "-y",
        "@shibbirweb/mcp-db-read-only"
      ],
      "env": {
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_PROFILES": "<DB_PROFILES>",
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-db-read-only": {
      "command": "npx",
      "args": [
        "-y",
        "@shibbirweb/mcp-db-read-only"
      ],
      "env": {
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_PROFILES": "<DB_PROFILES>",
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "mcp-db-read-only": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@shibbirweb/mcp-db-read-only"
      ],
      "env": {
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_PROFILES": "<DB_PROFILES>",
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-db-read-only": {
      "command": "npx",
      "args": [
        "-y",
        "@shibbirweb/mcp-db-read-only"
      ],
      "env": {
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_PROFILES": "<DB_PROFILES>",
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "mcp-db-read-only": {
      "command": "npx",
      "args": [
        "-y",
        "@shibbirweb/mcp-db-read-only"
      ],
      "env": {
        "DB_PASSWORD": "<DB_PASSWORD>",
        "DB_PROFILES": "<DB_PROFILES>",
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Configuration

  • DB_URLConnection URL to open at startup, e.g. postgres://user@host:5432/db, mongodb://user@host/db, redis://host:6379/0 or sqlite:///data/app.db
  • DB_PASSWORDPassword for DB_URL, so it need not be percent-encoded inside the URL
  • DB_PROFILESJSON object of named connections to switch between, each a URL or {"url", "password"}
  • DB_DEFAULT_PROFILEWhich DB_PROFILES entry to start on
  • DB_CONNECT_TIMEOUT_MSConnection timeout in milliseconds. Defaults to 10000
  • DB_QUERY_TIMEOUT_MSServer-side query timeout in milliseconds. Defaults to 30000
  • DB_LOGtrue logs every tool call, its statements and full output to stderr. Off by default
  • DB_LOG_FILELog every tool call to this file instead. Implies DB_LOG
  • DB_LOG_DIRSave every tool call as its own JSON file in this folder, permanently. Implies logging
  • DB_LOG_FORMATpretty (default) or json, one object per line
  • DB_LOG_PORTServe a live log viewer in the browser on this port. Needs DB_LOG_DIR, DB_LOG or DB_LOG_FILE. No access control
  • DB_LOG_HISTORYEntries the viewer keeps in memory when DB_LOG_DIR is not set. Defaults to 500
  • MYSQL_HOSTLegacy MySQL-only form, kept for drop-in compatibility. Prefer DB_URL
  • MYSQL_USERLegacy MySQL-only form. Prefer DB_URL
  • MYSQL_PASSWORDLegacy MySQL-only form. Prefer DB_URL with DB_PASSWORD
  • MYSQL_DATABASELegacy MySQL-only form. Prefer DB_URL
  • DB_URLConnection URL to open at startup, e.g. postgres://user@host:5432/db, mongodb://user@host/db, redis://host:6379/0 or sqlite:///data/app.db. Use host.docker.internal to reach the host
  • DB_PASSWORDPassword for DB_URL, so it need not be percent-encoded inside the URL
  • DB_PROFILESJSON object of named connections to switch between, each a URL or {"url", "password"}
  • DB_DEFAULT_PROFILEWhich DB_PROFILES entry to start on
  • DB_CONNECT_TIMEOUT_MSConnection timeout in milliseconds. Defaults to 10000
  • DB_QUERY_TIMEOUT_MSServer-side query timeout in milliseconds. Defaults to 30000
  • DB_LOGtrue logs every tool call, its statements and full output to stderr. Off by default
  • DB_LOG_FILELog every tool call to this file instead, on a mounted volume. Implies DB_LOG
  • DB_LOG_DIRSave every tool call as its own JSON file in this folder, on a mounted volume. Implies logging
  • DB_LOG_FORMATpretty (default) or json, one object per line
  • DB_LOG_PORTServe a live log viewer on this port (publish it with -p). Needs DB_LOG_DIR, DB_LOG or DB_LOG_FILE. No access control
  • DB_LOG_HISTORYEntries the viewer keeps in memory when DB_LOG_DIR is not set. Defaults to 500
  • MYSQL_HOSTLegacy MySQL-only form, kept for drop-in compatibility. Prefer DB_URL
  • MYSQL_USERLegacy MySQL-only form. Prefer DB_URL
  • MYSQL_PASSWORDLegacy MySQL-only form. Prefer DB_URL with DB_PASSWORD
  • MYSQL_DATABASELegacy MySQL-only form. Prefer DB_URL

Pricing

Open source

Databases (read-only, switchable) FAQ

Is Databases (read-only, switchable) free?

Yes. Databases (read-only, switchable) is open source, so you can use and self-host it for free.

How do I add Databases (read-only, switchable) to Claude Code?

Run this command in your terminal: claude mcp add mcp-db-read-only --env DB_PASSWORD='<DB_PASSWORD>' --env DB_PROFILES='<DB_PROFILES>' --env MYSQL_PASSWORD='<MYSQL_PASSWORD>' -- npx -y @shibbirweb/mcp-db-read-only

What are the best alternatives to Databases (read-only, switchable)?

The closest alternatives to Databases (read-only, switchable) are Midplane, PlatypusDB, Lorebase, Sovaria and model2data studio.

Alternatives to Databases (read-only, switchable)

  1. Midplane

    MCP server

    Postgres gateway for AI agents with table grants, column masking and approval for writes

    Runs locally
    • Open source
    • 5 GitHub stars
    • Databases
  2. PlatypusDB

    MCP server

    Gives MCP clients access to your PlatypusDB database connections, scoped per agent

    Runs locally
    • Open source
    • Databases
  3. Lorebase

    MCP server

    Lets agents read and change a governed, versioned Postgres knowledge graph

    Runs locally
    • Open source
    • Knowledge and memory
  4. Sovaria

    MCP server

    Manage a Sovaria backend (Postgres, auth, storage, functions) from an AI assistant

    Not checked yet
    • 4 tools
    • Remote
    • Freemium
    • Databases
  5. Generate realistic connected test data, dbt projects and dashboards from a schema

    • Remote
    • Freemium
    • Databases
  6. semlayer

    MCP server

    Infers a semantic layer from your data warehouse and serves it to agents

    Runs locally
    • Free
    • Databases