pg-aiguide
Comprehensive PostgreSQL documentation and best practices, including ecosystem tools
使うべきか
品質と安全性
ツール定義とプロトコルへの準拠に関する自動分析に基づいています。
コンテキストコスト
これは、サーバーのツールがモデルのコンテキストに読み込まれるたびに消費されるおおよそのトークン数です。数が多いほど、ほかのタスクに使える注意が減ります。
インストール
ワンクリックインストール
これを `claude_desktop_config.json` ファイルに追加してください:
{
"mcpServers": {
"pg-aiguide": {
"command": "npx",
"args": [
"@tigerdata/pg-aiguide"
]
}
}
}実行可能なパッケージ
0.6.1stdioリモートエンドポイント
https://mcp.tigerdata.com/docsstreamable-httpできること
ツール一覧
ツール(3)
🟢search_docs(source, query, limit, semanticWeight)
Search documentation with hybrid semantic (vector) and keyword (BM25) search. Use semanticWeight to choose keyword-only (0), semantic-only (1), or a blend; mid values fuse rankings with RRF. Supports Tiger Cloud (TimescaleDB), PostgreSQL, and PostGIS. A hit is one chunk of a page, often part of a larger section: a table row without its header, one step of a procedure. Before answering from a hit, read it in context: get_context with the hit's chunk_id returns the whole section it is in, and from there its parent section, the page and the page's outline. For exact figures (limits, prices, plan features) prefer keyword-heavy searches (semanticWeight 0–0.3) that use the words the docs would use.
入力スキーマ
{
"type": "object",
"properties": {
"source": {
"type": "string",
"enum": [
"tiger",
"postgres_14",
"postgres_15",
"postgres_16",
"postgres_17",
"postgres_18",
"postgis_3.3",
"postgis_3.4",
"postgis_3.5",
"postgis_3.6"
],
"description": "The documentation source to search. \"tiger\" for Tiger Cloud and TimescaleDB, \"postgres\" for PostgreSQL, \"postgis\" for PostGIS spatial extension. Specific versions provided with _X.X suffixes."
},
"query": {
"type": "string",
"description": "The search query. Used for BM25 when keyword or hybrid search applies, and for the embedding when semantic or hybrid search applies."
},
"limit": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
],
"description": "The maximum number of matches to return. Defaults to 20."
},
"semanticWeight": {
"anyOf": [
{
"type": "number",
"minimum": 0,
"maximum": 1,
"multipleOf": 0.1
},
{
"type": "null"
}
],
"description": "Controls the balance between semantic and keyword search. 0 = keyword only, 0.5 = equal mix, 1 = semantic only. Default is 0.7 (favor semantic search)."
}
},
"required": [
"source",
"query",
"limit",
"semanticWeight"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The unique identifier of the documentation entry."
},
"content": {
"type": "string",
"description": "The content of the documentation entry."
},
"metadata": {
"type": "string",
"description": "Additional metadata about the documentation entry, as a JSON encoded string."
},
"chunk_id": {
"type": "string",
"description": "Id of this chunk. Pass it to get_context to read the whole section the chunk is in."
},
"section_id": {
"type": "string",
"description": "Id of the section this chunk is part of (get_context)."
},
"page_id": {
"type": "string",
"description": "Id of the page this chunk is on (get_context: the page and its outline)."
},
"headings": {
"type": "array",
"items": {
"type": "string"
},
"description": "Heading path of the section, page title first."
},
"url": {
"description": "Link to the section on the docs site.",
"type": [
"string",
"null"
]
},
"distance": {
"type": "number",
"description": "The distance score indicating the relevance of the entry to the query. Lower values indicate higher relevance."
}
},
"required": [
"id",
"content",
"metadata",
"chunk_id",
"section_id",
"page_id",
"headings",
"url",
"distance"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The unique identifier of the documentation entry."
},
"content": {
"type": "string",
"description": "The content of the documentation entry."
},
"metadata": {
"type": "string",
"description": "Additional metadata about the documentation entry, as a JSON encoded string."
},
"chunk_id": {
"type": "string",
"description": "Id of this chunk. Pass it to get_context to read the whole section the chunk is in."
},
"section_id": {
"type": "string",
"description": "Id of the section this chunk is part of (get_context)."
},
"page_id": {
"type": "string",
"description": "Id of the page this chunk is on (get_context: the page and its outline)."
},
"headings": {
"type": "array",
"items": {
"type": "string"
},
"description": "Heading path of the section, page title first."
},
"url": {
"description": "Link to the section on the docs site.",
"type": [
"string",
"null"
]
},
"score": {
"type": "number",
"description": "The score indicating the relevance of the entry to the keywords. Higher values indicate higher relevance."
}
},
"required": [
"id",
"content",
"metadata",
"chunk_id",
"section_id",
"page_id",
"headings",
"url",
"score"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"id": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "The unique identifier of the documentation entry."
},
"content": {
"type": "string",
"description": "The content of the documentation entry."
},
"metadata": {
"type": "string",
"description": "Additional metadata about the documentation entry, as a JSON encoded string."
},
"chunk_id": {
"type": "string",
"description": "Id of this chunk. Pass it to get_context to read the whole section the chunk is in."
},
"section_id": {
"type": "string",
"description": "Id of the section this chunk is part of (get_context)."
},
"page_id": {
"type": "string",
"description": "Id of the page this chunk is on (get_context: the page and its outline)."
},
"headings": {
"type": "array",
"items": {
"type": "string"
},
"description": "Heading path of the section, page title first."
},
"url": {
"description": "Link to the section on the docs site.",
"type": [
"string",
"null"
]
},
"rrf_score": {
"type": "number",
"description": "Hybrid search: fused RRF score from combining semantic and keyword result rankings."
}
},
"required": [
"id",
"content",
"metadata",
"chunk_id",
"section_id",
"page_id",
"headings",
"url",
"rrf_score"
],
"additionalProperties": false
}
]
}
}
},
"required": [
"results"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟢view_skill(skill_name, path)
Retrieve detailed skills for TimescaleDB operations and best practices. ## Available Skills <available_skills> [11 ]{name description}: design-postgis-tables Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and performance patterns for location-based applications design-postgres-tables "Use this skill for general PostgreSQL table design.\n\n**Trigger when user asks to:**\n- Design PostgreSQL tables, schemas, or data models when creating new tables and when modifying existing ones.\n- Choose data types, constraints, or indexes for PostgreSQL\n- Create user tables, order tables, reference tables, or JSONB schemas\n- Understand PostgreSQL best practices for normalization, constraints, or indexing\n- Design update-heavy, upsert-heavy, or OLTP-style tables\n\n\n**Keywords:** PostgreSQL schema, table design, data types, PRIMARY KEY, FOREIGN KEY, indexes, B-tree, GIN, JSONB, constraints, normalization, identity columns, partitioning, row-level security\n\nComprehensive reference covering data types, indexing strategies, constraints, JSONB patterns, partitioning, and PostgreSQL-specific best practices.\n" find-hypertable-candidates "Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to Timescale/TimescaleDB hypertables.\n\n**Trigger when user asks to:**\n- Analyze database tables for hypertable conversion potential\n- Identify time-series or event tables in an existing schema\n- Evaluate if a table would benefit from Timescale/TimescaleDB\n- Audit PostgreSQL tables for migration to Timescale/TimescaleDB/TigerData\n- Score or rank tables for hypertable candidacy\n\n\n**Keywords:** hypertable candidate, table analysis, migration assessment, Timescale, TimescaleDB, time-series detection, insert-heavy tables, event logs, audit tables\n\nProvides SQL queries to analyze table statistics, index patterns, and query patterns. Includes scoring criteria (8+ points = good candidate) and pattern recognition for IoT, events, transactions, and sequential data.\n" migrate-postgres-tables-to-hypertables "Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation.\n\n**Trigger when user asks to:**\n- Migrate or convert PostgreSQL tables to hypertables\n- Execute hypertable migration with minimal downtime\n- Plan blue-green migration for large tables\n- Validate hypertable migration success\n- Configure compression after migration\n\n**Prerequisites:** Tables already identified as candidates (use find-hypertable-candidates first if needed)\n\n**Keywords:** migrate to hypertable, convert table, Timescale, TimescaleDB, blue-green migration, in-place conversion, create_hypertable, migration validation, compression setup\n\nStep-by-step migration planning including: partition column selection, chunk interval calculation, PK/constraint handling, migration execution (in-place vs blue-green), and performance validation queries.\n" pgvector-semantic-search "Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search.\n\n**Trigger when user asks to:**\n- Store or search vector embeddings in PostgreSQL\n- Set up semantic search, similarity search, or nearest neighbor search\n- Create HNSW or IVFFlat indexes for vectors\n- Implement RAG (Retrieval Augmented Generation) with PostgreSQL\n- Optimize pgvector performance, recall, or memory usage\n- Use binary quantization for large vector datasets\n\n**Keywords:** pgvector, embeddings, semantic search, vector similarity, HNSW, IVFFlat, halfvec, cosine distance, nearest neighbor, RAG, LLM, AI search\n\nCovers: halfvec storage, HNSW index configuration (m, ef_construction, ef_search), quantization strategies, filtered search, bulk loading, and performance tuning.\n" postgres "Use this skill for any PostgreSQL database work — table design, indexing, data types, constraints, extensions (pgvector, PostGIS, TimescaleDB), search, and migrations.\n\n**Trigger when user asks to:**\n- Explore an existing PostgreSQL database to understand its objects and relationships\n- Design or modify PostgreSQL tables, schemas, or data models\n- Choose data types, constraints, indexes, or partitioning strategies\n- Work with pgvector embeddings, semantic search, or RAG\n- Set up full-text search, hybrid search, or BM25 ranking\n- Use PostGIS for spatial/geographic data\n- Set up TimescaleDB hypertables for time-series data\n- Migrate tables to hypertables or evaluate migration candidates\n- Plan or execute safe schema migrations with zero downtime\n\n**Keywords:** PostgreSQL, Postgres, SQL, schema, table design, indexes, constraints, pgvector, PostGIS, TimescaleDB, hypertable, semantic search, hybrid search, BM25, time-series, migration\n" postgres-database-migration "Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases.\n\n**Trigger when user asks to:**\n- Test a schema migration before applying it to production\n- Add, remove, or rename columns safely on a live table\n- Change a column's data type without downtime\n- Add or drop indexes, constraints, or foreign keys on large tables\n- Understand which ALTER TABLE operations lock the table\n- Roll back a failed migration\n- Plan a zero-downtime migration strategy\n- Fork a database to test a migration safely\n\n**Keywords:** migration, schema change, ALTER TABLE, add column, drop column, rename column, change type, zero downtime, lock, AccessExclusiveLock, concurrent index, forking, rollback, backfill, deploy\n\nCovers: lock-level reference for every common DDL operation, safe migration patterns, fork-based testing, zero-downtime column changes, index creation, constraint addition, backfill strategies, pre/post-migration validation, and rollback planning.\n" postgres-hybrid-text-search "Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal Rank Fusion (RRF).\n\n**Trigger when user asks to:**\n- Combine keyword and semantic search\n- Implement hybrid search or multi-modal retrieval\n- Use BM25/pg_textsearch with pgvector together\n- Implement RRF (Reciprocal Rank Fusion) for search\n- Build search that handles both exact terms and meaning\n\n\n**Keywords:** hybrid search, BM25, pg_textsearch, RRF, reciprocal rank fusion, keyword search, full-text search, reranking, cross-encoder\n\nCovers: pg_textsearch BM25 index setup, parallel query patterns, client-side RRF fusion (Python/TypeScript), weighting strategies, and optional ML reranking.\n" schema-exploration "Explore an existing PostgreSQL database before answering questions about its data or writing SQL. Use this skill whenever a user asks for a query or a data-backed answer against an unfamiliar schema (counts, missing or failed records, recent changes), asks where a business concept lives, or asks how tables, joins, views, routines, triggers, RLS, or extensions work. Find the relevant objects with read-only pg_catalog queries, then request approval before inspecting data-derived statistics or rows. Not a schema-design or migration guide.\n" setup-timescaledb-hypertables "Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table.\n\n**Trigger when user asks to:**\n- Create or design SQL schemas/tables AND Timescale/TimescaleDB/TigerData/Tiger Cloud is available\n- Set up hypertables, compression, retention policies, or continuous aggregates\n- Configure partition columns, segment_by, order_by, or chunk intervals\n- Optimize time-series database performance or storage\n- Create tables for sensors, metrics, telemetry, events, or transaction logs\n\n**Keywords:** CREATE TABLE, hypertable, Timescale, TimescaleDB, time-series, IoT, metrics, sensor data, compression policy, continuous aggregates, columnstore, retention policy, chunk interval, segment_by, order_by\n\nStep-by-step instructions for hypertable creation, column selection, compression policies, retention, continuous aggregates, and indexes.\n" timescaledb-hyperfunctions "Use this skill when writing analytical SQL over time-series data with the TimescaleDB Toolkit (timescaledb_toolkit extension) hyperfunctions: approximate percentiles, statistical summaries, time-weighted averages, counter/gauge rates, uptime/heartbeat tracking, state durations, OHLC candlesticks, approximate distinct counts, top-N, and downsampling.\n\n**Trigger when user asks to:**\n- Compute percentiles/medians/p95/p99 over large or rolled-up time-series data\n- Compute rates or deltas from monotonic counters (Prometheus-style) or gauges\n- Compute time-weighted averages or integrals over irregularly sampled data\n- Track uptime/downtime from heartbeats, or time spent in each state\n- Build OHLC/candlestick or VWAP data for financial ticks\n- Store re-aggregatable summaries in continuous aggregates (two-step aggregation, rollup)\n- Approximate COUNT DISTINCT, find top-N / most frequent values, or downsample for charts\n\n**Keywords:** timescaledb_toolkit, hyperfunctions, percentile_agg, uddsketch, tdigest, approx_percentile, stats_agg, time_weight, counter_agg, gauge_agg, heartbeat_agg, state_agg, candlestick_agg, hyperloglog, approx_count_distinct, min_n, max_n, mcv_agg, lttb, asap_smooth, rollup, two-step aggregation\n" </available_skills>
入力スキーマ
{
"type": "object",
"properties": {
"skill_name": {
"type": "string",
"description": "The name of the skill to browse, or `.` to list all available skills."
},
"path": {
"type": "string",
"description": "A relative path to a file or directory within the skill to view.\nIf empty, will view the `SKILL.md` file by default.\nUse `.` to list the root directory of the skill."
}
},
"required": [
"skill_name",
"path"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The content of the file or directory listing."
}
},
"required": [
"content"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}🟢get_context(id, url, part)
Opens any part of the docs (a section or a whole page) as markdown, with links to move around it. Use it on a search_docs hit before answering from it: a hit is one chunk, and often a fragment (a table row without the header that says which column is which plan, one step of a procedure). Pass the hit's chunk_id to get the whole section it is in. Every result is a node in the page's outline. parent_id goes one level up (to the enclosing section, then the page); children lists the sections one level down; previous_id / next_id move to the neighbouring sections. Pass any of those ids back in. It also takes a docs URL, e.g. a link in the text; a #fragment opens that section. Text over 20,000 characters (a whole Postgres reference page, a long page) comes back in parts: you get the part holding the chunk you passed, and part / part_count say which.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"description": "Any docs id: a chunk_id or section_id from search_docs, a page_id, or a parent_id / children id from an earlier get_context. A chunk_id returns the section the chunk is in. Give this or url.",
"type": [
"string",
"null"
]
},
"url": {
"description": "A docs URL (tigerdata.com/docs, postgresql.org/docs, postgis.net/docs), e.g. a link found in docs text. With a #fragment it returns that section, otherwise the page. Give this or id.",
"type": [
"string",
"null"
]
},
"part": {
"anyOf": [
{
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
},
{
"type": "null"
}
],
"description": "Which part of the text to return when part_count > 1. Defaults to the part holding the chunk you passed, else part 1."
}
},
"required": [
"id",
"url",
"part"
],
"$schema": "https://json-schema.org/draft/2020-12/schema"
}出力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "This node: a section_id, or the page_id."
},
"kind": {
"type": "string",
"enum": [
"page",
"section"
]
},
"title": {
"type": "string",
"description": "Page title."
},
"page_id": {
"type": "string"
},
"page_url": {
"type": "string"
},
"version": {
"description": "Docs version, for versioned sources (Postgres, PostGIS).",
"type": [
"string",
"null"
]
},
"headings": {
"type": "array",
"items": {
"type": "string"
},
"description": "Heading path of this node, outermost first. Empty for a page."
},
"url": {
"description": "Link to this node on the docs site.",
"type": [
"string",
"null"
]
},
"text": {
"type": "string",
"description": "The node as markdown with everything nested under it, led by its parent headings. When part_count > 1 this is one part."
},
"part": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Which part `text` is, from 1."
},
"part_count": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Above 1, call again with `part` for the rest."
},
"parent_id": {
"description": "The node one level up (the enclosing section, or the page). Null for a page.",
"type": [
"string",
"null"
]
},
"children": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"heading": {
"type": "string",
"description": "Its heading path below this node, e.g. \"4.1. Spatial Data Model > 4.1.1. OGC Geometry\" when the level between has no text of its own."
},
"characters": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Length of its text, including its own children."
}
},
"required": [
"id",
"heading",
"characters"
],
"additionalProperties": false
},
"description": "The sections one level down, in order. Their text is already in `text`; open one by id to read just that part."
},
"previous_id": {
"description": "The previous section at the same level, under the same parent.",
"type": [
"string",
"null"
]
},
"next_id": {
"description": "The next section at the same level, under the same parent.",
"type": [
"string",
"null"
]
}
},
"required": [
"id",
"kind",
"title",
"page_id",
"page_url",
"version",
"headings",
"url",
"text",
"part",
"part_count",
"parent_id",
"children",
"previous_id",
"next_id"
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false
}コミュニティ
エビデンス