
MCP 数据库服务器是新的 MCP 服务器,帮助连接 Sqlite、SqlServer 和 PosgreSQL 数据库
概览
该MCP(模型上下文协议)服务器为Claude提供数据库访问功能,支持SQLite、SQL Server、PostgreSQL和MySQL数据库。 使用该MCP服务器与Claude有两种方式: 1. : 全局安装包并直接使用 2.: 从本地开发环境中运行 使用这台MCP服务器最简单的方式是全局安装: 这样你可以直接使用服务器,而无需本地构建。 如果你想修改代码或在本地环境中运行: 1. 克隆并构建仓库,如安装部分所示 2.使用功能部分的命令运行服务器 所需参数:- --服务器:SQL Server 主机名或 IP 地址 - --数据库:数据库名称
概述(AI 翻译)
该MCP(模型上下文协议)服务器为Claude提供数据库访问功能,支持SQLite、SQL Server、PostgreSQL和MySQL数据库。
安装
-
克隆仓库:
-
安装依赖:
-
建设项目:
使用选项
使用该MCP服务器与Claude有两种方式:
- 直接使用:全局安装包并直接使用
- 本地开发:从你的本地开发环境中运行
直接使用 NPM 包
使用这台MCP服务器最简单的方式是全局安装:
这样你可以直接使用服务器,而无需本地构建。
本地开发设置
如果你想修改代码或在本地环境中运行:
- 克隆并构建仓库,如安装部分所示
- 使用以下使用部分中的命令运行服务器
用途
SQLite 数据库
用于SQLite数据库:
SQL Server 数据库
用于SQL Server数据库:
所需参数:
--server:SQL Server 主机名或 IP 地址--database:数据库名称
可选参数:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Database Server
This MCP (Model Context Protocol) server provides database access capabilities to Claude, supporting SQLite, SQL Server, PostgreSQL, and MySQL databases.
Installation
- Clone the repository:
git clone https://github.com/executeautomation/mcp-database-server.git
cd mcp-database-server
- Install dependencies:
npm install
- Build the project:
npm run build
Usage Options
There are two ways to use this MCP server with Claude:
- Direct usage: Install the package globally and use it directly
- Local development: Run from your local development environment
Direct Usage with NPM Package
The easiest way to use this MCP server is by installing it globally:
npm install -g @executeautomation/database-server
This allows you to use the server directly without building it locally.
Local Development Setup
If you want to modify the code or run from your local environment:
- Clone and build the repository as shown in the Installation section
- Run the server using the commands in the Usage section below
Usage
SQLite Database
To use with an SQLite database:
node dist/src/index.js /path/to/your/database.db
SQL Server Database
To use with a SQL Server database:
node dist/src/index.js --sqlserver --server --database [--user --password ]
Required parameters:
--server: SQL Server host name or IP address--database: Name of the database
Optional parameters:
--user: Username for SQL Server authentication (if not provided, Windows Authentication will be used)--password: Password for SQL Server authentication--port: Port number (default: 1433)
PostgreSQL Database
To use with a PostgreSQL database:
node dist/src/index.js --postgresql --host --database [--user --password ]
Required parameters:
--host: PostgreSQL host name or IP address--database: Name of the database
Optional parameters:
--user: Username for PostgreSQL authentication--password: Password for PostgreSQL authentication--port: Port number (default: 5432)--ssl: Enable SSL connection (true/false)--connection-timeout: Connection timeout in milliseconds (default: 30000)
MySQL Database
Standard Authentication
To use with a MySQL database:
node dist/src/index.js --mysql --host --database --port [--user --password ]
Required parameters:
--host: MySQL host name or IP address--database: Name of the database--port: Port number (default: 3306)
Optional parameters:
--user: Username for MySQL authentication--password: Password for MySQL authentication
安装
npx -y @executeautomation/database-server /path/to/your/database.db配置
{
"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"
]
},
"mysql": {
"command": "npx",
"args": [
"-y",
"@executeautomation/database-server",
"--mysql",
"--host", "your-host-name",
"--database", "your-database-name",
"--port", "3306",
"--user", "your-username",
"--password", "your-password"
]
},
"mysql-aws": {
"command": "npx",
"args": [
"-y",
"@executeautomation/database-server",
"--mysql",
"--aws-iam-auth",
"--host", "your-rds-endpoint.region.rds.amazonaws.com",
"--database", "your-database-name",
"--user", "your-aws-username",
"--aws-region", "us-east-1"
]
…