{"slug": "i-just-published-postgres-mcp-server-in-go", "title": "I just published Postgres MCP Server in Go!", "summary": "Developer Akshay Gupta open-sourced Postgres MCP Server, a Go-based MCP server that connects AI coding assistants like Claude Code and Cursor directly to live PostgreSQL databases. The server exposes nine tools for query execution, performance analysis, and database health checks, shipping as a single ~15 MB static binary with no Python runtime required.", "body_md": "I open sourced a project I have been building on the side: a Go MCP server that connects Claude Code (or Cursor) directly to a live PostgreSQL database.\n\nRepo: [github.com/gupta-akshay/postgres-mcp](https://github.com/gupta-akshay/postgres-mcp)\n\nMost \"AI plus database\" workflows still look like this: copy SQL out of a chat window, paste it into a DB client, run it, copy the output back. It breaks flow, and the assistant never sees your actual schema, so it guesses.\n\nMCP fixes the connection problem. This server is what sits on the other end for Postgres.\n\nThe server exposes nine tools over MCP:\n\n`execute_sql`\n\n- run queries directly (read only in restricted mode)`explain_query`\n\n- EXPLAIN ANALYZE, including against a hypothetical index`get_top_queries`\n\n- pull slow queries from `pg_stat_statements`\n\n`hypopg`\n\n`analyze_db_health`\n\n- vacuum, XID wraparound, replication lag, invalid indexes, and more, checked in parallelThat means you can ask \"why is this query slow\" and the assistant actually runs the EXPLAIN, checks the stats, and can simulate an index before anyone touches the schema.\n\nThe project is inspired by the Python [crystaldba/postgres-mcp](https://github.com/crystaldba/postgres-mcp). I rebuilt it from scratch in Go so it ships as a single ~15 MB static binary. No Python runtime, no dependency chasing. `docker build`\n\n, point Claude Code at it, done.\n\nRestricted mode wraps every call in a read only transaction, so write protection comes from Postgres itself, not string matching on the query text.\n\nThe repo has the full setup instructions, the Docker config, and the test suite (unit, integration, and end to end against a real Postgres container with `pg_stat_statements`\n\nand `hypopg`\n\n). CI fails under 95% coverage.\n\nIf you spend real time in Claude Code or Cursor and also spend real time worrying about Postgres performance, take a look: [github.com/gupta-akshay/postgres-mcp](https://github.com/gupta-akshay/postgres-mcp)\n\nI wrote up the build in more depth on my [blog](https://www.akshaygupta.live/blog/postgres-mcp-server) and on [dev.to](https://dev.to/akshay_gupta/postgres-mcp-in-go-giving-claude-code-a-live-line-to-your-database-1m7m) if you want the architecture and testing details.", "url": "https://wpnews.pro/news/i-just-published-postgres-mcp-server-in-go", "canonical_source": "https://dev.to/akshay_gupta/i-just-published-postgres-mcp-server-in-go-10ab", "published_at": "2026-07-04 06:22:20+00:00", "updated_at": "2026-07-04 06:48:41.838490+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models", "ai-agents"], "entities": ["Akshay Gupta", "Postgres MCP Server", "Claude Code", "Cursor", "PostgreSQL", "Go", "MCP", "pg_stat_statements"], "alternates": {"html": "https://wpnews.pro/news/i-just-published-postgres-mcp-server-in-go", "markdown": "https://wpnews.pro/news/i-just-published-postgres-mcp-server-in-go.md", "text": "https://wpnews.pro/news/i-just-published-postgres-mcp-server-in-go.txt", "jsonld": "https://wpnews.pro/news/i-just-published-postgres-mcp-server-in-go.jsonld"}}