local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Enables natural language interaction with MariaDB databases, providing conversational access to data querying and management functions.
Supports conversational interaction with MySQL databases, allowing users to query and manage data using natural language.
Allows direct interaction with PostgreSQL databases through natural language queries, enabling conversational data exploration and manipulation.
使用 MCP 与您的数据库对话
本指南讲解如何设置并运行 MCP 服务器,以便使用 Claude Desktop 与 PostgreSQL 数据库进行交互。由于其底层使用了 sqlalchemy,因此它也兼容 MySQL、MariaDB 和 SQLite。本项目基于https://github.com/runekaagaard/mcp-alchemy构建。
**注意:**本指南假设您对 Docker、环境变量和 CLI 使用有基本的了解。
先决条件
1.设置环境变量
- 复制并重命名环境文件
复制提供的.env.example
文件并将其重命名为.env
:Copy
2. 设置 Claude 桌面
- 下载并安装 Claude Desktop
访问Claude Desktop 下载页面并安装该应用程序。
3. 使用虚拟数据启动 PostgreSQL 数据库
- 运行 Docker Compose
确保 Docker Compose 已安装并运行:Copy- 此命令将在
localhost:5432
上启动 PostgreSQL 数据库并用虚拟数据填充它。
- 此命令将在
4.安装uv
(如果尚未安装)
- 安装
uv
执行以下命令安装uv
:Copy
5. 配置并启动 MCP 服务器
- 创建/更新 MCP 服务器配置
将以下 JSON 配置保存在您的 MCP 服务器配置文件中(如有必要,调整路径):Copy- **提示:**如果
uv
安装在非标准位置,请更新"command"
值以反映可执行文件的完整路径。
- **提示:**如果
- 启动 MCP 服务器
配置完成后,每次启动 Claude Desktop 时,MCP 服务器都会自动启动。
6. 享受你的设置
- 打开Claude 桌面。
- 该工具将自动调用您的 MCP 服务器,使您能够无缝地与数据库交互。
概括
- 设置环境变量:将
.env.example
复制到.env
。 - 安装并运行 Claude Desktop :从Claude Desktop下载。
- 使用 Docker Compose 启动 PostgreSQL :运行
docker-compose up
以使用虚拟数据启动数据库。 - 安装
uv
:如有必要,运行提供的安装命令。 - 配置 MCP 服务器:更新配置文件并确保路径和环境变量正确。
- 启动并享受:启动 Claude Desktop 开始通过 MCP 与您的数据库进行交互。
如果您遇到任何问题或需要进一步帮助,请参阅相关文档或联系您的支持团队。
编码愉快!
This server cannot be installed
一种使用自然语言查询通过 Claude Desktop 与 PostgreSQL、MySQL、MariaDB 或 SQLite 数据库进行交互的服务器。
- Prerequisites
- 1. Set Up Environment Variables
- 2. Set Up Claude Desktop
- 3. Launch the PostgreSQL Database with Dummy Data
- 4. Install uv (if not already installed)
- 5. Configure and Launch the MCP Server
- 6. Enjoy Your Setup
- Summary