S
Sql MCP
作者 @edintwi
MCP server by edintwi
创建于 5/26/2026
更新于 about 4 hours ago
README
Repository documentation and setup instructions
sql-mcp
Local MCP server exposed over HTTP that runs inside Docker and provides a single query tool against a PostgreSQL database supplied via DATABASE_URL.
Configure
cp .env.example .env
# edit .env and set DATABASE_URL
Run with Docker
docker compose up --build
The MCP endpoint is then available at http://localhost:3000/mcp.
Run locally (without Docker)
npm install
npm run build
npm start
# or, for hot reload:
npm run dev
Register with an MCP client
Point your MCP-compatible client at the streamable HTTP endpoint:
http://localhost:3000/mcp
The transport is streamable-http. Initialize the session with a standard MCP initialize request; subsequent requests must include the mcp-session-id header returned by the server.
Tool
query({ sql: string, params?: unknown[] })— runs a parameterized SQL statement and returns{ command, rowCount, rows }as JSON. Use$1,$2, ... insqland pass values inparams.
快速设置
此服务器的安装指南
安装包 (如果需要)
npx @modelcontextprotocol/server-sql-mcp
Cursor 配置 (mcp.json)
{
"mcpServers": {
"edintwi-sql-mcp": {
"command": "npx",
"args": [
"edintwi-sql-mcp"
]
}
}
}