db-mcp-tool
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
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:Copy
- Build the project:Copy
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:Note: ReplaceCopy
/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 details - For MySQL: Use
!mysql
with connection details - For Firestore: Use
!firestore
with connection details
- For PostgreSQL: Use
- 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 databaseCopy!mysql
- Connect to MySQL databaseCopy!firestore
- Connect to Firestore databaseCopy
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)Copy!export-db
- Export table schemaCopy!export-data
- Export table data as INSERT statementsCopy
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
You must be authenticated.
A powerful Model Context Protocol (MCP) tool for exploring and managing different types of databases including PostgreSQL, MySQL, and Firestore.