Skip to content
Aurabase Logo
aurabase

Connect a Postgres MCP server to VS Code

Integrate your dedicated European PostgreSQL 18 backend with VS Code Copilot Agent Mode using .vscode/mcp.json: zero hardcoded secrets on disk, 82 of 86 tools with a project key, engine-enforced read-only mode (37 tools), and support for Cline/Roo Code.

How-to guide6 min readLevel beginner

Quick answer#

To connect a PostgreSQL MCP server in VS Code, create .vscode/mcp.json using @aurabase/mcp-server (aurabase-mcp) with a promptString password input so your service_role key is never saved in Git. VS Code Copilot Agent Mode gets 82 of 86 tools across PostgreSQL 18, RLS, Auth, Storage, Edge Functions, and ClickHouse logs — or 37 tools backed by PostgreSQL READ ONLY transactions when you pass --read-only.

Option 1: Safe .vscode/mcp.json (commit-safe)#

Because VS Code supports masked inputs natively, you can safely commit .vscode/mcp.json for your whole team without storing any live secret in the file:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "aurabase-url",
      "description": "Aurabase project URL (https://<slug>.aurabase.cloud)"
    },
    {
      "type": "promptString",
      "id": "aurabase-project-id",
      "description": "Aurabase project UUID"
    },
    {
      "type": "promptString",
      "id": "aurabase-service-role-key",
      "description": "Aurabase service role key (aura_sk_...)",
      "password": true
    }
  ],
  "servers": {
    "aurabase": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "-p", "@aurabase/mcp-server", "aurabase-mcp"],
      "env": {
        "AURABASE_URL": "${input:aurabase-url}",
        "AURABASE_PROJECT_ID": "${input:aurabase-project-id}",
        "AURABASE_SERVICE_ROLE_KEY": "${input:aurabase-service-role-key}"
      }
    }
  }
}

Open .vscode/mcp.json and click Start on the CodeLens banner above "aurabase". VS Code prompts once for the three values and keeps the key in memory.

Option 2: Local Streamable HTTP#

Start aurabase-mcp once over local Streamable HTTP (127.0.0.1:3001/mcp with anti-CSRF Origin validation and mandatory Bearer auth):

npx -y -p @aurabase/mcp-server aurabase-mcp \
  --transport http \
  --port 3001 \
  --auth-token "replace_with_32_char_secret" \
  --url "https://<slug>.aurabase.cloud" \
  --project-id "<project-uuid>" \
  --service-role-key "aura_sk_..."

Then configure .vscode/mcp.json as an HTTP server:

{
  "servers": {
    "aurabase": {
      "type": "http",
      "url": "http://127.0.0.1:3001/mcp",
      "headers": {
        "Authorization": "Bearer replace_with_32_char_secret"
      }
    }
  }
}

Option 3: Cline & Roo Code extensions#

Both Cline and Roo Code use the standard mcpServers format (cline_mcp_settings.json):

{
  "mcpServers": {
    "aurabase": {
      "command": "npx",
      "args": ["-y", "-p", "@aurabase/mcp-server", "aurabase-mcp"],
      "env": {
        "AURABASE_URL": "https://<slug>.aurabase.cloud",
        "AURABASE_PROJECT_ID": "<project-uuid>",
        "AURABASE_SERVICE_ROLE_KEY": "aura_sk_..."
      }
    }
  }
}

Production read-only & tool whitelists#

Add a second "aurabase-prod-ro" entry to .vscode/mcp.json with --read-only (37 tools backed by PostgreSQL READ ONLY transactions) or --allowed-tools to restrict agents to diagnostics only:

{
  "servers": {
    "aurabase-prod-ro": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "-p",
        "@aurabase/mcp-server",
        "aurabase-mcp",
        "--read-only",
        "--allowed-tools",
        "list_tables,describe_table,list_rls_policies,get_security_advisors,list_slow_queries,explain_query"
      ],
      "env": {
        "AURABASE_URL": "${input:aurabase-url}",
        "AURABASE_PROJECT_ID": "${input:aurabase-project-id}",
        "AURABASE_SERVICE_ROLE_KEY": "${input:aurabase-service-role-key}"
      }
    }
  }
}

Example prompts in Copilot Agent Mode#

Switch Copilot Chat to Agent mode, verify aurabase is checked in the Tools picker, and try:

  • "Run list_tables and get_security_advisors, then list every table missing Row-Level Security."
  • "Inspect orders with describe_table and generate matching TypeScript interfaces via generate_types."
  • "Check list_slow_queries and run explain_query on the slowest statement."

Troubleshooting#

  • Tools do not appear in Copilot Chat: make sure Copilot Chat is in Agent mode (not Ask or Edit) and VS Code is version 1.99+.
  • could not determine executable to run: ensure -p @aurabase/mcp-server aurabase-mcp is present in args.
  • Server stops with missing project error: AURABASE_PROJECT_ID is mandatory; re-enter the UUID via MCP: Reset Cached Inputs in the VS Code Command Palette.

To go further#

@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ Report a problem