← Back to search

PostgreSQL MCP Server

musaddiq-dev Scanned 3d ago

Python MCP server for PostgreSQL database inspection and querying

B
76.4 / 100

Versions

0.1.1latest
first seen Jun 5, 2026
PermissionsTool SafetyAuthAnnotationsCode QualityStabilitySpecVuln HistoryAuthorTransparencyCommunity

Tools 10

list_tables
annotations: none low

Returns a list of all table names in the public schema. Filters out system tables and returns only user-created tables. Returns: List[str]: List of table names in the public schema

describe_table
annotations: none low

Queries information_schema.columns to return column details for a table. Args: table_name (str): The name of the table to describe Returns: List[Dict[str, Any]]: List of column dictionaries with name, type, and nullability

table_name string
execute_read_query
annotations: none low

Executes read-only SQL queries (SELECT, etc). Safe to auto-approve. Uses READ ONLY transaction mode to ensure no data modification can occur. Automatically rolls back any transaction to prevent accidental commits. Args: query (str): The SQL query to execute Returns: List[Dict[str, Any]]: Query results as a list of dictionaries, or a string with error hints Raises: ValueError: If query attempts to modify data

query string
execute_write_query
annotations: none low

Executes data modification queries (INSERT, UPDATE, DELETE, DROP). Requires manual approval. Executes the query and explicitly commits the transaction. This tool should be used for any SQL statements that modify data or database structure. Args: query (str): The SQL query to execute Returns: str: A success message with the number of rows affected (if applicable)

query string
explain_query
annotations: none low

Prepends EXPLAIN to the query to return the execution plan without running it. Args: query (str): The SQL query to explain Returns: List[Dict[str, Any]]: The EXPLAIN plan results

query string
get_database_summary
annotations: none low

Returns a comprehensive summary of the database. Returns: Dict[str, Any]: Dictionary containing database name, PostgreSQL version, and table count

get_relationships
annotations: none low

Queries information_schema to find Foreign Keys pointing TO and FROM this table. Args: table_name (str): The name of the table to analyze for relationships Returns: List[Dict[str, Any]]: List of foreign key relationships including: - relationship_type: 'incoming' or 'outgoing' - foreign_table_name: The other table involved in the relationship - constraint_name: Name of the foreign key constraint - column_name: The column in this table - foreign_column_name: The column in the referenced table

table_name string
analyze_indexes
annotations: none low

Returns all indexes, their columns, and sizes for the specified table. Uses pg_size_pretty to display human-readable sizes. Args: table_name (str): The name of the table to analyze indexes for Returns: List[Dict[str, Any]]: List of indexes with: - index_name: Name of the index - columns: List of column names in the index - is_unique: Whether the index enforces uniqueness - is_primary: Whether this is a primary key index - index_type: Type of index (btree, hash, etc.) - size: Human-readable size of the index

table_name string
preview_table
annotations: none low

Returns the first 10 rows of a table (LIMIT 10). Useful for quickly inspecting table data without running full queries. Args: table_name (str): The name of the table to preview Returns: List[Dict[str, Any]]: List of up to 10 rows as dictionaries

table_name string
search_sql_definitions
annotations: none low

Searches information_schema.routines or pg_proc for code containing the search_term. Finds functions, procedures, and other database objects that contain the search term in their definitions or bodies. Args: search_term (str): The term to search for in SQL definitions Returns: List[Dict[str, Any]]: List of matching routines with: - routine_name: Name of the function/procedure - routine_type: Type of routine (FUNCTION, PROCEDURE, etc.) - schema_name: Schema containing the routine - definition: The routine definition (truncated if too long)

search_term string

Permissions 2

filesystem low
Server uses filesystem capabilities via: os
env_vars low
Server uses env_vars capabilities via: os.getenv()

Scan Findings 39

low
Tool 'list_tables' has no annotations annotation_checker · 100%
low
Tool 'describe_table' has no annotations annotation_checker · 100%
low
Tool 'execute_read_query' has no annotations annotation_checker · 100%
low
Tool 'execute_write_query' has no annotations annotation_checker · 100%
low
Tool 'explain_query' has no annotations annotation_checker · 100%
low
Tool 'get_database_summary' has no annotations annotation_checker · 100%
low
Tool 'get_relationships' has no annotations annotation_checker · 100%
low
Tool 'analyze_indexes' has no annotations annotation_checker · 100%
low
Tool 'preview_table' has no annotations annotation_checker · 100%
low
Tool 'search_sql_definitions' has no annotations annotation_checker · 100%
info
Sandbox failed to start for behavioral verification behavioral_verifier · 100%
medium
Vulnerable dependency: pydantic@2.0.0 (GHSA-mr82-8j83-vxmv) dependency_analyzer · 95%
medium
Vulnerable dependency: pydantic@2.0.0 (PYSEC-2026-1812) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (GHSA-84m7-p3x7-pcfv) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (GHSA-9h52-p55h-vw2f) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (GHSA-jpw9-pfvf-9f58) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (GHSA-vj7q-gjh5-988w) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (PYSEC-2026-1617) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (PYSEC-2026-3482) dependency_analyzer · 95%
medium
Vulnerable dependency: mcp@1.11.0 (PYSEC-2026-3483) dependency_analyzer · 95%
medium
Vulnerable dependency: python-dotenv@1.0.0 (GHSA-mf9w-mj56-hr94) dependency_analyzer · 95%
medium
Vulnerable dependency: python-dotenv@1.0.0 (PYSEC-2026-2270) dependency_analyzer · 95%
info
pyproject.toml metadata manifest_parser · 100%
info
Tool: list_tables manifest_parser · 90%
info
Tool: describe_table manifest_parser · 90%
info
Tool: execute_read_query manifest_parser · 90%
info
Tool: execute_write_query manifest_parser · 90%
info
Tool: explain_query manifest_parser · 90%
info
Tool: get_database_summary manifest_parser · 90%
info
Tool: get_relationships manifest_parser · 90%
info
Tool: analyze_indexes manifest_parser · 90%
info
Tool: preview_table manifest_parser · 90%
info
Tool: search_sql_definitions manifest_parser · 90%
info
Required env vars (7) manifest_parser · 80%
info
Sandbox failed to start for output poisoning scan output_poisoning · 100%
low
Permission: filesystem access detected permission_analyzer · 70%
low
Permission: env_vars access detected permission_analyzer · 90%
info
SBOM generated: 5 components sbom_generator · 100%
medium
No build provenance detected (SLSA L0) slsa_assessor · 90%