local_pgsql
About
localpgsql is a database analytics and query automation toolkit that provides structured data access for analysis, reporting, and AI-augmented workflows. It is designed for developers and data analysts who need to explore PostgreSQL databases, run parameterized SQL queries, and…
Details
- Author
- z-waterking
- Downloads
- 264
- Categories
- Other, Database
Jump to
- List all tables and get their schemas
- Preview table contents with data sampling
- Execute parameterized SQL queries
- Compute numerical summaries and correlation matrices
- Perform group-by aggregations with multiple functions
- Run temporal aggregation and anomaly detection
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
local_pgsqlCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Initialize the MCP with a database connection string, register tools and prompts using the provided API, then call any of the built-in tools or prompts by name. For example, register a DatabaseManager for a PostgreSQL URI and enable tools such as list_tables, run_query, or get_summary_statistics.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"local_pgsql": {
"github": {
"command": "docker",
"args": [
"build",
"-t",
"mcp-pgsql-python-service",
".",
"&&",
"docker",
"run",
"-p",
"8000:8000",
"-e",
"DB_HOST=${DB_HOST}",
"-e",
"DB_PORT=${DB_PORT:-5432}",
"-e",
"DB_NAME=${DB_NAME}",
"-e",
"DB_USER=${DB_USER}",
"-e",
"DB_PASSWORD=${DB_PASSWORD}",
"mcp-pgsql-python-service"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "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",
"DB_HOST": "postgres",
"DB_PORT": "5432",
"DB_NAME": "postgres",
"DB_USER": "postgres",
"DB_PASSWORD": "postgres"
}
}
}
}
}
McpServers
{
"github": {
"command": "docker",
"args": [
"build",
"-t",
"mcp-pgsql-python-service",
".",
"&&",
"docker",
"run",
"-p",
"8000:8000",
"-e",
"DB_HOST=${DB_HOST}",
"-e",
"DB_PORT=${DB_PORT:-5432}",
"-e",
"DB_NAME=${DB_NAME}",
"-e",
"DB_USER=${DB_USER}",
"-e",
"DB_PASSWORD=${DB_PASSWORD}",
"mcp-pgsql-python-service"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "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",
"DB_HOST": "postgres",
"DB_PORT": "5432",
"DB_NAME": "postgres",
"DB_USER": "postgres",
"DB_PASSWORD": "postgres"
}
}
}
MCP (Modular Control Platform)
Database Analytics & Query Automation ToolkitCore Features
Database Interaction Tools
- Schema Exploration - List all tables (list_tables)
- Get table schema (get_table_schema)
- Data Sampling
- Preview table contents (get_table_sample)
- Custom Query Execution
- Run parameterized SQL (run_query)
- Statistical Analysis
- Numerical summaries (get_summary_statistics: mean, std.dev, etc.)
- Correlation matrices (analyze_correlations)
- Group-by aggregations (group_by_analysis: multi-function support)
- Time Series Processing
- Temporal aggregation (time_series_analysis)
- Anomaly Detection
- Z-score/IQR based detection (detect_anomalies)
Built-in Prompts Library
- SQL Cheatsheet (basic_sql_guide)
- Analysis Task Templates (data_analysis_tasks)
Technical Architecture
- Modular Design: Dynamic tool registration via@mcp.tool decorator
- Type Safety: Strict input/output typing (e.g., List[Dict], Optional)
- Database Abstraction: DatabaseManager interface for backend-agnostic operations
Use Cases
1. Data Exploration: Rapid dataset understanding 2. Automated Reporting: Scheduled statistical summaries 3. Anomaly Monitoring: Real-time data quality checks 4. AI-Augmented Analysis: Structured data access for LLMsIntegration Example
```pythonInitialize MCP with database
mcp = MCP() db = DatabaseManager("postgresql://user:pass@localhost/db") register_tools(mcp, db) register_prompts(mcp)Tool usage examples
tables = mcp.call_tool("list_tables") stats = mcp.call_tool("get_summary_statistics", {"table_name": "sales"})Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





