Database

Provides access to relational and NoSQL databases via MCP for AI agents, with prebuilt configurations and introspection tools.
  • typescript

0

GitHub Stars

typescript

Language

6 months ago

First Indexed

3 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
{
  "mcpServers": {
    "zeaozhang-database-mcp": {
      "command": "npx",
      "args": [
        "@adversity/mcp-database",
        "--prebuilt",
        "postgres"
      ],
      "env": {
        "DATABASE_HOST": "localhost",
        "DATABASE_NAME": "mydb",
        "DATABASE_PORT": "5432",
        "DATABASE_USER": "postgres",
        "DATABASE_PASSWORD": "your-password"
      }
    }
  }
}

You run an MCP server that exposes database access and simple query tools to AI assistants and other clients. It wraps a powerful toolkit to connect to dozens of databases, handles configuration, auth, and observability, and lets you perform common database tasks via MCP-compatible tooling. This guide shows practical steps to install, run, and use the MCP-backed database server from your client or automation.

How to use

Connect to the MCP database server from your client and start issuing tools like listing tables and executing SQL. When connected through MCP, you can discover available tables, inspect their structure, and run parameterized queries against your target database. You can switch between prebuilt configurations for PostgreSQL, MySQL, SQLite, MongoDB, and others, or supply a custom environment to point at your own database.

How to install

Prerequisites: you need a system with Node.js 18 or higher and npm or npx available. An active internet connection is required for the initial binary/toolbox download.

Install the MCP database server globally using npm.Choose the bundle that fits your environment.

npm install -g @adversity/mcp-database

You can also run without installation by using npx:

npx @adversity/mcp-database --help

Configuration and usage tips

You can start with prebuilt configurations to quickly connect to popular databases. Each prebuilt command sets the required environment variables for that database and launches the MCP server in stdio mode.

# PostgreSQL example
DATABASE_HOST=localhost \
DATABASE_NAME=mydb \
DATABASE_USER=user \
DATABASE_PASSWORD=password \
npx @adversity/mcp-database --prebuilt postgres
# MySQL example
DATABASE_HOST=localhost \
DATABASE_NAME=mydb \
DATABASE_USER=root \
DATABASE_PASSWORD=password \
npx @adversity/mcp-database --prebuilt mysql
# SQLite example (no credentials)
DATABASE_NAME=./my-database.db \
npx @adversity/mcp-database --prebuilt sqlite
# MongoDB example
DATABASE_HOST=localhost \
DATABASE_NAME=mydb \
DATABASE_USER=user \
DATABASE_PASSWORD=password \
npx @adversity/mcp-database --prebuilt mongodb

Security and environment variables

All prebuilt databases use a unified set of environment variables to specify connection details. You can also override values via CLI options when launching the server.

Unified environment variables you will use includes: DATABASE_HOST, DATABASE_PORT, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD. For cloud services, you may also supply additional provider-specific variables.

Examples: starting with a custom config and HTTP transport

If you need to expose the MCP toolbox over HTTP for remote access, you can enable HTTP transport and specify the host/port for the toolbox, while keeping the MCP server running locally.

npx @adversity/mcp-database --prebuilt sqlite \
  --transport http \
  --toolbox-host 0.0.0.0 \
  --toolbox-port 5900

Corresponding environment variables follow standard names, such as MCP_TOOLBOX_TRANSPORT, MCP_TOOLBOX_HOST, and MCP_TOOLBOX_PORT if you want to drive them from the environment.

## Available tools when connected to MCP

Once connected, you can use tools like listing tables and executing SQL against the connected database.

## Troubleshooting and notes

If you run into issues, verify your environment variables are correctly set and that the target database accepts connections from your host. Check that the chosen prebuilt type matches your database and that you have network access to the host/port.

## Advanced usage and programmatic start

You can start the MCP database server programmatically to integrate into custom automation pipelines. Pass the appropriate binary path to the toolbox, your generated prebuilt config, and enable verbose logging if you need extra diagnostics.

## Available tools

### list\_tables

List all tables in the database with their descriptions.

### execute\_sql

Execute a given SQL statement on the database.
Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational