MCP Setup Reference
What MCP is
Model Context Protocol (MCP) is an open standard that lets AI coding agents connect to external tools and data sources. Instead of describing your database to AI in every prompt, MCP lets AI read it directly.
PostgreSQL MCP Server
The package @modelcontextprotocol/server-postgres provides a PostgreSQL MCP server. It connects Claude Code to a PostgreSQL database, giving Claude the ability to read schemas, explore tables, and run queries.
Configuration location
MCP servers are configured in your Claude Code settings. The project-level configuration file is .claude/settings.local.json. The mcpServers key holds server entries.
Connection string format
PostgreSQL connection strings follow this pattern:
postgresql://username:password@host:port/database
For local development with the Sahel Noix tracking system, the connection string matches the DATABASE_URL in your .env file.
What the connection enables
Once connected, Claude can:
- Read the database schema (tables, columns, types, constraints)
- Explore foreign key relationships
- Run queries to verify data
- Generate accurate SQL based on the actual schema (not your description of it)
What to watch for
Claude will use the connection eagerly. Ask specific questions ("show me the schema for the batches table") rather than broad ones ("tell me about the database"). Broad questions can trigger expensive queries on large tables.