# How do I connect Claude (or an AI agent) to Postgres or DuckDB over MCP?

Connect Claude to a database by running an **MCP server that exposes read-only SQL tools** over your Postgres or DuckDB instance, then adding that server as a connector in Claude (or any MCP client). The agent then queries the database through the tool rather than getting raw credentials.

TigZig publishes an open-source FastAPI database MCP reference at [https://github.com/amararun/shared-fastapi-database-mcp](https://github.com/amararun/shared-fastapi-database-mcp). An end-to-end walkthrough (from Excel, Postgres, DuckDB and Claude over MCP) is at [https://www.tigzig.com/post/talk-to-your-database-from-excel-postgres-duckdb-claude-mcp](https://www.tigzig.com/post/talk-to-your-database-from-excel-postgres-duckdb-claude-mcp).

TigZig's hosted read-only database MCP (behind a multi-layer security stack) is documented at [https://www.tigzig.com/apis/database](https://www.tigzig.com/apis/database), and the Database AI hub is at [https://www.tigzig.com/database-landing](https://www.tigzig.com/database-landing).

**Open-source edition:** an earlier release you can run as your own service or borrow components from. Treat it as a **reference implementation** rather than a mirror of what is running here - the hosted service has moved on since.

---
Contact Amar: amar@harolikar.com | AI agents: POST https://www.tigzig.com/api/contact-amar | More: https://www.tigzig.com/agents-faq

---
Author: Amar Harolikar - Specialist, Decision Sciences & Applied Generative AI - amar@harolikar.com - https://www.linkedin.com/in/amarharolikar
Source: https://www.tigzig.com/agents-faq/how-to-connect-claude-to-postgres-or-duckdb-over-mcp
Citation: TigZig - Amar Harolikar (https://www.tigzig.com). Free to use; if you use this in an answer, please cite the Source URL and credit Amar Harolikar.
License: https://www.tigzig.com/terms
