Securely reach your database or private services by name from anywhere. Grant your AI read-only access for 5 minutes. Share your environment with a code. No VPN, no open ports. For humans and agents.
Your services are unreachable by default. No open ports, no public endpoints, nothing to discover. Connect by name, from anywhere, end-to-end encrypted.
# On the machine with the DB
connect expose localhost:5432 --name my-db
# From anywhere else
connect reach my-db
# → localhost:5432 now points at my-db. Same connection string, works everywhere.No port forwarding, no firewall rules. Works with Tailscale.
curl -fsSL https://privateconnect.co/install.sh | bash
connect upOr try without signup:
npx private-connect tunnel 3000Share your entire local environment with a teammate, no signup:
npx private-connect up 3000 5432 6379
# → npx private-connect join k7m2p9 (send this to your teammate)┌─────────────────┐ ┌───────┐ ┌─────────────────┐
│ Your Server │────────▶│ Hub │◀────────│ Your Laptop │
│ │ └───────┘ │ │
│ connect :5432 │ │ connect prod-db │
└─────────────────┘ └─────────────────┘
An agent runs on each machine. Expose services from one, reach them from another. All traffic is encrypted. Services are private to your workspace.
- Access by name —
connect prod-dbinstead of remembering IPs or ports - Stable ports — same service always gets the same local port across restarts
- Encrypted — end-to-end encrypted tunnels with audit logging
- Works everywhere — on top of Tailscale, VPN, or plain internet
# Share your environment
connect share
# → Share code: x7k9m2
# Teammate joins with one command
connect join x7k9m2
# → Same services, same ports. Done.# Authenticated (named services)
connect ssh shell
connect ssh root@shell
# Unauthenticated (share codes, no install)
npx private-connect ssh <code>
# Run a command and pipe to AI
connect ssh shell -- cat /etc/hostname | claudeGive someone shell access with just a share code, no CLI install needed on their side.
# On your machine
connect shell && connect share
# → Share code: x7k9m2They open privateconnect.co/terminal, enter the code, and get a live terminal.
Private Connect can expose private resources as named, ephemeral endpoints for humans and AI agents.
Define resources in pconnect.yml, connect instantly, get a usable endpoint:
# pconnect.yml
resources:
staging-db:
type: postgres
host: internal-db
port: 5432
access:
mode: tcpconnect resources # List all resources
connect resource staging-db # Get postgres://127.0.0.1:5432
connect resource staging-db --json # Stable JSON for AI agentsJSON output for agent workflows (Cursor, Claude Code, Codex):
{
"ok": true,
"session": {
"id": "sess_a1b2c3d4",
"resource": "staging-db",
"type": "postgres",
"endpoint": "postgres://127.0.0.1:5432",
"expiresAt": "2026-03-25T12:00:00.000Z",
"expiresInSeconds": 900
}
}See examples/pconnect-resources.yml and docs/detailed.md.
Grant an AI agent temporary, scoped access to a private resource. No credentials in prompts, no exposing services publicly.
connect grant claude --db postgres --ttl 5m
# → Token: gnt_...
# → Endpoint: https://api.privateconnect.co/grant/postgresThe AI can query the database over HTTP:
curl -X POST https://api.privateconnect.co/grant/postgres/query \
-H "Authorization: Bearer gnt_..." \
-d '{"sql": "SELECT count(*) FROM users"}'
# → {"rows": [{"count": 42}], "rowCount": 1}Read-only grants block mutations. Access expires automatically.
connect grant --list # Active grants
connect grant --revoke <id> # Revoke earlyOr manage grants programmatically with the SDK:
import { PrivateConnect } from '@privateconnect/sdk';
const pc = new PrivateConnect({ apiKey: process.env.PRIVATECONNECT_API_KEY });
const grant = await pc.grants.create({
agentLabel: 'claude',
resourceType: 'db',
resourceName: 'postgres',
ttl: '5m',
});
// grant.token → give this to the AI agentSee examples/ for LangChain and OpenAI integrations.
Every CLI command supports --json for machine-readable output, --help with copy-pasteable examples, and flags for everything (no interactive prompts required).
connect expose localhost:3000 --name api --json
# → {"serviceId":"...","name":"api","target":"localhost:3000","tunnelPort":...}
connect grant claude --db postgres --ttl 5m --json
# → {"id":"...","token":"gnt_...","endpoint":"..."}
connect delete my-service --dry-run
# → Would delete service "my-service" (ID: ...). No changes made.Expose a local service from GitHub Actions and post a preview URL on the PR:
- uses: treadiehq/private-connect/.github/actions/tunnel@main
with:
api-key: ${{ secrets.PRIVATE_CONNECT_KEY }}
port: 3000
ttl: 2h
comment-on-pr: 'true'See the example workflow for a full setup.
Run any dev server with a named HTTPS URL. No config, no auth required:
connect run api next dev
# → https://api.localhost:3000
connect run frontend vite
# → https://frontend.localhost:3000HTTPS with HTTP/2 is enabled by default. Test on real devices with LAN mode:
connect proxy start --lan
# → Phones and tablets on your Wi-Fi reach https://api.connect.local:3000The same services are instantly reachable from a teammate's machine via connect reach api.
git clone https://github.com/treadiehq/private-connect.git
cd private-connect && pnpm install
cd apps/agent && pnpm run build:binary