Back to MCP Directory
DB
Model Context Protocol moderate risk

DB

The DB MCP Server provides a unified interface for AI models to interact with multiple databases (MySQL, PostgreSQL, SQLite, TimescaleDB) simultaneously, enabling SQL queries, schema exploration, and transaction management.

Connections & Capabilities

Connects To

GitHubPostgreSQLMySQLSQLiteDocker

Capabilities

readwriteexecadmin

Quickstart

Config

{
  "mcpServers": {
    "stdio-db-mcp-server": {
      "command": "/path/to/db-mcp-server/server",
      "args": ["-t", "stdio", "-c", "/path/to/config.json"]
    }
  }
}

Exposed MCP Tools (7)

safe
query_<db_id>

Executes SELECT queries and returns results as a tabular dataset.

Read-only operation, no data modification.

high
execute_<db_id>

Runs data manipulation statements (INSERT, UPDATE, DELETE).

Modifies database content, potential for data loss or corruption.

high
transaction_<db_id>

Manages database transactions (BEGIN, COMMIT, ROLLBACK).

Improper transaction handling can lead to data inconsistency.

safe
schema_<db_id>

Retrieves information about database schema (tables, columns, indexes).

Read-only operation, no data modification.

safe
performance_<db_id>

Analyzes query performance and provides optimization suggestions.

Read-only operation, no data modification.

high
create_hypertable_<db_id>

Converts a standard table to a TimescaleDB hypertable.

Modifies database schema, potential for data loss if not handled correctly.

safe
time_series_query_<db_id>

Executes optimized time-series queries with bucketing.

Read-only operation, no data modification.

Safety Assessment

The DB MCP Server offers a convenient way to interact with multiple databases, but it's crucial to secure the configuration file and implement robust input validation to prevent SQL injection attacks. Using read-only connections where possible significantly reduces risk. The server's safety depends heavily on the security practices of the user and the AI agent interacting with it.

  • Database connections are configured via a configuration file, limiting direct code access.
  • Supports read-only database connections for enhanced safety.
  • Lazy loading mode defers connection establishment, reducing initial exposure.
  • Provides database-specific tools, limiting the scope of each operation.
  • Executes SQL queries, which can be a significant attack vector if not properly sanitized.
  • Manages transactions, potentially leading to data corruption if not handled correctly.
  • Configuration file stores database credentials, requiring secure storage.
  • Lack of built-in input validation on SQL queries poses a risk of SQL injection.