Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev


FROM python:3.13-slim-bookworm
FROM python:3.12-slim-bookworm
# It is important to use the image that matches the builder, as the path to the
# Python executable must be the same, e.g., using `python:3.11-slim-bookworm`
# will fail.
Expand Down
5 changes: 4 additions & 1 deletion src/postgres_mcp/resources/database_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ async def get_database_schema() -> str: # pyright: ignore[reportUnusedFunction]
sql_driver: Any = await get_sql_driver_func()

# Query information_schema for tables
# Use pg_class directly to avoid ::regclass issues with views
tables_query = """
SELECT
t.table_schema,
t.table_name,
t.table_type,
obj_description((t.table_schema||'.'||t.table_name)::regclass) as table_comment
obj_description(c.oid, 'pg_class') as table_comment
FROM information_schema.tables t
LEFT JOIN pg_namespace n ON n.nspname = t.table_schema
LEFT JOIN pg_class c ON c.relnamespace = n.oid AND c.relname = t.table_name
WHERE t.table_schema NOT IN ('pg_catalog', 'information_schema')
ORDER BY t.table_schema, t.table_name
"""
Expand Down
3 changes: 3 additions & 0 deletions src/postgres_mcp/sql/safe_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ class SafeSqlDriver(SqlDriver):
"unicode_version",
"icu_unicode_version",
# Database object information functions
"obj_description",
"col_description",
"shobj_description",
"pg_column_size",
"pg_column_compression",
"pg_column_toast_chunk_id",
Expand Down
Loading