VS Code / PostgreSQL / remote MCP

Connect VS Code to PostgreSQL.
Code with the real schema, safely.

Give the VS Code agent live PostgreSQL schema and approved query tools through a hosted MCP server. Keep production credentials out of mcp.json, scope access per project, and review PostgreSQL query activity.

Remote HTTP serverWorkspace-scoped setupNo local runtime
LIVE ROUTEACCESS POLICY / ENFORCED
SOURCEPostgreSQLschema discovered
GATEWAYdatamcpauth · policy · route
CLIENTVS Codehosted MCP link
REQUESTtools/call → productionPOLICY CHECKED
AUTHOAuth 2.0
ACCESSScoped
SECRETSEncrypted
ROUTEHosted

The production path

Production database context in VS Code

VS Code supports MCP servers for agent tools and context. DataMCP exposes your live PostgreSQL schema and approved query operations through a remote HTTP server the editor can use while planning changes, investigating data, or writing SQL.

The workspace configuration contains the MCP endpoint rather than the database connection string. Create a distinct link for each repository or environment, assign the minimum permissions it needs, and revoke access without rotating PostgreSQL credentials.

Follow the VS Code MCP setup guide for the gallery, Command Palette, .vscode/mcp.json, secure inputs, and troubleshooting. For the underlying tools and permission model, review the hosted PostgreSQL MCP server page.

What you get

Production access.
Without production guesswork.

01 / CAPABILITY
SC

Schema-aware coding

Give the VS Code agent current tables, columns, relationships, indexes, and descriptions instead of stale guesses.

02 / CAPABILITY
RE

Remote HTTP server

Connect with a hosted HTTPS endpoint supported by VS Code without installing or supervising a local runtime.

03 / CAPABILITY
PR

Project-level policy

Create a separate MCP link and permission scope for each repository, team, or environment.

04 / CAPABILITY
NO

No database secret in Git

Keep PostgreSQL credentials encrypted server-side and out of .vscode/mcp.json and repository history.

05 / CAPABILITY
IM

Immediate revocation

Disable one VS Code link without rotating the database credential used by other clients.

06 / CAPABILITY
PO

PostgreSQL query activity

Review PostgreSQL query execution details and permission denials produced through VS Code links.

Source to controlled MCP link

One. Two.
Three.

Connect the source once. DataMCP handles discovery, hosted transport, client authentication, and link policy.

Read the setup guide
  1. 01
    Connect PostgreSQL

    Add the database once and verify the schema and tools DataMCP discovers.

  2. 02
    Create a VS Code link

    Choose read-only or custom permissions and copy the remote MCP server details.

  3. 03
    Configure VS Code

    Add the HTTP server in workspace or user MCP settings, start it, and verify the database tools.

Build or use datamcp

Hosted VS Code MCP vs. a local PostgreSQL server

See what stays on your engineering backlog when the MCP runtime and control layer are managed for you.

CAPABILITYDATAMCPLocal PostgreSQL MCP
VS Code configRemote HTTP endpoint

Command, package, runtime, and arguments

Database secretEncrypted outside the repository

Local environment or config input

Project accessSeparate policy per link

Usually one PostgreSQL role

Team revocationDisable a link centrally

Remove config or rotate credentials

PostgreSQL query activityQueries and denied operations available for review

Build from editor and database logs

Frequently asked questions

Questions before
you connect.

Clear answers about architecture, access, credentials, and supported clients.

01

How does VS Code connect to PostgreSQL through MCP?

VS Code connects to a remote HTTP MCP endpoint configured as an MCP server. DataMCP publishes PostgreSQL schema and query tools through that endpoint, validates permissions, runs approved operations, and returns the results to the VS Code agent.

02

Where is the MCP server configured in VS Code?

Microsoft documents workspace MCP servers in .vscode/mcp.json and user-level servers in the VS Code profile. You can also use the MCP: Add Server command from the Command Palette.

03

Should I put a PostgreSQL password in mcp.json?

No. Microsoft recommends avoiding hardcoded secrets in MCP configuration. With DataMCP, mcp.json points to the hosted endpoint while the PostgreSQL connection string remains encrypted server-side.

04

Can the VS Code agent be restricted to read-only queries?

Yes. Create a read-only link for schema exploration and SELECT queries, or use custom table permissions when a project should access only part of the database.

05

Is Docker or a local Node.js process required?

No. VS Code supports remote HTTP MCP servers, so DataMCP operates the server and transport. The editor connects to the hosted HTTPS endpoint directly.

Start with one link

Give VS Code the schema, not the password

Connect one PostgreSQL database and create one project-scoped remote MCP link for free. No local server and no credit card.