data-persistence-interface-utility
Facilitate comprehensive interaction and administration across diverse persistent data stores, specifically supporting relational systems like PostgreSQL and MySQL, alongside document-oriented databases such as Firestore. Capabilities include executing structured queries, cataloging collections/tables, and exporting datasets to streamline data governance workflows.
Author

wirdes
Quick Info
Actions
Tags
Persistent Data Store Orchestration Module
A robust Model Context Protocol (MCP) module designed for the systematic exploration and manipulation of multiple database architectures, encompassing relational engines (PostgreSQL, MySQL) and NoSQL document repositories (Firestore).
Core Capabilities
-
Polyglot Data Source Compatibility
-
PostgreSQL (Relational)
- MySQL (Relational)
-
Firestore (Document/NoSQL)
-
Data Access & Management Functions
- Establish secure connections to various data sources
- Retrieve schema object listings (tables, collections)
- Inspect database procedural elements (triggers)
- Catalog stored routines (functions)
- Run structured query language (SQL) commands (PostgreSQL/MySQL)
- Serialize table structural definitions (schema export)
- Serialize record content (data export)
Integration Protocol for Cursor Environment
Prior to deploying this utility within the Cursor IDE, prerequisite compilation steps must be finalized:
- Obtain a local copy of the source code repository.
-
Install necessary runtime dependencies: bash npm install
-
Compile the project output: bash npm run build
To register this utility within Cursor's tooling subsystem:
- Access Cursor configuration preferences.
- Navigate to the section designated for "Model Context Protocol (MCP)" integrations.
- Select the option to "Add New Tool".
- Populate the configuration fields with the following payload:
{ "name": "database-explorer", "command": "node /path/to/project/dist/index.js", "description": "Database Explorer MCP Tool" }
Crucial Note: Ensure that /path/to/project accurately reflects the root directory of your compiled utility.
5. Finalize and persist the configuration settings.
6. Initiate a restart of the Cursor application instance.
Operational Usage:
Following successful configuration, data source access is initiated via specialized invocation prefixes:
- For PostgreSQL interactions: Invoke with
!pg, providing necessary connection metadata. - For MySQL interactions: Invoke with
!mysql, supplying required connection parameters. - For Firestore interactions: Invoke with
!firestore, detailing project identification.
Once an active session is established, routine data inspection and modification commands become available:
!tables: Enumerates all present tables/collections.!triggers: Displays defined database triggers.!functions: Lists registered database functions.!query: Executes arbitrary SQL against relational systems.!export-db: Outputs the schema blueprint for a specified entity.!export-data: Outputs the content of a specified entity.
Refer to the subsequent 'Command Reference' section for detailed syntax and examples.
Command Reference
Connection Initialization Sequences
!pg- Initiates a connection handshake with a PostgreSQL instance
{ "connection": { "host": "hostname", "port": 5432, "database": "dbname", "user": "username", "password": "password" } }
!mysql- Initiates a connection handshake with a MySQL instance
{ "connection": { "host": "hostname", "port": 3306, "database": "dbname", "user": "username", "password": "password" } }
!firestore- Initializes connection context for Google Firestore
{ "connection": { "projectId": "your-project-id", "keyFilename": "path/to/keyfile.json" } }
Data Manipulation & Retrieval Operations
!tables- Generates a roster of all accessible schemas/tables in the active connection context.!triggers- Reports all configured trigger definitions within the active connection context.!functions- Retrieves a list of defined procedural functions in the active connection context.!query- Executes a provided SQL expression (Applicable solely to PostgreSQL and MySQL connections)
{ "query": "SELECT * FROM table_name" }
!export-db- Serializes the structural definition of a specified entity.
{ "table": "table_name" }
!export-data- Outputs the population data of a specified entity, typically formatted as SQL INSERT statements.
{ "table": "table_name" }
Prerequisites
- Execution environment must have Node.js installed.
- Required external data access libraries must be present:
pg(For PostgreSQL linkage)mysql2(For MySQL linkage)@google-cloud/firestore(For Firestore linkage)
Usage Workflow
- Confirm that all requisite database authentication credentials are provisioned.
- Utilize the appropriate initialization command to establish the target data link.
- Employ the supported operational commands for data inspection and management.
Exception Management
- The utility incorporates extensive error trapping mechanisms covering:
- Failures during connection establishment attempts.
- Issues arising during query execution phases.
- Problems encountered during schema or data serialization/export procedures.
- Invalid invocation of supported database functionalities.
Observations
- Firestore utility functions are inherently constrained by its underlying NoSQL paradigm.
- Full SQL command execution capabilities are exclusively available when interfacing with PostgreSQL or MySQL environments.
