Skip to content
LangChain

PostgreSQL (hardened, read-only) for LangChain

io.github.eszetael/postgres-mcp-hardened

Read-only PostgreSQL over MCP. Writes refused at the parsed SQL, plus a READ ONLY transaction.

client:LangChain transport:stdio runtime:npm

Install PostgreSQL (hardened, read-only) in LangChain

pip install langchain-mcp-adapters

from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient({
        "postgres-mcp-hardened": {
            "transport": "stdio",
            "command": "npx",
            "args": ["-y", "postgres-mcp-hardened"],
        }
})

tools = await client.get_tools()

get_tools() returns the server's tools as LangChain tools, ready for an agent. LangChain docs

PostgreSQL (hardened, read-only) in other clients