AWS PostgreSQL MCP服务器
模型上下文协议(MCP)服务器通过以下方式提供对AWS PostgreSQL数据库的只读SQL查询访问 query 工具。配置使用环境变量。
设置
- 克隆:
git clone https://github.com/T1nker-1220/aws-postgress-mcp-server.git
cd aws-postgress-mcp-server- 安装和构建:
pnpm install
pnpm run build配置(适用于Cline/Windsurf)
将此服务器添加到MCP客户端的设置文件中(例如。, c:\Users\\AppData\Roaming\Windsurf\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json):
{
"mcpServers": {
// ... other servers ...
"aws-postgres-mcp-server": {
"command": "node",
"args": [
// Full path to the built index.js
"C:\\Users\\NATH\\Documents\\Cline\\MCP\\aws-postgress-mcp-server\\build\\index.js"
],
// Database credentials go in the 'env' object
"env": {
"DB_HOST": "YOUR_HOST.rds.amazonaws.com",
"DB_PORT": "5432",
"DB_NAME": "YOUR_DB_NAME",
"DB_USER": "YOUR_DB_USER",
"DB_PASSWORD": "YOUR_PASSWORD"
},
"transportType": "stdio",
"disabled": false,
"autoApprove": []
}
// ... other servers ...
}
}->替换中的占位符值 env 使用您的实际凭据创建对象。
用法
配置后,客户端将启动服务器。使用 query 工具:
aws-postgres-mcp-server
query
{
"sql": "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';"
}
备注
- 服务器只允许只读查询(SELECT、SHOW等)。
- 使用配置客户端
npx @t1nker-1220/aws-postgres-mcp-server ...,必须首先将包发布到npm。配置仍将使用env凭据对象。
