Sandbox
@timescale/pg-aiguide

Postgres docs MCP server and skills for agents

pg-aiguide gives coding agents two things: semantic search over PostgreSQL, TimescaleDB, and PostGIS docs, and curated Postgres skills for better schema and query decisions. The MCP server handles document search, while the skills and prompt files shape how the agent applies that knowledge.

1,835 stars106 forksPythonUpdated 8d ago
Who it's for

Builders who want their coding agent to know PostgreSQL docs and best practices without re-explaining them each session.

What it delivers

You can get more accurate PostgreSQL schemas, indexes, and queries from your agent with less back-and-forth.

What it does

Semantic and keyword doc search

`search_docs` searches the PostgreSQL manual, TimescaleDB docs, and PostGIS docs with version-aware semantic search and BM25 keyword search.

Packaged PostgreSQL skills

`view_skill` exposes curated Postgres best-practice skills for schema design, indexing, data types, constraints, naming, and performance.

Claude Code plugin support

The repo ships a Claude marketplace plugin so you can install the docs and skills as one unit.

Multi-agent install paths

The README includes install steps for Cursor, Codex, Gemini CLI, VS Code, Windsurf, and other MCP-capable tools.

Documentation ingestion pipeline

The `ingest/` code imports PostgreSQL, TimescaleDB, and PostGIS docs into the search index used by the server.

How to get it

  1. 1Install curated PostgreSQL best-practice skills for your AI coding agent
    npx skills add timescale/pg-aiguide --skill postgres
  2. 2Or pick individual skills interactively
    npx skills add timescale/pg-aiguide
  3. 3Or it can be used as a Claude Code Plugin
    claude plugin marketplace add timescale/pg-aiguide
    claude plugin install pg@aiguide
  4. 4This repo serves as a claude code marketplace plugin. To install, run
    claude plugin marketplace add timescale/pg-aiguide
    claude plugin install pg@aiguide
  5. 5Run the following to add the MCP server to codex
    codex mcp add --url "https://mcp.tigerdata.com/docs" pg-aiguide
  6. 6Run the following to add the MCP server to Gemini CLI
    gemini mcp add -s user pg-aiguide "https://mcp.tigerdata.com/docs" -t http

README

pg-aiguide

AI-optimized PostgreSQL expertise for coding assistants

pg-aiguide helps AI coding tools write dramatically better PostgreSQL code. It provides:

  • Semantic search across the official PostgreSQL manual (version-aware)
  • AI-optimized “skills” — curated, opinionated Postgres best practices used automatically by AI agents
  • Extension ecosystem docs, starting with TimescaleDB, with more coming soon

Use it as:

  • Agent Skills via npx skills — works with Claude Code, Cursor, Codex, Gemini CLI, and 40+ other agents
  • a public MCP server that can be used with any AI coding agent, or
  • a Claude Code plugin optimized for use with Claude's native skill support.

⭐ Why pg-aiguide?

AI coding tools often generate Postgres code that is:

  • outdated
  • missing constraints and indexes
  • unaware of modern PG features
  • inconsistent with real-world best practices

pg-aiguide fixes that by giving AI agents deep, versioned PostgreSQL knowledge and proven patterns.

See the difference

https://github.com/user-attachments/assets/5a426381-09b5-4635-9050-f55422253a3d

Video Transcript

Prompt given to Claude Code:

Please describe the schema you would create for an e-commerce website two times, first with the tiger mcp server disabled, then with the tiger mcp server enabled. For each time, write the schema to its own file in the current working directory. Then compare the two files and let me know which approach generated the better schema, using both qualitative and quantitative reasons. For this example, only use standard Postgres.

Result (summarized):

  • 4× more constraints
  • 55% more indexes (including partial/expression indexes)
  • PG17-recommended patterns
  • Modern features (GENERATED ALWAYS AS IDENTITY, NULLS NOT DISTINCT)
  • Cleaner naming & documentation

Conclusion: pg-aiguide produces more robust, performant, maintainable schemas.

🚀 Quickstart

Agent Skills

Install curated PostgreSQL best-practice skills for your AI coding agent:

npx skills add timescale/pg-aiguide --skill postgres

Or pick individual skills interactively:

npx skills add timescale/pg-aiguide

Works with Claude Code, Cursor, Codex, Gemini CLI, VS Code, and 40+ other agents.

For even deeper PostgreSQL knowledge, also add the MCP server to give your agent semantic search over the official PostgreSQL, TimescaleDB, and PostGIS manuals.

MCP Server

For semantic search over PostgreSQL, TimescaleDB, and PostGIS documentation, add the public MCP server:

https://mcp.tigerdata.com/docs

Manual MCP configuration using JSON
{
  "mcpServers": {
    "pg-aiguide": {
      "url": "https://mcp.tigerdata.com/docs"
    }
  }
}

Or it can be used as a Claude Code Plugin:

claude plugin marketplace add timescale/pg-aiguide
claude plugin install pg@aiguide

Install by environment

Install in Cursor Install in VS Code Install in VS Code Insiders Install in Visual Studio Install in Goose Add MCP Server pg-aiguide to LM Studio

Claude Code

This repo serves as a claude code marketplace plugin. To install, run:

claude plugin marketplace add timescale/pg-aiguide
claude plugin install pg@aiguide

This plugin uses the skills available in the skills directory as well as our publicly available MCP server endpoint hosted by TigerData for searching PostgreSQL documentation.

Codex

Run the following to add the MCP server to codex:

codex mcp add --url "https://mcp.tigerdata.com/docs" pg-aiguide
Cursor

One-click install:

Install MCP Server

Or add the following to .cursor/mcp.json

{
  "mcpServers": {
    "pg-aiguide": {
      "url": "https://mcp.tigerdata.com/docs"
    }
  }
}
Gemini CLI

Run the following to add the MCP server to Gemini CLI:

gemini mcp add -s user pg-aiguide "https://mcp.tigerdata.com/docs" -t http
OpenCode

Add the following to your global OpenCode config file (~/.config/opencode/opencode.json), or to a project level opencode.json. See the OpenCode config docs for more about file locations, and the MCP server docs for more about the mcp options.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "pg-aiguide": {
      "type": "remote",
      "url": "https://mcp.tigerdata.com/docs"
    }
  }
}

Add use pg-aiguide to your prompts to use the pg-aiguide tools.

Visual Studio

Click the button to install:

Install in Visual Studio

VS Code

Click the button to install:

Install in VS Code

Alternatively, run the following to add the MCP server to VS Code:

code --add-mcp '{"name":"pg-aiguide","type":"http","url":"https://mcp.tigerdata.com/docs"}'
VS Code Insiders

Click the button to install:

Install in VS Code Insiders

Alternatively, run the following to add the MCP server to VS Code Insiders:

code-insiders --add-mcp '{"name":"pg-aiguide","type":"http","url":"https://mcp.tigerdata.com/docs"}'
Windsurf

Add the following to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "pg-aiguide": {
      "serverUrl": "https://mcp.tigerdata.com/docs"
    }
  }
}

💡 Your First Prompt

Once installed, pg-aiguide can answer Postgres questions or design schemas.

Simple schema example prompt

Create a Postgres table schema for storing usernames and unique email addresses.

Complex schema example prompt

You are a senior software engineer. You are given a task to generate a Postgres schema for an IoT device company. The devices collect environmental data on a factory floor. The data includes temperature, humidity, pressure, as the main data points as well as other measurements that vary from device to device. Each device has a unique id and a human-readable name. We want to record the time the data was collected as well. Analysis for recent data includes finding outliers and anomalies based on measurements, as well as analyzing the data of particular devices for ad-hoc analysis. Historical data analysis includes analyzing the history of data for one device or getting statistics for all devices over long periods of time.

Features

Documentation Search (MCP Tools)

  • search_docs Unified search tool supporting semantic (vector similarity) and keyword (BM25) search across multiple documentation sources:
    • postgres - Official PostgreSQL manual, scoped by version
    • tiger - Tiger Data's documentation (TimescaleDB and ecosystem)
    • postgis - PostGIS spatial extension documentation

Skills (AI-Optimized Best Practices)

  • view_skill
    Exposes curated, opinionated PostgreSQL best-practice skills used automatically by AI coding assistants.

    These skills provide guidance on:

    • Schema design
    • Indexing strategies
    • Data types
    • Data integrity and constraints
    • Naming conventions
    • Performance tuning
    • Modern PostgreSQL features

🔌 Ecosystem Documentation

Supported today:

  • TimescaleDB (docs + skills)
  • PostGIS (docs)

Coming soon:

  • pgvector

We welcome contributions for additional extensions and tools.

🛠 Development

See DEVELOPMENT.md for:

  • running the MCP server locally
  • adding new skills
  • adding new docs

🤝 Contributing

We welcome:

  • new Postgres best-practice skills
  • additional documentation corpora
  • search quality improvements
  • bug reports and feature ideas

📄 License

Apache 2.0

Files in the repo

Repository payload34 top-level entries
  • .claude-plugin
  • .cursor-plugin
  • .github
  • .vscode
  • assets
  • docker
  • ingest
  • migrations
  • rules
  • scripts
  • skills
  • src
  • .dockerignore
  • .env.sample
  • .gitignore
  • API.md
  • biome.json
  • bun
  • bun.lock
  • check
  • CLAUDE.md
  • DEVELOPMENT.md
  • docker-compose.yml
  • Dockerfile
  • generate-server.json.ts
  • LICENSE
  • mcp.json
  • NOTICE
  • package.json
  • README.md
  • release.ts
  • skills.yaml
  • tsconfig.build.json
  • tsconfig.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k