[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"pack-detail-postgres-for-agents-en":3,"seo:pack:postgres-for-agents:en":59},{"code":4,"message":5,"data":6},200,"操作成功",{"pack":7},{"slug":8,"icon":9,"tone":10,"status":11,"status_label":12,"title":13,"description":14,"items":15,"install_cmd":58},"postgres-for-agents","🐘","#3730A3","stable","Stable","Postgres for AI Agents","PostgreSQL MCP servers (two flavors), DBHub universal database MCP, Neon serverless Postgres, Supabase MCP — all the SQL surfaces an agent needs.",[16,28,35,43,50],{"id":17,"uuid":18,"slug":19,"title":20,"description":21,"author_name":22,"view_count":23,"vote_count":24,"lang_type":25,"type":26,"type_label":27},154,"1ca69a22-de42-4722-af49-3d0869362e2d","postgresql-mcp-server-database-queries-ai-1ca69a22","PostgreSQL MCP Server — Database Queries for AI","MCP server for PostgreSQL database access. Run read-only SQL queries, inspect schemas, list tables, and analyze data directly from Claude Code or Cursor.","MCP Hub",290,0,"en","mcp","MCP",{"id":29,"uuid":30,"slug":31,"title":32,"description":33,"author_name":22,"view_count":34,"vote_count":24,"lang_type":25,"type":26,"type_label":27},660,"faa28c56-1377-4109-9e8f-a9b2be119d16","postgresql-mcp-sql-database-server-ai-agents-faa28c56","PostgreSQL MCP — SQL Database Server for AI Agents","MCP server that gives AI agents direct access to PostgreSQL databases. Run queries, explore schemas, manage tables, and analyze data through natural language. 3,000+ stars.",308,{"id":36,"uuid":37,"slug":38,"title":39,"description":40,"author_name":41,"view_count":42,"vote_count":24,"lang_type":25,"type":26,"type_label":27},522,"943f4349-7127-400b-9cd3-bbb8f67982a3","dbhub-universal-database-mcp-server-zero-dependencies-943f4349","DBHub — Universal Database MCP Server, Zero Dependencies","Token-efficient database MCP server supporting Postgres, MySQL, MariaDB, SQL Server, and SQLite. Just two MCP tools, zero dependencies, read-only safe.","TokRepo精选",316,{"id":44,"uuid":45,"slug":46,"title":47,"description":48,"author_name":22,"view_count":49,"vote_count":24,"lang_type":25,"type":26,"type_label":27},685,"a561d526-fcb0-474b-a566-82b45e889f68","neon-serverless-postgres-database-branching-a561d526","Neon — Serverless Postgres with Database Branching","Serverless PostgreSQL with instant database branching, autoscaling, and a generous free tier. Branch your database like git branches — test schema changes without touching production. 16,000+ stars.",341,{"id":51,"uuid":52,"slug":53,"title":54,"description":55,"author_name":56,"view_count":57,"vote_count":24,"lang_type":25,"type":26,"type_label":27},641,"b141b1a9-a134-4be5-9708-93d48ccc7ff4","supabase-mcp-postgres-auth-server-ai-agents-b141b1a9","Supabase MCP — Postgres + Auth Server for AI Agents","MCP server for Supabase that gives AI agents access to PostgreSQL databases, authentication, storage, and edge functions. Query data, manage users, and build full-stack features. 4,000+ stars.","Supabase",313,"tokrepo install pack\u002Fpostgres-for-agents",{"pageType":60,"pageKey":8,"locale":25,"title":61,"metaDescription":62,"h1":13,"tldr":63,"bodyMarkdown":64,"faq":65,"schema":81,"internalLinks":90,"citations":103,"wordCount":116,"generatedAt":117},"pack","Postgres for AI Agents: 5 MCP servers + serverless Postgres","PostgreSQL MCP servers (two flavors), DBHub universal DB MCP, Neon serverless and Supabase MCP — every SQL surface a Claude or Cursor agent needs.","Five battle-tested ways to give an agent SQL access to Postgres — two stdio MCP servers, one universal multi-DB router, and two managed cloud backends. Install in one command via TokRepo.","## What's in this pack\n\nThis pack collects the **five SQL surfaces** an agent realistically needs to read, write, and reason about a Postgres database. Two are stdio MCP servers you point at your own DSN. One is a universal MCP server that handles Postgres, MySQL, SQLite and more. The last two are managed cloud Postgres providers with first-class agent integration.\n\n| # | Asset | Type | Best for |\n|---|---|---|---|\n| 1 | PostgreSQL MCP (reference) | stdio MCP server | local & self-hosted Postgres |\n| 2 | PostgreSQL MCP (community) | stdio MCP server | extra tools (explain, indexes) |\n| 3 | DBHub | universal MCP | one server, many DB engines |\n| 4 | Neon serverless Postgres | managed cloud + MCP | branching for AI agents |\n| 5 | Supabase MCP | managed cloud + MCP | full BaaS (auth, storage, RLS) |\n\nThe reference PostgreSQL MCP server lives in the official `modelcontextprotocol\u002Fservers` repo and is the simplest stdio binding: `query`, `list_tables`, `describe_table`. The community variant adds `explain`, `index_advice`, and parameterized writes. DBHub abstracts the connection layer so one MCP install can hit Postgres, MySQL, SQLite or DuckDB. Neon and Supabase ship their own MCPs that go beyond raw SQL — Neon exposes branch creation as a tool (one DB per agent task), Supabase exposes auth, storage, and Row Level Security.\n\n## Why Postgres for agents matters\n\nMost \"agent + database\" demos cheat. They use a fresh ephemeral SQLite, hand-rolled fixtures, no concurrency. Real apps run on Postgres with hundreds of tables, RLS policies, JSON columns, and existing connection pooling. Plugging an LLM into that surface naively is how you end up with a DELETE without WHERE in production.\n\nThis pack picks the five servers that handle the realities:\n- **Read-only mode by default.** All five servers ship with read-only flags or capability scoping.\n- **Schema introspection.** The agent can ask `describe_table` instead of guessing column names.\n- **Connection pooling.** Each server reuses a pool — no per-query reconnect storms.\n- **Branch \u002F sandbox.** Neon's branch tool lets every agent task get its own throwaway database in 200ms.\n\n## Install in one command\n\n```bash\n# Pack install — drops MCP server configs into your tool's config file\ntokrepo install pack\u002Fpostgres-for-agents\n\n# Or pick servers individually\ntokrepo install postgres-mcp\ntokrepo install dbhub\ntokrepo install neon-mcp\ntokrepo install supabase-mcp\n```\n\nThe TokRepo CLI writes config to the right place for each tool — `claude_desktop_config.json` for Claude Code, `mcp.json` for Cursor, AGENTS.md for Codex CLI. Connection strings stay in your env vars; the configs only carry server names.\n\n## Common pitfalls\n\n- **Don't expose write access on day one.** Start with `--read-only`. Promote to read-write only after you've watched the agent execute a few hundred reads safely.\n- **Use a dedicated role, not the postgres superuser.** Create a `mcp_agent` role with `SELECT` on the schemas you actually want exposed. RLS policies should also apply to this role.\n- **Watch the schema-dump cost.** `list_tables` on a 500-table production schema can blow the agent's context. Filter to a single schema or an allow-list.\n- **Branching only buys you safety if you actually use it.** Neon branches are cheap — create one per agent task, point the MCP at the branch DSN, and discard after.\n- **Supabase RLS is not optional.** If the agent connects with a service role key, RLS is bypassed. Use anon + JWT for any task touching user data.\n\n## Relationship to other packs\n\nThis pack is the **structured-data** layer. For semantic \u002F unstructured retrieval (similarity search, RAG over documents) you want the [Vector DB Showdown](\u002Fen\u002Fpacks\u002Fvector-db-showdown) pack — Chroma, Qdrant, Weaviate, Pinecone. For the broader MCP toolbox (filesystem, browser, GitHub, etc) see [MCP Server Stack](\u002Fen\u002Fpacks\u002Fmcp-server-stack). Production agents typically use one item from each pack: Postgres for transactional state, a vector DB for embeddings, and the MCP stack for tool surfaces.",[66,69,72,75,78],{"q":67,"a":68},"Is the reference PostgreSQL MCP server free?","Yes — it's open-source MIT, shipped in the official modelcontextprotocol\u002Fservers repository, no usage limits beyond your own database. You only pay for the database itself (Neon and Supabase have generous free tiers; self-hosted Postgres is free). The MCP layer adds zero cost or telemetry.",{"q":70,"a":71},"How does DBHub compare to running multiple PostgreSQL MCP instances?","DBHub is one MCP process that fronts many DSNs — Postgres, MySQL, SQLite, DuckDB. If your agent needs three databases, DBHub is one server slot with three named connections. Multiple PostgreSQL MCPs work too, but eat one MCP slot each and don't share schema cache. Use DBHub for multi-DB workflows; native PostgreSQL MCP for single-DB precision.",{"q":73,"a":74},"Will this work with Claude Code or Cursor?","Both, plus Codex CLI, Gemini CLI, Cline, Roo Code, Windsurf, and Copilot. MCP is a standard — TokRepo CLI just writes the right config file for each tool. Neon and Supabase MCPs work the same way; Neon also publishes a Cursor extension that does branch-per-task automatically.",{"q":76,"a":77},"Difference between this pack and Vector DB Showdown?","Postgres handles structured rows — orders, users, the data you'd query with SELECT WHERE. Vector DBs handle similarity over embeddings — find me documents that mean approximately X. They're complementary. Real RAG apps run both: Postgres for facts, Qdrant or Chroma for semantic recall, joined by a foreign key in metadata.",{"q":79,"a":80},"What's the gotcha with Supabase service role keys?","The service role key bypasses Row Level Security. If you wire an MCP to that key, the agent can read every user's data — not just the current user's. Always prefer the anon key plus a per-session JWT for tasks that touch user data, and reserve the service role for admin tasks behind a human approval step.",{"@context":82,"@type":83,"name":13,"description":84,"numberOfItems":85,"publisher":86},"https:\u002F\u002Fschema.org","CollectionPage","PostgreSQL MCP servers, DBHub, Neon and Supabase — every SQL surface an agent needs.",5,{"@type":87,"name":88,"url":89},"Organization","TokRepo","https:\u002F\u002Ftokrepo.com",[91,95,99],{"url":92,"anchor":93,"reason":94},"\u002Fen\u002Fpacks\u002Fmcp-server-stack","MCP Server Stack","broader MCP toolbox these servers fit into",{"url":96,"anchor":97,"reason":98},"\u002Fen\u002Fpacks\u002Fvector-db-showdown","Vector DB Showdown","the embedding-side companion to SQL data",{"url":100,"anchor":101,"reason":102},"\u002Fen\u002Fpacks\u002Fheadless-cms-for-ai","Headless CMS for AI","managed-content backends with REST + GraphQL",[104,108,112],{"claim":105,"source_name":106,"source_url":107},"Official PostgreSQL MCP Server reference","modelcontextprotocol\u002Fservers","https:\u002F\u002Fgithub.com\u002Fmodelcontextprotocol\u002Fservers\u002Ftree\u002Fmain\u002Fsrc\u002Fpostgres",{"claim":109,"source_name":110,"source_url":111},"Supabase MCP server documentation","supabase\u002Fmcp-server-supabase","https:\u002F\u002Fgithub.com\u002Fsupabase-community\u002Fsupabase-mcp",{"claim":113,"source_name":114,"source_url":115},"Neon serverless Postgres branching","Neon docs","https:\u002F\u002Fneon.tech\u002Fdocs\u002Fintroduction\u002Fbranching",647,"2026-05-02T15:00:00Z"]