数据库资源管理器 MCP 工具
强大的模型上下文协议 (MCP) 工具,用于探索和管理不同类型的数据库,包括 PostgreSQL、MySQL 和 Firestore。
特征
多数据库支持
PostgreSQL
MySQL
Firestore
数据库操作
连接到数据库
列出表格
查看触发器
列表函数
执行 SQL 查询(PostgreSQL 和 MySQL)
导出表架构
导出表数据
与 Cursor 集成
在将工具添加到 Cursor 之前,您需要构建项目:
克隆存储库
安装依赖项:
npm install构建项目:
npm run build
要将工具添加到光标:
打开光标设置
导航至“模型上下文协议 (MCP)”部分
点击“添加新工具”
填写以下详细信息:
{ "name": "database-explorer", "command": "node /path/to/project/dist/index.js", "description": "Database Explorer MCP Tool" }注意:将
/path/to/project
替换为项目目录的实际路径。保存设置
重启光标
使用工具:
设置完成后,您可以使用以下命令之一连接到数据库:
对于 PostgreSQL:使用
!pg
并附带连接详细信息对于 MySQL:使用
!mysql
并附带连接详细信息对于 Firestore:使用
!firestore
并附带连接详细信息
一旦连接,您就可以使用各种数据库操作:
!tables
列出所有表!triggers
查看触发器!functions
列出函数!query
执行 SQL 查询!export-db
导出表模式!export-data
导出表数据
有关详细的使用示例,请参阅下面的命令部分。
命令
连接命令
!pg
连接到 PostgreSQL 数据库{ "connection": { "host": "hostname", "port": 5432, "database": "dbname", "user": "username", "password": "password" } }!mysql
连接到 MySQL 数据库{ "connection": { "host": "hostname", "port": 3306, "database": "dbname", "user": "username", "password": "password" } }!firestore
连接到 Firestore 数据库{ "connection": { "projectId": "your-project-id", "keyFilename": "path/to/keyfile.json" } }
数据库操作命令
!tables
列出所连接数据库中的所有表!triggers
- 列出所连接数据库中的所有触发器!functions
- 列出所连接数据库中的所有函数!query
执行 SQL 查询(仅限 PostgreSQL 和 MySQL){ "query": "SELECT * FROM table_name" }!export-db
- 导出表模式{ "table": "table_name" }!export-data
- 将表数据导出为 INSERT 语句{ "table": "table_name" }
要求
Node.js
所需的数据库驱动程序:
PostgreSQL 的
pg
MySQL 的
mysql2
@google-cloud/firestore
用于 Firestore
用法
确保您拥有必要的数据库凭据
使用适当的连接命令连接到数据库
使用可用的命令来探索和管理您的数据库
错误处理
该工具包括针对以下方面的全面错误处理:
连接失败
查询执行错误
架构和数据导出问题
无效的数据库操作
笔记
由于 Firestore 的 NoSQL 特性,其支持仅限于基本操作
SQL 操作仅适用于 PostgreSQL 和 MySQL
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
强大的模型上下文协议 (MCP) 工具,用于探索和管理不同类型的数据库,包括 PostgreSQL、MySQL 和 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