- Home
- MCP servers
- PostgreSQL
PostgreSQL
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"psreekrishnan-postgresql-mcp": {
"command": "C:\\\\Users\\\\sk\\\\AppData\\\\Local\\\\Programs\\\\Python\\\\Python313\\\\python.exe",
"args": [
"C:\\\\Workspace\\\\GitLab\\\\capacity-planning2\\\\postgresql-mcp\\\\server.py",
"--host",
"host.example.com",
"--port",
"61025",
"--database",
"example",
"--username",
"example_user",
"--password",
"example_pwd"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}You can connect to a PostgreSQL database through an MCP server that exposes a read-only, query-enabled interface to an Amazon Q client. This MCP server runs locally or remotely, executes approved SELECT queries, and returns results in a controlled, secure way. It is designed to be easy to install, test, and configure so you can start querying data immediately from your MCP-enabled workflows.
How to use
You interact with the PostgreSQL MCP Server through an MCP client. First you install the server dependencies, then register a local or remote MCP entry that points to the server, and finally you run queries from your MCP client. The server is configured to allow read-only access with automatic limits and a connection timeout to protect your data.
How to install
pip install -r requirements.txt
python server.py --host host.example.com --port 61025 --database example --username example_user --password example_pwd --test
# Configure Amazon Q MCP (Windows path example)
C:\Users\%USERNAME%\.aws\amazonq\mcp.json
{
"mcpServers": {
"local-postgres-mcp": {
"command": "C:\\Users\\sk\\AppData\\Local\\Programs\\Python\\Python313\\python.exe",
"args": [
"C:\\Workspace\\GitLab\\capacity-planning2\\postgresql-mcp\\server.py",
"--host", "host.example.com",
"--port", "61025",
"--database", "example",
"--username", "example_user",
"--password", "example_pwd"
],
"env": {"PYTHONUNBUFFERED": "1"},
"timeout": 60000
}
}
}
# Restart your IDE to load the new MCP server configuration
Security and usage notes
The server enforces read-only access, allowing only SELECT queries. It automatically limits result sets (e.g., 100 rows max) to prevent large data transfers, and it enforces a connection timeout to protect resources.
Available tools
query_database
Execute SELECT queries with an automatic LIMIT to protect data exposure.
describe_table
Fetch detailed information about table columns and data types.
list_tables
List tables within a specific schema or across all schemas.