MCP Database Server

The MCP Server support your LLMs integrate with SQL Database (SQLite, SQL Server, Postgres SQL)
  • typescript

21

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs

The MCP Database Server lets you connect to and work with multiple database systems through a unified MCP interface. It supports SQLite, PostgreSQL, Microsoft SQL Server, and MongoDB, and you can run it locally to query, update, and explore schemas from a single endpoint.

How to use

You can access the MCP Database Server using two convenient methods. First, run the server in SSE mode and connect with any MCP client via the SSE endpoint at http://localhost:3001/mcp. This is the default mode and works well for most integrations.

Second, run the server in STDIO mode for tools that communicate over standard input and output. This is ideal when your setup expects a local process that speaks the MCP protocol over a pipe.

How to install

Prerequisites: you need Node.js and npm installed on your system.

Install the MCP Database Server globally so you can run the mcp-dbs CLI from any directory.

npm install -g mcp-dbs

Connect to the server in HTTP (SSE) mode

Start the server in SSE mode using the default command. The server will listen on port 3001 by default and expose an MCP endpoint for clients to connect.

To use a different port, pass the --port option.

npx mcp-dbs

Run in STDIO mode for local tooling

If your tooling expects standard input/output, start the server in STDIO mode. This runs the MCP server as a local process that communicates through pipes.

The complete command shown for a typical setup is:

node /path/to/your/mcp-dbs/dist/cli.js --stdio

Claude Desktop integration

You can integrate the MCP Database Server with Claude Desktop by adding it to your Claude configuration. This lets Claude issue MCP commands to connect to databases, run queries, and explore schemas directly from Claude.

Configuration steps provide the necessary command, arguments, and environment variables to start the server in STDIO mode.

{
  "mcpServers": {
    "mcp-dbs": {
      "command": "node",
      "args": [
        "/path/to/your/mcp-dbs/dist/cli.js",
        "--stdio"
      ],
      "env": {
        "MCP_MONGODB_URI": "mongodb://localhost:27017",
        "MCP_MONGODB_DATABASE": "your-database-name"
      }
    }
  }
}

Environment variables you may configure

Configure database connections using environment variables. The following variables are demonstrated for each supported database type.

# SQLite
export MCP_SQLITE_FILENAME="path/to/database.db"
export MCP_SQLITE_CREATE_IF_NOT_EXISTS="true"

# PostgreSQL
export MCP_POSTGRES_HOST="your-postgres-host"
export MCP_POSTGRES_PORT="5432"
export MCP_POSTGRES_DATABASE="your-database-name"
export MCP_POSTGRES_USER="your-username"
export MCP_POSTGRES_PASSWORD="your-password"
export MCP_POSTGRES_SSL="false"

# SQL Server
export MCP_MSSQL_SERVER="your-server-address"
export MCP_MSSQL_PORT="1433"
export MCP_MSSQL_DATABASE="your-database-name"
export MCP_MSSQL_USER="your-username"
export MCP_MSSQL_PASSWORD="your-password"
export MCP_MSSQL_ENCRYPT="true"
export MCP_MSSQL_TRUST_SERVER_CERTIFICATE="true"

# MongoDB
export MCP_MONGODB_URI="mongodb://localhost:27017"
export MCP_MONGODB_DATABASE="your-database-name"
export MCP_MONGODB_MAX_POOL_SIZE="10"
export MCP_MONGODB_USE_UNIFIED_TOPOLOGY="true"

Tools and endpoints you can use

The server provides a set of MCP tools to interact with connected databases. You can connect to a database, disconnect, execute queries, and execute updates.

Resources and endpoints

You can retrieve the database schema, table schemas, and a list of tables through dedicated MCP resources.

Development and testing

Run the test suite to verify the server’s behavior during development.

npm test

Available tools

connect-database

Connect to a database by specifying a connectionId and type (sqlite, postgres, mssql, mongodb) to establish an MCP session.

disconnect-database

Terminate an active database connection using its connectionId.

execute-query

Run a query or aggregation against the connected database and return the results.

execute-update

Perform updates such as insert, update, or delete operations without returning results.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational