Local Agent Tunnel / private PostgreSQL

Connect private PostgreSQL.
Keep inbound database access closed.

Run @datamcp/agent beside PostgreSQL on EC2, a VPS, or Docker. The agent connects outbound to datamcp, then your AI clients use a scoped hosted MCP link. The database password stays on the agent machine; SQL requests and results pass through datamcp cloud.

No public inbound PostgreSQL rulePassword stays on the agent machineNo separate tunnel fee
Outbound tunnelPostgreSQL only
PRIVATE SOURCEPostgreSQLNo public inbound access
YOUR MACHINE@datamcp/agentPassword stays here
HOSTED CONTROL PLANEdatamcp cloudSQL and results pass through
REMOTE CLIENTClaude / Cursor / CodexScoped HTTPS MCP link
Credential boundary: the database password stays beside PostgreSQL. Data boundary: SQL requests and results travel through datamcp cloud.

Direct answer

How do you connect private PostgreSQL to a hosted MCP server?

Create a Local Agent connection in datamcp, run @datamcp/agent on a machine with private PostgreSQL access, sync the schema, and create a scoped hosted MCP link. The agent initiates the network connection outbound.

Network
PostgreSQL can remain on a private address. The agent needs database reachability and outbound HTTPS to datamcp.
Credential
The PostgreSQL connection string and password remain on the agent machine, not in the remote AI client.
Data path
SQL queries and query results pass through the datamcp cloud. This is not an air-gapped or entirely local data path.
Permissions
Read-only or read-write requires agreement between the agent mode, MCP-link policy, datamcp user permissions, and PostgreSQL grants.
Deployment
Run the published npm package on EC2, a Linux VPS, or a Docker host near the database.
Billing
The agent uses a normal source slot and its hosted endpoint uses a normal MCP-link slot, with no additional tunnel price.

The production path

A private-network connector for the hosted gateway

Direct hosted PostgreSQL connections require datamcp cloud to reach the database. Local Agent Tunnel changes that network direction: @datamcp/agent runs inside the environment that already reaches PostgreSQL and establishes the connection outbound. You do not add a public PostgreSQL rule or expose port 5432 to datamcp.

This does not make the datamcp data plane local. The agent executes approved operations near the database, but the SQL request and returned rows travel through datamcp cloud to the hosted MCP client. Use it when keeping the database credential and inbound network path local solves your architecture requirement. Do not use it when query data is prohibited from traversing a hosted service.

For ordinary public or allowlisted PostgreSQL endpoints, use the standard hosted PostgreSQL connection. For the broader control-layer model, review the hosted MCP gateway.

What you get

Production access.
Without production guesswork.

01 / CAPABILITY
OU

Outbound connection

The agent initiates the tunnel to datamcp, so PostgreSQL does not need public inbound access.

02 / CAPABILITY
LO

Local database credential

Keep the PostgreSQL password in the agent environment instead of storing it in every AI client or the cloud connection.

03 / CAPABILITY
HO

Hosted remote MCP link

Use the same stable HTTPS MCP workflow in compatible remote clients after the agent comes online.

04 / CAPABILITY
LA

Layered write controls

Writes require the agent, MCP link, datamcp user, and PostgreSQL role to permit the operation.

05 / CAPABILITY
SC

Schema synchronization

Sync the PostgreSQL schema through the connected agent before creating and testing the MCP link.

06 / CAPABILITY
EX

Existing plan slots

Local Agent uses the normal source and MCP-link allowances. There is no tunnel add-on price.

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
    Create a Local Agent source

    In the datamcp dashboard, choose New Connection, then Local Agent. Save the generated connection ID and one-time agent token.

  2. 02
    Run @datamcp/agent beside PostgreSQL

    Install the npm package on EC2, a VPS, or Docker, provide the local PostgreSQL URL, and choose read-only or read-write mode.

  3. 03
    Sync schema and publish a link

    Wait for the agent to come online, sync the schema, create a scoped MCP link, and add that HTTPS endpoint to the AI client.

Build or use datamcp

Local Agent Tunnel vs. a direct hosted connection

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

CAPABILITYdatamcpDirect PostgreSQL connection
Database networkPrivate address reachable by the agent

Reachable from datamcp cloud

Inbound PostgreSQL accessNo public inbound rule required

Provider allowlist or public endpoint may be required

Database passwordStays on the agent machine

Stored encrypted in the datamcp connection

SQL and resultsPass through datamcp cloud

Pass through datamcp cloud

Supported sourcePostgreSQL

PostgreSQL or MySQL through their standard flows

MCP client setupHosted HTTPS MCP link

Hosted HTTPS MCP link

Frequently asked questions

Questions before
you connect.

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

01

What is the datamcp Local Agent Tunnel?

Local Agent Tunnel connects a private PostgreSQL database to the hosted datamcp service. You create a Local Agent connection, run @datamcp/agent on a machine that can reach PostgreSQL, sync the schema, and create a normal hosted MCP link for compatible AI clients.

02

Do I need to expose PostgreSQL to the internet?

No. The agent initiates the connection outbound to datamcp, so the database does not need a public IP or an inbound internet rule. The agent machine must be able to reach PostgreSQL and make outbound HTTPS connections.

03

Does my database data stay entirely inside my private network?

No. The PostgreSQL password stays on the agent machine, but SQL requests and query results pass through the datamcp cloud so the hosted MCP endpoint can serve the connected AI client.

04

Does Local Agent Tunnel support MySQL or OpenAPI?

No. The current tunnel supports PostgreSQL only. Use the standard hosted connection paths for MySQL and OpenAPI sources.

05

Can the Local Agent connection be read-only?

Yes. Run the agent in read-only mode and use a PostgreSQL role with SELECT-only grants. For a write to succeed, the agent mode, MCP-link policy, datamcp user permissions, and PostgreSQL role must all allow it.

06

Where can I run @datamcp/agent?

Run it on a machine that can reach the database, including an EC2 instance, Linux VPS, or Docker host. Private EC2 can connect outbound through a NAT gateway or approved proxy without a public IP.

07

Does the tunnel cost extra?

No. A Local Agent connection uses one normal source slot, and the MCP link it creates uses one normal MCP-link slot. Starter includes one source and one link, Pro includes three sources and five links, and Enterprise includes fifteen sources and fifty links.

Start with one link

Connect private PostgreSQL without public inbound access

Start a 14-day Starter or Pro trial after adding a payment method. Local Agent uses one normal source slot, and its MCP endpoint uses one normal link slot.