VS Code / PostgreSQL / remote MCP

Live PostgreSQL context.
Inside VS Code.

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
orders-api — Visual Studio Code— □ ×
{ } mcp.json ×
1 {
2 "servers": {
3 "datamcp": {
4 "type": "http",
5 "url": "https://api.datamcp.app/..."
6 }
7 }
8 }
CHAT⋯

Find why yesterday's paid orders are lower. Do not modify anything.

dm datamcpquery_orders · read only✓ 48 rows

The decrease comes from 17 payments still marked processing. All were created after the provider incident at 18:42 UTC.

⎇ main$(database) datamcpMCP: 1 running

What the editor actually gets

VS Code gets live context.
Git stays free of database secrets.

The workspace points to one remote HTTP MCP server. datamcp keeps the source credential behind the gateway and exposes only the tools allowed for that repository.

  1. 01Connect PostgreSQL

    datamcp discovers the live schema and publishes the available database tools.

  2. 02Create a workspace link

    Give this repository only the source and operations it actually needs.

  3. 03Configure VS Code

    Add the remote server from the Command Palette or `.vscode/mcp.json`.

  4. 04Use the agent

    Investigate data and write schema-aware code without committing a database password.

VS Code agent→.vscode/mcp.json→scoped datamcp link→PostgreSQL

Work with the real system

Ask from the repository.
Verify against live context.

The agent can inspect only the tools and data exposed by the MCP link assigned to this project.

Explain why yesterday's paid orders are lower.
datamcpquery_ordersRead only · 48 rows

The agent traces the drop to records created after the provider incident.

Update this query to match the live schema.
datamcpinspect_schemaRead only · schema

VS Code sees current tables, relationships, and indexes instead of guessing from stale code.

Review this migration against production constraints.
datamcpinspect_constraintsRead only · metadata

The agent checks the real constraint names before proposing a safe migration.

Set up VS Code

A remote server, scoped to the workspace.

Keep repository configuration portable while the PostgreSQL credential remains outside Git and outside the editor settings.

Open the complete setup guide →
  1. 1
    Add the PostgreSQL source

    Use a dedicated role and verify the discovered schema in datamcp.

  2. 2
    Create the VS Code MCP link

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

  3. 3
    Add the remote server

    Use MCP: Add Server or save the HTTP server in `.vscode/mcp.json`.

  4. 4
    Verify tools and denials

    Start the server, run one approved query, and test a blocked operation.

Project context, not blanket access

The agent sees enough to help.
The policy stays in control.

The editor configuration points to an MCP endpoint. It does not need the PostgreSQL password to discover the schema or run approved tools.

VS Code can receive

Approved tools and results

  • Current schema details exposed by the link
  • Approved query results and database metadata
  • Only tools assigned to this repository
VS Code does not receive

The source credential

  • The PostgreSQL password and connection string
  • Other sources in the datamcp workspace
  • Operations outside the link and database-role policy
TransportRemote HTTP MCP
ConfigurationWorkspace or profile
CredentialOutside the repository
ActivityPostgreSQL query history

Hosted or local

Choose the runtime
you want to operate.

VS Code supports both remote HTTP and local MCP servers. The decision is whether your team wants to run the connection layer itself.

Use local MCP when

The runtime belongs on this machine.

  • Only one local editor needs the connection
  • The team is comfortable maintaining the package
  • Database reachability already exists locally
  • Central sharing and revocation are unnecessary

Before you connect

Practical questions.
Direct answers.

Configuration, credentials, permissions, hosting, and the limits that matter in a real project.

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 MCP link free forever. Upgrade only when you need more sources or links.