One-command Postgres MCP Server backed by PGlite (WASM)
pglite-mcp
One-command Postgres MCP Server backed by PGlite (WASM).
Zero install, zero config — an embedded Postgres database with pgvector that AI agents can query via the Model Context Protocol. Think "SQLite for Postgres, but with MCP built-in."
npx pglite-mcp --extensions vector
3MB. No Docker. No Postgres install. Just a single command.
Why?
Every AI agent eventually needs a database. Vector search, structured data, session state — you name it. But spinning up Postgres is painful: Docker, pgvector extension, auth config, connection strings.
pglite-mcp bundles PGlite (WASM Postgres) + pgvector + MCP server into a single command. Your agent gets a full Postgres database with vector search, instantly.
Quick Start
# Basic — in-memory Postgres
npx pglite-mcp
# With pgvector and persistent storage
npx pglite-mcp --db ./my-data --extensions vector
# With pgvector and pgcrypto
npx pglite-mcp --db ./my-data --extensions vector,pgcrypto
Supported Extensions
| Extension | Description |
|-----------|-------------|
| vector | pgvector — vector similarity search (exact & ANN, L2/cosine/inner product) |
| age | Apache AGE — graph database with OpenCypher support |
| postgis | PostGIS — geospatial data types and functions |
| pgcrypto | Cryptographic functions (hashing, encryption, UUID generation) |
| uuid-ossp | UUID generation (v1, v3, v4, v5) |
| pg_trgm | Trigram-based text similarity and fuzzy search |
| hstore | Key-value store within a single PostgreSQL value |
| citext | Case-insensitive text type |
| unaccent | Remove accents from text for search |
| ltree | Hierarchical tree-structured data type |
| fuzzystrmatch | Fuzzy string matching (Levenshtein, Soundex, Metaphone) |
| tablefunc | Table functions (crosstab, etc.) |
| btree_gin / btree_gist | GIN/GiST index support for B-tree operators |
| earthdistance | Great-circle distance calculations |
| intarray | Integer array functions and operators |
| isn | International Standard Numbers (ISBN, ISSN, UPC, EAN13) |
| cube | Multi-dimensional cube data type |
| seg | Line segment / floating point interval data type |
| bloom | Bloom filter index access method |
MCP Configuration
Add to your MCP client config:
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"pglite": {
"command": "npx",
"args": ["-y", "pglite-mcp", "--db", "./pglite-data", "--extensions", "vector"]
}
}
}
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"pglite": {
"command": "npx",
"args": ["-y", "pglite-mcp", "--db", "./pglite-data", "--extensions", "vector"]
}
}
}
Hermes Agent:
hermes config set mcp_servers.pglite.command "npx"
hermes config set mcp_servers.pglite.args '["-y", "pglite-mcp", "--db", "./pglite-data", "--extensions", "vector"]'
hermes config set mcp_servers.pglite.enabled true
How It Works
┌─────────────────┐ stdio (MCP) ┌──────────────┐
│ AI Agent │ ◄────────────────► │ MCP Server │
│ (Claude, GPT) │ │ (Zed/Anthropic)│
└─────────────────┘ └──────┬───────┘
│ PG wire protocol
│ (localhost:5432)
┌──────▼───────┐
│ PGlite │
│ (WASM PG) │
│ + pgvector │
└──────────────┘
- PGlite — A 3MB WASM build of PostgreSQL that runs in Node.js
- pglite-socket — Exposes PGlite over the Postgres wire protocol on a TCP port
- Postgres MCP Server — The standard MCP server for PostgreSQL (read-only queries, schema inspection)
- pglite-mcp — Ties them together: starts PGlite → launches MCP server → agent can query
Options
| Flag | Default | Description |
|------|---------|-------------|
| --db, -d | memory:// | Database directory for persistent storage |
| --port, -p | 5432 | PGlite wire-protocol port |
| --host | 127.0.0.1 | Bind address |
| --extensions, -e | (none) | Comma-separated extensions |
| --help | | Show help |
License
MIT
Related
- PGlite — WASM Postgres by Electric SQL
- pgvector — Vector similarity search for Postgres
- MCP (Model Context Protocol) — Anthropic's open protocol for AI-tool integration