pg-aiguide — Claude Code MCP server: PostgreSQL docs for agents
Gives your coding agent semantic search over the PostgreSQL, TimescaleDB and PostGIS manuals plus curated Postgres best-practice skills.
claude mcp add --transport http pg-aiguide https://mcp.tigerdata.com/docsWhat pg-aiguide does
pg-aiguide is a public MCP server from Timescale. It hands the agent version-aware semantic search across the official PostgreSQL manual, TimescaleDB and PostGIS docs, along with a set of skills holding opinionated Postgres patterns. It plugs into Claude, Codex, Cursor, GitHub Copilot, Windsurf, Cline and Zed.
Two ways to run it. The remote HTTP endpoint at https://mcp.tigerdata.com/docs needs no keys and nothing installed locally. The stdio route runs npx -y @tigerdata/pg-aiguide on your machine and expects OPENAI_API_KEY plus PGHOST, PGPORT, PGUSER and PGPASSWORD. Without those variables the local server won't come up, so start with the remote one if you just want to see what it does.
The repo also works as a Claude plugin, wiring in the same skills and the hosted endpoint. You can skip the server entirely and install skills alone with npx skills add timescale/pg-aiguide --skill postgres, or --skill schema-exploration to inspect an existing database.
What it helps with
- write schemas without outdated PostgreSQL constructs
- find the right manual section for a specific PG version
- add constraints and indexes the agent usually skips
- map out an existing database's structure
- check TimescaleDB or PostGIS docs while coding
Example prompts for the agent
- Describe the schema you'd create for an e-commerce site in standard Postgres and write it to
schema.sql - Look up in the PostgreSQL 17 manual how to declare
GENERATED ALWAYS AS IDENTITY - Explore the existing database and tell me which indexes are missing
How to install pg-aiguide
1Platform CLI: remote server
claude mcp add --transport http pg-aiguide https://mcp.tigerdata.com/docs2Platform CLI
claude mcp add --env OPENAI_API_KEY=<OPENAI_API_KEY> --env PGHOST=<PGHOST> --env PGPORT=<PGPORT> --env PGUSER=<PGUSER> --env PGPASSWORD=<PGPASSWORD> --transport stdio pg-aiguide -- npx -y @tigerdata/pg-aiguideReplace <…> with your own values. 2 more environment variables are in the server README
1Platform CLI: remote server
codex mcp add pg-aiguide --url https://mcp.tigerdata.com/docs2Platform CLI
codex mcp add pg-aiguide --env OPENAI_API_KEY=<OPENAI_API_KEY> --env PGHOST=<PGHOST> --env PGPORT=<PGPORT> --env PGUSER=<PGUSER> --env PGPASSWORD=<PGPASSWORD> -- npx -y @tigerdata/pg-aiguideReplace <…> with your own values. 2 more environment variables are in the server README
Config file
{
"mcpServers": {
"pg-aiguide": {
"url": "https://mcp.tigerdata.com/docs"
}
}
}{
"mcpServers": {
"pg-aiguide": {
"command": "npx",
"args": [
"-y",
"@tigerdata/pg-aiguide"
],
"env": {
"OPENAI_API_KEY": "<OPENAI_API_KEY>",
"PGHOST": "<PGHOST>",
"PGPORT": "<PGPORT>",
"PGUSER": "<PGUSER>",
"PGPASSWORD": "<PGPASSWORD>"
}
}
}
}Replace <…> with your own values. 2 more environment variables are in the server README
Config file
{
"servers": {
"pg-aiguide": {
"type": "http",
"url": "https://mcp.tigerdata.com/docs"
}
}
}{
"servers": {
"pg-aiguide": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@tigerdata/pg-aiguide"
],
"env": {
"OPENAI_API_KEY": "<OPENAI_API_KEY>",
"PGHOST": "<PGHOST>",
"PGPORT": "<PGPORT>",
"PGUSER": "<PGUSER>",
"PGPASSWORD": "<PGPASSWORD>"
}
}
}
}Replace <…> with your own values. 2 more environment variables are in the server README
1Platform CLI: remote server
gemini mcp add -t http pg-aiguide https://mcp.tigerdata.com/docs2Platform CLI
gemini mcp add -e OPENAI_API_KEY=<OPENAI_API_KEY> -e PGHOST=<PGHOST> -e PGPORT=<PGPORT> -e PGUSER=<PGUSER> -e PGPASSWORD=<PGPASSWORD> pg-aiguide npx -y @tigerdata/pg-aiguideReplace <…> with your own values. 2 more environment variables are in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about pg-aiguide
How do I install pg-aiguide in Claude Code?
Add the remote server with claude mcp add --transport http pg-aiguide https://mcp.tigerdata.com/docs. For the local stdio mode use the second command with --env for OPENAI_API_KEY, PGHOST, PGPORT, PGUSER, PGPASSWORD and the npx -y @tigerdata/pg-aiguide launch.
What does pg-aiguide do?
It gives your agent semantic search over the PostgreSQL, TimescaleDB and PostGIS manuals and a set of Postgres best-practice skills. The agent leans on them when writing schemas or queries.
How is the remote server different from running it locally?
The remote one lives at https://mcp.tigerdata.com/docs and needs no keys. The local one runs npx -y @tigerdata/pg-aiguide and reads OPENAI_API_KEY and your database connection settings from environment variables.