home / mcp / postgres scout mcp server
Provides read-only and optional read-write access to PostgreSQL databases with safety, logging, and rate limiting.
Configuration
View docs{
"mcpServers": {
"bluwork-postgres-scout-mcp": {
"command": "node",
"args": [
"/absolute/path/to/postgres-scout-mcp/dist/index.js",
"postgresql://localhost:5432/production"
],
"env": {
"LOG_DIR": "./logs",
"LOG_LEVEL": "info",
"DATABASE_URL": "postgresql://localhost:5432/production",
"PGIDLETIMEOUT": "10000",
"PGMAXPOOLSIZE": "10",
"PGMINPOOLSIZE": "2",
"QUERY_TIMEOUT": "30000",
"MAX_RESULT_ROWS": "10000",
"ENABLE_RATE_LIMIT": "true",
"RATE_LIMIT_WINDOW_MS": "60000",
"RATE_LIMIT_MAX_REQUESTS": "100"
}
}
}
}You are running a Postgres Scout MCP Server that safely exposes PostgreSQL interactions to AI assistants. It provides read-only exploration by default, strong SQL injection prevention through parameterized queries, rate limiting, and comprehensive logging to help you analyze and maintain databases without risking your data.
To use the MCP server with a compatible client, start in read-only mode to safely inspect your databases. You can switch to read-write mode when you explicitly need to perform data modifications.
Start in read-only mode with a direct connection string. You can later enable write operations by adding a flag to the startup command.
Prerequisites you need installed on your machine before running the MCP server:
Step-by-step setup:
# Install dependencies
pnpm install
# Build the MCP server
pnpm buildLaunch the server in read-only mode by providing a PostgreSQL connection URL. This mode is safe for production database exploration.
node dist/index.js postgresql://localhost:5432/mydbIf you need write access, start the server with the read-write flag. This mode requires explicit permission to modify data.
node dist/index.js --read-write postgresql://localhost:5432/mydbList all databases the user has access to.
Get comprehensive statistics about a database.
List all schemas in the connected database.
List tables with detailed information in a given schema.
Provide detailed information about a table, including columns, constraints, and indexes.
Execute a SELECT query with safety checks and optional timeout and row limit.
Analyze query performance with EXPLAIN ANALYZE, with read-only mode forcing analyze to false.
Calculate an overall health score for the connected database.
Analyze slow queries using pg_stat_statements (extension required).