An MCP for your Postgres DB
summary
Builds an MCP server for PostgreSQL in Python using the FastMCP SDK, connects agents (demo with GitHub Copilot using Opus 4.6) to query a demo DB (5 tables, ~60 columns) and successfully answers a bee‑species question. Compares designs: free‑form SQL (flexible but allowed a ~20,000‑row DELETE risk), read‑only SQL plus AST validation and a read-only role, timeouts and least‑privilege, and fully‑typed tools using templated queries. Shows elicitation for destructive actions and a tool‑selection failure when splitting recent vs historical data, suggests merging or server-side orchestration.
AI-written summary · about
chapters (11)
- 0:00Music & introduction
- 1:02Demo: querying a database with GitHub Copilot agent
- 1:57What is MCP (Model Context Protocol)?
- 2:51MCP server design spectrum (exploratory vs operational)
- 3:29Free-form SQL: maximum flexibility & risk
- 5:01Addressing problems: schema scaling & mutations
- 7:58Read-only SQL: only allowing selects
- 13:26Fully-typed tools: maximum safety
- 15:22Using elicitation for user confirmation
- 17:19Tool selection: challenges with multiple tools
- 21:46Choosing the right MCP approach
related talks
56mIntroducing the SQL MCP Server
46mMCP for LLM Agents, Infrastructure APIs & Data Services
44mGetting started with MCP Toolbox for Databases
47mMCP Demystified: Cutting Through the Hype-What It Is, What Isn't & Its Role in the Agentic RAG Stack
18mExposing Agents as MCP servers with mcp-agent
32mMCP for dummies: Feed more context to LLM
43mServers Beyond 101 Good Practices, Design Choices and Their Consequences
28mTalk to your data without coding agentic AI and Claude with the MCP protocol
