Skip to main content
Glama
db-mcp-tool

db-mcp-tool

by wirdes

Database Explorer MCP Tool

A powerful Model Context Protocol (MCP) tool for exploring and managing different types of databases including PostgreSQL, MySQL, and Firestore.

Features

  • Multiple Database Support

    • PostgreSQL

    • MySQL

    • Firestore

  • Database Operations

    • Connect to databases

    • List tables

    • View triggers

    • List functions

    • Execute SQL queries (PostgreSQL and MySQL)

    • Export table schemas

    • Export table data

Related MCP server: Database MCP Server

Integration with Cursor

Before adding the tool to Cursor, you need to build the project:

  1. Clone the repository

  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build

To add the tool to Cursor:

  1. Open Cursor settings

  2. Navigate to "Model Context Protocol (MCP)" section

  3. Click "Add New Tool"

  4. Fill in the following details:

    {
      "name": "database-explorer",
      "command": "node /path/to/project/dist/index.js",
      "description": "Database Explorer MCP Tool"
    }

    Note: Replace /path/to/project with the actual path to your project directory.

  5. Save the settings

  6. Restart Cursor

Using the Tool:

  1. After setup, you can connect to your database using one of these commands:

    • For PostgreSQL: Use !pg with connection details

    • For MySQL: Use !mysql with connection details

    • For Firestore: Use !firestore with connection details

  2. Once connected, you can use various database operations:

    • !tables to list all tables

    • !triggers to view triggers

    • !functions to list functions

    • !query to execute SQL queries

    • !export-db to export table schemas

    • !export-data to export table data

See the Commands section below for detailed usage examples.

Commands

Connection Commands

  • !pg - Connect to PostgreSQL database

    {
      "connection": {
        "host": "hostname",
        "port": 5432,
        "database": "dbname",
        "user": "username",
        "password": "password"
      }
    }
  • !mysql - Connect to MySQL database

    {
      "connection": {
        "host": "hostname",
        "port": 3306,
        "database": "dbname",
        "user": "username",
        "password": "password"
      }
    }
  • !firestore - Connect to Firestore database

    {
      "connection": {
        "projectId": "your-project-id",
        "keyFilename": "path/to/keyfile.json"
      }
    }

Database Operation Commands

  • !tables - List all tables in the connected database

  • !triggers - List all triggers in the connected database

  • !functions - List all functions in the connected database

  • !query - Execute SQL query (PostgreSQL and MySQL only)

    {
      "query": "SELECT * FROM table_name"
    }
  • !export-db - Export table schema

    {
      "table": "table_name"
    }
  • !export-data - Export table data as INSERT statements

    {
      "table": "table_name"
    }

Requirements

  • Node.js

  • Required database drivers:

    • pg for PostgreSQL

    • mysql2 for MySQL

    • @google-cloud/firestore for Firestore

Usage

  1. Make sure you have the necessary database credentials

  2. Connect to your database using the appropriate connection command

  3. Use the available commands to explore and manage your database

Error Handling

  • The tool includes comprehensive error handling for:

    • Connection failures

    • Query execution errors

    • Schema and data export issues

    • Invalid database operations

Notes

  • Firestore support is limited to basic operations due to its NoSQL nature

  • SQL operations are only available for PostgreSQL and MySQL

Available Tools

9 tools
!export-dataD

Inputs: table (required).

!export-dbD

Inputs: table (required).

!firestoreD

Inputs: connection (required).

!functionsD

Inputs: no named parameters.

!mysqlD

Inputs: connection (required).

!pgD

Inputs: connection (required).

!queryD

Inputs: query (required).

!tablesD

Inputs: no named parameters.

!triggersD

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    D1.2/5.0

    Scored across 9 tools

    Disambiguation1/5

    The tools are completely indistinguishable due to the lack of descriptions and ambiguous naming. For example, '!export-data' and '!export-db' likely overlap significantly, while '!mysql' and '!pg' might both handle database operations without clear differentiation. Without descriptions, an agent cannot determine the purpose or boundaries of any tool.

    Naming Consistency2/5

    The naming is inconsistent with a mix of conventions: some tools use hyphens (e.g., '!export-data'), others are single words (e.g., '!mysql'), and some are abbreviations (e.g., '!pg'). While all start with '!', there is no predictable verb_noun pattern or consistent style, making it hard to infer relationships.

    Tool Count3/5

    With 9 tools, the count is reasonable for a database-related server, but the lack of descriptions makes it impossible to assess if this number is well-scoped. It could be appropriate if each tool covers a distinct aspect, but currently, it feels borderline due to the ambiguity.

    Completeness1/5

    The server appears to target database operations, but without descriptions, it is impossible to assess coverage. Tools like '!query' and '!tables' suggest basic operations, but there are likely significant gaps (e.g., no clear create, update, or delete tools) and no way to determine if the surface supports a complete workflow.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables powerful PostgreSQL database management capabilities including analysis, schema management, data migration, and monitoring through natural language interactions.
      18
      10,856 npm
      204
      AGPL 3.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that provides tools for connecting to and interacting with various database systems (SQLite, PostgreSQL, MySQL/MariaDB, SQL Server) through a unified interface.
      3
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server for interacting with MSSQL and PostgreSQL databases, offering tools for schema exploration and SQL execution. It features configurable query modes for safety and supports advanced authentication methods like Windows Auth and SSL.
      11 npm
      MIT