PostgreSQL MCP Server
Provides tools for inspecting and querying a PostgreSQL database, including listing tables, retrieving schema, and executing read-only SQL queries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PostgreSQL MCP Servershow me the users table schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PostgreSQL MCP Server
A generic Model Context Protocol (MCP) server for PostgreSQL, allowing AI agents to inspect and query PostgreSQL databases safely.
Features
list_tables: List all tables in thepublicschema.get_schema: Get the schema (columns, types, nullability) of a specific table.run_query: Run a read-only SQL query (onlySELECT/WITHallowed) with a maximum limit of 100 rows to avoid large responses.
Related MCP server: PostgreSQL MCP Server
Prerequisites
Python 3.13+
PostgreSQL database
Installation
You can run this directly using uvx or uv run if you clone the repository.
Usage
This server requires the DATABASE_URL environment variable to be set.
Example connection string:
postgres://user:password@localhost:5432/mydatabase
Running directly
DATABASE_URL="postgresql://postgres:poggerpogger@localhost:5432/boxboxWeb" uv run main.pyUsage with Claude Desktop / MCP Clients
Add the following to your MCP client configuration (e.g., Claude Desktop's claude_desktop_config.json):
{
"mcpServers": {
"postgres": {
"command": "uv",
"args": [
"run",
"/path/to/2025postgresqlmcp/main.py"
],
"env": {
"DATABASE_URL": "postgres://user:password@localhost:5432/mydatabase"
}
}
}
}Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/KannaKim/PostgresqlMCPServer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server