Stdio MCP server for local PostgreSQL. Tools: list_tables, describe_table, query.
go run . serve --dsn 'postgres://[email protected]:5432/dbname?sslmode=disable'Or set DATABASE_URL and run go run . serve.
.cursor/mcp.json in the app repo:
{
"mcpServers": {
"leif": {
"command": "go",
"args": ["run", "/absolute/path/to/leif", "serve"],
"env": {
"DATABASE_URL": "postgres://[email protected]:5432/dbname?sslmode=disable"
}
}
}
}On PATH: "command": "leif", "args": ["serve"]. Reload, then enable it in Settings → MCP.
Workspace .cursor/mcp.json overrides ~/.cursor/mcp.json. To keep the DSN out of git, use "DATABASE_URL": "${env:DATABASE_URL}".
Use Leif to list tables, then describe
public.orders.
Optional .cursor/rules/leif.mdc so it does this without being asked:
---
description: Use Leif for PostgreSQL questions
alwaysApply: true
---
Use Leif MCP tools for schema and data. Call `list_tables` or `describe_table` before SQL, then `query`.