The Database Explorer MCP Tool enables exploration and management of PostgreSQL, MySQL, and Firestore databases via a command-line interface integrated with Cursor.
Key capabilities:
Connect to databases: PostgreSQL (
!pg
), MySQL (!mysql
), and Firestore (!firestore
)Database operations:
List tables (
!tables
)View triggers (
!triggers
)List functions (
!functions
)Execute SQL queries (
!query
) - PostgreSQL and MySQL onlyExport table schemas (
!export-db
)Export table data as INSERT statements (
!export-data
)
Error handling for connection failures, query execution errors and export issues
Integration with Cursor through building and configuring the tool
Allows connecting to and interacting with Google Firestore databases, including basic database operations (though limited due to Firestore's NoSQL nature).
Allows connecting to and interacting with MySQL databases, including listing tables, viewing triggers, listing functions, executing SQL queries, and exporting schema and data.
Allows connecting to and interacting with PostgreSQL databases, including listing tables, viewing triggers, listing functions, executing SQL queries, and exporting schema and data.
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
Integration with Cursor
Before adding the tool to Cursor, you need to build the project:
Clone the repository
Install dependencies:
npm installBuild the project:
npm run build
To add the tool to Cursor:
Open Cursor settings
Navigate to "Model Context Protocol (MCP)" section
Click "Add New Tool"
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.Save the settings
Restart Cursor
Using the Tool:
After setup, you can connect to your database using one of these commands:
For PostgreSQL: Use
!pg
with connection detailsFor MySQL: Use
!mysql
with connection detailsFor Firestore: Use
!firestore
with connection details
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 PostgreSQLmysql2
for MySQL@google-cloud/firestore
for Firestore
Usage
Make sure you have the necessary database credentials
Connect to your database using the appropriate connection command
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
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A powerful Model Context Protocol (MCP) tool for exploring and managing different types of databases including PostgreSQL, MySQL, and Firestore.
Related Resources
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases. Query collections, inspect schemas, and manage data seamlessly through natural language.Last updated -219169MIT License
- -securityAlicense-qualityA Model Context Protocol (MCP) implementation for connecting to and working with various database systems.Last updated -2618MIT License
- -securityFlicense-qualityA Model Context Protocol server that enables performing PostgreSQL database operations (create, read, update, delete) on User and Post entities through MCP tools.Last updated -
- -securityAlicense-qualityA powerful Model Context Protocol (MCP) server implementation that provides standardized interaction with MongoDB databases, supporting complete CRUD operations, async patterns, and real-time updates via SSE.Last updated -MIT License