Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
1–10 of 14 posts
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#2Most Postgres MCP servers expose query and list_tables. Agents end up guessing column values, enum casing, and join paths - then retrying until something works.
pglens gives agents the context to get it right the first time: column_values shows real distinct values with counts, find_join_path does BFS over the FK graph and returns join conditions through intermediate tables, describe_table gives columns/PKs/FKs/indexes in one call. Plus production health tools like bloat_stats, blocking_locks, and sequence_health.
Everything runs in readonly transactions, identifiers escaped via Postgres's quote_ident(), no extensions required. Works on any Postgres 12+ (self-hosted, RDS, Aurora, etc.). Two dependencies: asyncpg and mcp.
https://github.com/janbjorge/pglens
pip install pglen
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#3[dead]
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#4[flagged]
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#5[flagged]
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#6This is really nicely, read only is the right way to start
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#7[flagged]
I don't know why but all your comments are getting hidden/flagged/killed for some reason.
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#8This is really nicely, read only is the right way to start
Thanks! Read-only felt like the obvious constraint; agents shouldn't need write access to understand a database.
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#9[flagged]
[dead]
Re: Show HN: Pglens – 27 read-only PostgreSQL tools for AI agents via MCP
#10Read-only by design is a smart constraint for agent tooling — eliminates a whole class of "oops the LLM dropped my table" failure modes. Curious about a couple things: how do you handle schema introspection? Do the tools auto-discover tables/columns or is there a config step? And for the query tools, is there any cost/complexity guardrail (e.g. preventing a full sequential scan on a 500M row table)?