Tools: Essential Guide: MCP DB Query: 让你的AI助手直接查询MySQL、PostgreSQL、SQLite数据库
什么是MCP DB Query?
配置Claude Desktop
SQLite(查询本地数据库)
PostgreSQL
为什么不做成REST API? MCP DB Query 是一个 Model Context Protocol (MCP) 服务器,让Claude、Cursor等AI助手可以直接查询MySQL、PostgreSQL和SQLite数据库。不需要中间API层,不需要写后端代码。 GitHub: github.com/xuks124/mcp-db-query 在 claude_desktop_config.json 中添加: MCP的优势在于:AI客户端原生支持、不需要配置API路由、不需要处理认证和鉴权、工具调用比REST更自然。 如果你觉得这个工具对你有用,点个Star支持一下 👉 github.com/xuks124/mcp-db-query Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse
$ -weight: 500;">npm -weight: 500;">install -g mcp-db-query
-weight: 500;">npm -weight: 500;">install -g mcp-db-query
-weight: 500;">npm -weight: 500;">install -g mcp-db-query
-weight: 500;">git clone https://github.com/xuks124/mcp-db-query.-weight: 500;">git
cd mcp-db-query
-weight: 500;">npm -weight: 500;">install
-weight: 500;">git clone https://github.com/xuks124/mcp-db-query.-weight: 500;">git
cd mcp-db-query
-weight: 500;">npm -weight: 500;">install
-weight: 500;">git clone https://github.com/xuks124/mcp-db-query.-weight: 500;">git
cd mcp-db-query
-weight: 500;">npm -weight: 500;">install
{ "mcpServers": { "db-query": { "command": "node", "args": ["/path/to/mcp-db-query/index.js"] } }
}
{ "mcpServers": { "db-query": { "command": "node", "args": ["/path/to/mcp-db-query/index.js"] } }
}
{ "mcpServers": { "db-query": { "command": "node", "args": ["/path/to/mcp-db-query/index.js"] } }
}
{ "type": "sqlite", "file": "/data/app.db", "query": "SELECT * FROM users LIMIT 5"
}
{ "type": "sqlite", "file": "/data/app.db", "query": "SELECT * FROM users LIMIT 5"
}
{ "type": "sqlite", "file": "/data/app.db", "query": "SELECT * FROM users LIMIT 5"
}
{ "type": "mysql", "host": "localhost", "port": 3306, "database": "mydb", "user": "root", "password": "pass", "query": "SHOW TABLES"
}
{ "type": "mysql", "host": "localhost", "port": 3306, "database": "mydb", "user": "root", "password": "pass", "query": "SHOW TABLES"
}
{ "type": "mysql", "host": "localhost", "port": 3306, "database": "mydb", "user": "root", "password": "pass", "query": "SHOW TABLES"
}
{ "type": "postgres", "host": "localhost", "port": 5432, "database": "mydb", "user": "root", "password": "pass", "query": "SELECT * FROM users LIMIT 10"
}
{ "type": "postgres", "host": "localhost", "port": 5432, "database": "mydb", "user": "root", "password": "pass", "query": "SELECT * FROM users LIMIT 10"
}
{ "type": "postgres", "host": "localhost", "port": 5432, "database": "mydb", "user": "root", "password": "pass", "query": "SELECT * FROM users LIMIT 10"
} - 多数据库支持:MySQL、PostgreSQL、SQLite 一键切换
- 零配置:SQLite模式只需要一个文件路径
- 只读安全设计:默认只读,支持参数化查询防注入
- MCP协议原生兼容:可用在任何MCP客户端中 - 用Claude Desktop的开发人员
- 用Cursor编程的开发者
- 需要让AI直接访问数据库做数据分析的场景
- 不想建后端API又想用AI操作数据库的人