MCP 数据库服务器
该MCP(模型上下文协议)服务器为Claude提供数据库访问能力,支持SQLite、SQL Server、PostgreSQL数据库。
安装
克隆存储库:
git clone https://github.com/executeautomation/database-server.git
cd database-server安装依赖项:
npm install构建项目:
npm run buildRelated MCP server: MCP TapData Server
使用选项
有两种方法可以将此 MCP 服务器与 Claude 一起使用:
直接使用:全局安装包并直接使用
本地开发:从本地开发环境运行
直接使用 NPM 包
使用此 MCP 服务器的最简单方法是全局安装它:
npm install -g @executeautomation/database-server这使得您可以直接使用服务器,而无需在本地构建它。
本地开发设置
如果您想修改代码或从本地环境运行:
按照安装部分所示克隆并构建存储库
使用下面使用部分中的命令运行服务器
用法
SQLite 数据库
要与 SQLite 数据库一起使用:
node dist/src/index.js /path/to/your/database.dbSQL Server 数据库
要与 SQL Server 数据库一起使用:
node dist/src/index.js --sqlserver --server <server-name> --database <database-name> [--user <username> --password <password>]必需参数:
--server:SQL Server 主机名或 IP 地址--database:数据库名称
可选参数:
--user:SQL Server 身份验证的用户名(如果未提供,则将使用 Windows 身份验证)--password:SQL Server 身份验证的密码--port:端口号(默认值:1433)
PostgreSQL 数据库
要与 PostgreSQL 数据库一起使用:
node dist/src/index.js --postgresql --host <host-name> --database <database-name> [--user <username> --password <password>]必需参数:
--host:PostgreSQL 主机名或 IP 地址--database:数据库名称
可选参数:
--user:PostgreSQL 身份验证的用户名--password:PostgreSQL 身份验证的密码--port:端口号(默认值:5432)--ssl:启用 SSL 连接(true/false)--connection-timeout:连接超时(以毫秒为单位)(默认值:30000)
配置 Claude 桌面
直接使用配置
如果您全局安装了该软件包,请使用以下命令配置 Claude Desktop:
{
"mcpServers": {
"sqlite": {
"command": "npx",
"args": [
"-y",
"@executeautomation/database-server",
"/path/to/your/database.db"
]
},
"sqlserver": {
"command": "npx",
"args": [
"-y",
"@executeautomation/database-server",
"--sqlserver",
"--server", "your-server-name",
"--database", "your-database-name",
"--user", "your-username",
"--password", "your-password"
]
},
"postgresql": {
"command": "npx",
"args": [
"-y",
"@executeautomation/database-server",
"--postgresql",
"--host", "your-host-name",
"--database", "your-database-name",
"--user", "your-username",
"--password", "your-password"
]
}
}
}本地开发配置
对于本地开发,配置 Claude Desktop 以使用本地构建的版本:
{
"mcpServers": {
"sqlite": {
"command": "node",
"args": [
"/absolute/path/to/mcp-database-server/dist/src/index.js",
"/path/to/your/database.db"
]
},
"sqlserver": {
"command": "node",
"args": [
"/absolute/path/to/mcp-database-server/dist/src/index.js",
"--sqlserver",
"--server", "your-server-name",
"--database", "your-database-name",
"--user", "your-username",
"--password", "your-password"
]
},
"postgresql": {
"command": "node",
"args": [
"/absolute/path/to/mcp-database-server/dist/src/index.js",
"--postgresql",
"--host", "your-host-name",
"--database", "your-database-name",
"--user", "your-username",
"--password", "your-password"
]
}
}
}Claude Desktop 配置文件通常位于:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
可用的数据库工具
MCP 数据库服务器提供了以下可供 Claude 使用的工具:
工具 | 描述 | 必需参数 |
| 执行 SELECT 查询来读取数据 |
|
| 执行 INSERT、UPDATE 或 DELETE 查询 |
|
| 在数据库中创建新表 |
|
| 修改现有表架构 |
|
| 从数据库中删除表 |
|
| 获取所有表的列表 | 没有任何 |
| 查看表的架构信息 |
|
| 将查询结果导出为 CSV/JSON |
|
| 将业务洞察添加到备忘录 |
|
| 列出所有业务见解 | 没有任何 |
有关如何与 Claude 一起使用这些工具的实际示例,请参阅使用示例。
其他文档
SQL Server 安装指南:有关连接 SQL Server 数据库的详细信息
PostgreSQL 设置指南:有关连接 PostgreSQL 数据库的详细信息
使用示例:与 Claude 一起使用的示例查询和命令
发展
要在开发模式下运行服务器:
npm run dev观察开发过程中的变化:
npm run watch要求
Node.js 18+
对于 SQL Server 连接:SQL Server 2012 或更高版本
对于 PostgreSQL 连接:PostgreSQL 9.5 或更高版本
执照
麻省理工学院
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/executeautomation/mcp-database-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
