lioarce01/postgres-mcp-server
3.1
If you are the rightful owner of postgres-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project implements an MCP server for interacting with a PostgreSQL database using LLMs, allowing structured access and manipulation through natural language.
Postgres MCP Server
This project implements an MCP (Model-Context-Protocol) server for interacting with a PostgreSQL database using LLMs (Language Models). It allows structured access and manipulation of a PostgreSQL database through natural language.
Features
- Expose a PostgreSQL interface to LLMs
- Use TypeScript and Node.js
- Compile with TypeScript
- Lightweight Docker image using multi-stage builds
Requirements
- Docker
- PostgreSQL database
Local Development
To run locally:
pnpm install
pnpm run build
node dist/index.js postgresql://<user>:<password>@<host>:<port>/<database>
Example:
node dist/index.js postgresql://postgres:admin@localhost:5432/postgres
Docker Usage
Build Docker Image
docker build -t postgres-mcp .
Run with Docker
docker run --rm -it postgres-mcp postgresql://username:password@host.docker.internal:5432/mydb
LLM Integration (e.g. with Claude or VSCode Copilot)
To configure the server for use with an LLM agent:
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"postgres-mcp",
"postgresql://username:password@host.docker.internal:5432/mydb"
]
}
}
}
Project Structure
āāā index.ts
āāā dist/
āāā Dockerfile
āāā LICENSE
āāā README.md
āāā package.json
āāā tsconfig.json
āāā pnpm-lock.yaml
License
MIT