drio
Open app

MCP Postgres Query Server

Source

Catalog onlyCatalog onlySTDIO

Overview

MCP Postgres Query Server is a Model Context Protocol (MCP) server implementation that provides a secure, read-only interface for querying a PostgreSQL database, designed to work with Claude Desktop and other MCP clients.

To use the MCP Postgres Query Server, clone the repository, install the dependencies, build the project, and configure Claude Desktop to connect to the server using the provided PostgreSQL connection details.

  • Secure read-only access to a PostgreSQL database. - SQL query validation to ensure only SELECT queries are executed. - Query timeout protection (10 seconds). - Integration with Claude Desktop through the MCP protocol. - JSON response formatting for query results.
  1. Securely querying user data from a PostgreSQL database.
  2. Integrating with applications that require read-only access to database information.
  3. Validating SQL queries before execution to prevent harmful operations.

Add to your AI client

Use these steps to connect MCP Postgres Query Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "mcp-postgres-query-server-rathoddarshil": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-postgres-query-server-rathoddarshil"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "mcp-postgres-query-server-rathoddarshil": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-postgres-query-server-rathoddarshil"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "mcp-postgres-query-server-rathoddarshil": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-postgres-query-server-rathoddarshil"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "mcp-postgres-query-server-rathoddarshil": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-postgres-query-server-rathoddarshil"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-postgres-query-server-rathoddarshil": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-postgres-query-server-rathoddarshil"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "mcp-postgres-query-server-rathoddarshil": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-postgres-query-server-rathoddarshil"
      ]
    }
  }
}

FAQ

Can I execute write operations with this server?

No, the server only allows read-only SELECT queries for security reasons.

How do I configure Claude Desktop to connect to the MCP server?

You need to edit the `claude_desktop_config.json` file to add the MCP server details and restart Claude Desktop.

What happens if a query takes too long?

Queries that run longer than 10 seconds will be automatically terminated.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":2127,"uuid":"a29896b4-6f48-47d2-92ee-50807cf86cbd","name":"mcp-postgres-query-server","title":"MCP Postgres Query Server","description":"","avatar_url":"https://avatars.githubusercontent.com/u/69842641?v=4","created_at":"2025-03-09T03:40:41.368Z","updated_at":"2025-03-12T10:19:31.808Z","status":"created","author_name":"RathodDarshil","author_avatar_url":"https://avatars.githubusercontent.com/u/69842641?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/RathodDarshil/mcp-postgres-query-server","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"0\",\"license\":\"\",\"language\":\"TypeScript\",\"is_official\":false,\"latest_commit_time\":\"2025-03-08 23:25:07\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]