Get the FREE Ultimate OpenClaw Setup Guide →

mcp-database

A Model Context Protocol (MCP) server that provides multi-database query execution capabilities with support for SQLite, PostgreSQL, and MySQL databases. Includes a built-in Web UI for managing database connections.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ahmetbarut-mcp-database-server npx -y @ahmetbarut/mcp-database-server

How to use

This MCP server provides multi-database query execution across SQLite, PostgreSQL, and MySQL with a built-in Web UI for managing connections. It exposes an MCP-compatible JSON-RPC interface and a Web UI that runs locally, enabling you to create, test, and persist database connections, then run parameterized queries against them. Start it with npx (no installation required) and open the Web UI at http://localhost:3693 to configure your connections. The server also supports smart auto-detection to select a single active connection for queries and includes retry logic for failed connections, along with parameterized queries and audit logging for security.

Tools you can use via MCP include:

  • execute_query: Run parameterized SQL against a configured connection, returning results.
  • list_databases: List databases from a specific connection or across all configured connections, with smart auto-detection when applicable.
  • list_connections: Retrieve all configured connections with status and details.
  • retry_failed_connections: Retry any connections that previously failed.

To use these tools, run JSON-RPC calls through the MCP protocol (typically over stdio when launched via npx) or use the included Web UI to issue commands visually. The Web UI persists connections to a local store and exposes REST endpoints for managing connections from the browser.

How to install

Prerequisites:

  • Node.js (latest LTS or Node.js v18+ is common for MCP servers; this project mentions Node.js v23 compatibility).
  • npm (comes with Node.js).

Installation steps:

  1. Ensure Node.js and npm are installed on your system.
  2. Run the server via npx (no install required):
npx @ahmetbarut/mcp-database-server

Optionally install globally for quicker access:

npm install -g @ahmetbarut/mcp-database-server

After installation, the server starts and the Web UI will be available at http://localhost:3693 by default.

Additional notes

Notes and tips:

  • The Web UI is enabled by default and runs on port 3693. You can customize the port using the WEB_UI_PORT environment variable (e.g., WEB_UI_PORT=4000).
  • Web UI can be disabled by setting WEB_UI_ENABLED=false.
  • Logs can be adjusted with LOG_LEVEL (debug, info, warn, error).
  • Connection configs are stored locally in ~/.mcp-database-server/connections.db (SQLite).
  • Supported database types include SQLite (file path), PostgreSQL (host, port, database, user, password, optional SSL), and MySQL (host, port, database, user, password, optional SSL).
  • For security, the server emphasizes parameterized queries, credential masking in list_connections, and audit logging.
  • If you run into issues with the Web UI not loading, check port usage and try WEB_UI_PORT to a different value. If MCP client connections fail, verify npx execution succeeds and restart the client after config changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers