Complete reference for all features and commands.
- Installation
- Authentication
- Core Commands
- Share & Collaborate
- CLI Reference
- Live Debugging
- Advanced Features
- Agent Orchestration
- Development
- Monitoring
- Control API
- Security
curl -fsSL https://privateconnect.co/install.sh | bashgit clone https://github.com/treadiehq/private-connect.git && cd private-connect
pnpm install
./scripts/start.sh devcd apps/agent
pnpm run build:binary
./scripts/install.shconnect upOpens browser for login. On headless servers, shows a code to enter from any device.
connect up --api-key pc_xxx --label prod-serverOr via environment:
PRIVATECONNECT_TOKEN=pc_xxx connect up --label prod-serverRun on the machine with the service:
connect localhost:5432 # Auto-named "postgres"
connect localhost:6379 # Auto-named "redis"
connect db.internal:5432 # Auto-named from portWith explicit naming:
connect expose localhost:5432 --name prod-db
connect expose 192.168.1.50:8080 --name internal-apiRun on your laptop:
connect prod-db # Creates tunnel to localhost:5432
connect postgres # Works with auto-named services too
connect reach prod-db --port 5433 # Use different local portOutput:
🔍 Reaching "prod-db"...
✓ REACHABLE
┌─────────────────────────────────────────┐
│ DNS ✓ OK │
│ TCP ✓ OK │
│ TLS ✓ OK │
│ HTTP ✓ 200 OK │
│ Latency 45ms │
└─────────────────────────────────────────┘
✓ Connected to prod-db on localhost:5432
npx private-connect test vault.internal:8200Checks TCP, TLS, HTTP, latency. No signup required.
npx private-connect tunnel 3000Creates a temporary public tunnel (2hr expiry). Works whether you're logged in or not. The public URL shows your actual website - perfect for demos and testing.
Note: Temporary tunnels are separate from authenticated tunnels. Use npx private-connect tunnel for quick, unauthenticated tunnels, or connect expose --public for persistent, authenticated public URLs.
connect localhost:5432 --share --ttl=1hOutput:
Secure link created:
https://abc123xyz.privateconnect.co
Expires in 1 hour
# You
connect share
# → Share code: x7k9m2
# Teammate
connect join x7k9m2
# → Same services, same portsconnect clone --list # See available teammates
connect clone alice # Clone their environment
# → ✓ Cloned 4 service(s) from alice
# → Generated: .env.pconnectconnect link api --expires 7d --methods GET
# → https://abc123xyz.privateconnect.coWith restrictions:
connect link api --paths /api/v1,/health --rate-limit 60# Delete with confirmation
connect delete my-old-service
# Delete without confirmation
connect delete my-old-service --forceconnect <target> # Expose if local, reach if service name
connect up # Authenticate
connect expose <host:port> # Expose a service
connect reach <service> # Access a service
connect share # Share environment with teammates
connect join <code> # Join shared environment
connect clone <teammate> # Clone teammate's environment
connect link <service> # Create public URL
connect delete <service> # Delete a service
connect proxy # Subdomain proxy (my-api.localhost:3000)
connect daemon <action> # Background daemon (install|status|logs)
connect dev # Project dev mode (pconnect.yml)
connect serve # Expose all services from pconnect.yml
connect dns <action> # Local DNS (*.connect domains)
connect mcp <action> # AI assistant integration
connect broker <action> # Agent Permission Broker
connect status # Quick status check (hub, agent, daemon)
connect doctor # Full diagnostics
connect cleanup # Clean orphaned processes
connect whoami # Show agent info
connect update # Update CLI
connect logout # Clear credentials# Global
-h, --hub <url> Hub URL
-c, --config <path> Config file
# connect up
-k, --api-key <key> API key (skips browser)
-l, --label <label> Environment label
-n, --name <name> Agent name
# connect expose / connect <target>
-n, --name <name> Service name
-p, --protocol <type> auto|tcp|http|https
--public Get public URL
-s, --share Create share link
--ttl <duration> Share TTL: 30m, 1h, 24h, 7d
# connect reach
-p, --port <port> Local port
-t, --timeout <ms> Timeout
--check Only diagnostics
--json JSON output
# connect link
-e, --expires <time> 1h, 24h, 7d, 30d, never
-m, --methods <list> GET,POST,PUT,DELETE
-p, --paths <list> /api,/health
-r, --rate-limit <n> Requests per minute
# connect delete
-f, --force Skip confirmation prompt
# connect daemon
-r, --replace Replace existing
# connect status
--json JSON output
# connect doctor
--fix Auto-fix issuesReal-time traffic inspection and AI-powered debugging for your services.
# Expose a service with debug mode enabled
connect expose localhost:3000 --debug
# Output:
# ✓ Service exposed: my-api
# ✓ Debug session active
#
# Debug viewer: https://app.privateconnect.co/debug/abc123
# Share this link with teammates for live pair-debuggingThe debug viewer shows real-time traffic flowing through your service:
- Live Traffic Stream - See requests/responses as they happen
- Protocol Detection - Automatically identifies HTTP, GraphQL, gRPC, PostgreSQL, Redis, MySQL
- Status Codes - Color-coded status (green for 2xx, yellow for 4xx, red for 5xx)
- Timing - Response times for each request
- Payload Inspection - Expand any request to see full headers and body
- Request Replay - Re-send captured requests for testing
Filter traffic by protocol, direction, or search:
Protocol: All | HTTP | GraphQL | gRPC | PostgreSQL | Redis | MySQL
Direction: All | Inbound | Outbound
Search: [search term]
Get AI-powered analysis of your traffic:
# Enable AI analysis in debug sessions
connect expose localhost:3000 --debug --aiFeatures:
- Ask questions - "Why is this request failing?" or "Explain this error"
- Auto-analyze errors - Automatically surfaces issues when 4xx/5xx responses occur
- Pattern detection - Identifies slow queries, N+1 problems, auth issues
Configure AI in the web UI under Settings → AI Copilot. Supports:
- Ollama (local, privacy-first)
- OpenAI (GPT-5.2, GPT-4.5, GPT-4o)
- Anthropic (Claude Opus 4.5, Sonnet 4)
Debug sessions are shareable - perfect for pair-debugging:
# The debug URL is shareable by default
# https://app.privateconnect.co/debug/abc123
# Viewers see:
# - Live traffic stream
# - Who else is viewing (presence indicators)
# - Full inspection capabilitiesExport debug sessions for later analysis or sharing:
- JSON - Full packet data for programmatic analysis
- Markdown - Human-readable recap with summary statistics
connect expose <target> [options]
# Debug options
--debug Enable debug session with live traffic viewer
--ai Enable AI copilot for the debug sessionSee docs/debugging.md for complete documentation.
connect daemon install # Install and start
connect daemon status # Check status
connect daemon logs # View logs
connect daemon uninstall # RemoveCreate pconnect.yml:
services:
- name: staging-db
port: 5432
- name: redis
port: 6379Then:
connect dev --init # Create config
connect dev # Connect all servicesAdd an expose block to your pconnect.yml to expose multiple local services with one command:
# pconnect.yml
services:
- name: staging-db
port: 5432
expose:
web:
target: localhost:3000
public: true
api:
target: localhost:8000
webhooks:
target: localhost:3000
public: trueThen:
connect serve # Expose all entries under expose:Each entry becomes a named service in the hub. Set public: true to get a public URL (for webhooks and demos). Teammates can connect reach web or connect reach api to access your services.
See docs/config-driven-expose-webhooks-demos.md for the full guide.
Access reached services via .localhost subdomains instead of remembering port numbers:
# Start the local proxy (runs as background daemon)
connect proxy start
# Reach a service (auto-starts the proxy if needed)
connect reach my-api
# → TCP: localhost:8080
# → HTTP: http://my-api.localhost:3000
# (proxy auto-started on port 3000)
# Access in browser or curl
curl http://my-api.localhost:3000/health
# Check proxy status
connect proxy status
# Stop it when done
connect proxy stopWith HTTPS (auto-generates and trusts local CA certificates):
connect proxy start --https
# → https://my-api.localhost:3000
# Trust the CA separately
connect proxy trust
# Use your own certs
connect proxy start --https --cert ./cert.pem --key ./key.pem
# Run in foreground (for debugging)
connect proxy start --foregroundCertificates auto-renew when expiring within 30 days.
Set CONNECT=0 or CONNECT=skip to bypass Private Connect entirely (useful for CI):
CONNECT=0 pnpm dev # runs directly, no tunnelingconnect dns install # Requires sudo
psql -h prod-db.connect
curl http://api.connect/health# Add to ~/.zshrc
eval "$(connect shell-init)"Features:
- Prompt shows connected services:
~/myapp (3 services) $ - Auto-connects in directories with
pconnect.yml
# Terminal 1
connect up --label agent-1 --config ~/.connect/agent1.json
connect expose localhost:8080 --name api --config ~/.connect/agent1.json
# Terminal 2
connect up --label agent-2 --config ~/.connect/agent2.json
connect reach api --config ~/.connect/agent2.jsonconnect mcp setupWorks with Cursor, Claude Desktop. AI can:
- List and connect to services
- Run health checks
- Help debug connectivity
Control what AI can do in your workspace:
connect broker init # Create policy.yml
connect broker run -- opencode
connect audit # View action logSee docs/broker.md.
For distributed AI coding agents.
npm install @privateconnect/sdkimport { PrivateConnect } from '@privateconnect/sdk';
const pc = new PrivateConnect({ apiKey: process.env.PRIVATECONNECT_API_KEY });
// Connect to a service
const db = await pc.connect('postgres-prod');
console.log(db.connectionString); // postgres://localhost:5432/...
// Find agents by capability
const gpuAgents = await pc.agents.findByCapability('gpu');
// Send message to agent
await pc.agents.sendMessage(gpuAgents[0].id, { action: 'train' });
// Get messages
const messages = await pc.agents.getMessages({ unreadOnly: true });When connected via MCP, agents can use:
list_agents— See all agentsfind_agents_by_capability— Discoverysend_agent_message— Coordinationget_connection_string— DATABASE_URL, REDIS_URL, etc.register_capabilities— Advertise capabilities
See packages/sdk for full SDK docs.
./scripts/start.sh dev # Start API + Web + Demo
./scripts/stop.sh # Stop all
./scripts/status.sh # Show statusPostgreSQL required. Docker handles this:
docker compose up -d postgres
cp apps/api/.env.example apps/api/.env
cd apps/api && pnpm db:pushOpen http://localhost:3000:
- View services and status
- Diagnostic history
- Manage API keys
curl https://api.privateconnect.co/healthReturns { "status": "ok", "database": "connected" }.
curl https://api.privateconnect.co/v1/statusReturns connected agents, active services, and runtime metrics:
{
"status": "ok",
"uptime": 3600,
"database": "connected",
"hub": {
"connectedAgents": 5,
"activeServices": 12,
"activeBridges": 3
}
}connect status # Quick overview
connect status --json # Machine-readablePrivate Connect exposes a full REST API for programmatic control of tunnels, agents, and workspace resources.
Interactive API documentation is available at:
- Swagger UI:
https://api.privateconnect.co/docs - OpenAPI Spec:
https://api.privateconnect.co/openapi.json
All API endpoints require authentication via API key:
curl -H "x-api-key: pc_your_api_key" https://api.privateconnect.co/v1/tunnelsOr via Bearer token (for session-based auth):
curl -H "Authorization: Bearer <session_token>" https://api.privateconnect.co/v1/tunnels| Endpoint Type | Limit |
|---|---|
| Public (auth, shares) | 100 requests/minute |
| Authenticated | 1000 requests/minute |
Manage tunnels as first-class resources.
# List all tunnels
GET /v1/tunnels
# Get tunnel details
GET /v1/tunnels/:id
# Create tunnel
POST /v1/tunnels
{
"name": "prod-db",
"targetHost": "localhost",
"targetPort": 5432,
"protocol": "tcp",
"agentId": "agent-uuid"
}
# Update tunnel
PATCH /v1/tunnels/:id
{
"name": "prod-db-renamed"
}
# Delete tunnel
DELETE /v1/tunnels/:id
# Create share for tunnel
POST /v1/tunnels/:id/share
{
"ttl": "24h",
"allowedMethods": ["GET", "POST"]
}Share multiple local services at once with a short join code.
# Create a bundle (no auth required)
POST /v1/tunnels/temporary/bundle
{
"ports": [3000, 5432, 6379],
"ttlMinutes": 120
}
# Response:
{
"code": "k7m2p9",
"tcpHost": "api.privateconnect.co",
"wsUrl": "wss://api.privateconnect.co/temp-tunnel",
"ttlMinutes": 120,
"expiresAt": "2026-02-24T23:00:00.000Z",
"tunnels": [
{ "tunnelId": "abc123", "localPort": 3000, "tcpPort": 40001 },
{ "tunnelId": "def456", "localPort": 5432, "tcpPort": 40002 },
{ "tunnelId": "ghi789", "localPort": 6379, "tcpPort": 40003 }
]
}
# Get bundle info by join code (no auth required)
GET /v1/tunnels/temporary/bundle/:code
# Response:
{
"code": "k7m2p9",
"tcpHost": "api.privateconnect.co",
"expiresAt": "2026-02-24T23:00:00.000Z",
"tunnels": [
{ "localPort": 3000, "tcpPort": 40001, "connected": true },
{ "localPort": 5432, "tcpPort": 40002, "connected": true },
{ "localPort": 6379, "tcpPort": 40003, "connected": true }
]
}Limits:
- Maximum 10 ports per bundle
- Auto-expires in 2 hours (max)
- No authentication required
Query audit logs and activity statistics.
# Get audit events
GET /v1/audit?limit=100&type=agent&since=2024-01-01
# Get audit statistics (30-day summary)
GET /v1/audit/stats
# Get events for specific agent
GET /v1/audit/agents/:id
# Get events for specific tunnel/service
GET /v1/audit/tunnels/:idResponse includes events from:
- Agent activity (connections, heartbeats, token usage)
- Share access (who accessed shared links)
- Sessions (reach connections between agents)
- Diagnostics (health checks)
Subscribe to events for automation and integrations.
# List webhooks
GET /v1/webhooks
# Create webhook
POST /v1/webhooks
{
"url": "https://your-server.com/webhook",
"events": ["tunnel.created", "tunnel.deleted", "agent.connected"],
"description": "Slack notifications"
}
# Update webhook
PATCH /v1/webhooks/:id
{
"events": ["tunnel.created"]
}
# Delete webhook
DELETE /v1/webhooks/:id
# Rotate webhook secret
POST /v1/webhooks/:id/rotate-secret
# Test webhook
POST /v1/webhooks/:id/test
# List available events
GET /v1/webhooks/eventsAvailable Events:
tunnel.created,tunnel.updated,tunnel.deletedshare.created,share.accessed,share.revokedagent.connected,agent.disconnected
Webhook Payload:
{
"event": "tunnel.created",
"timestamp": "2024-01-15T10:30:00Z",
"workspaceId": "ws_xxx",
"data": {
"tunnelId": "tun_xxx",
"name": "prod-db"
}
}Signature Verification:
Webhooks include an HMAC signature in the x-webhook-signature header:
const crypto = require('crypto');
const signature = crypto
.createHmac('sha256', webhookSecret)
.update(JSON.stringify(payload))
.digest('hex');
if (signature === req.headers['x-webhook-signature']) {
// Valid webhook
}Embed access buttons and status badges in your documentation or internal tools.
# Get embeddable JavaScript widget
GET /v1/widgets/:shareToken/embed.js
# Get HTML button
GET /v1/widgets/:shareToken/button
# Get widget configuration
GET /v1/widgets/:shareToken/config
# Get status badge (SVG)
GET /v1/widgets/:shareToken/badgeEmbed Example:
<script src="https://api.privateconnect.co/v1/widgets/abc123/embed.js"></script>Programmatically create short-lived agent tokens for AI tool runtimes (Cursor, Claude Code, GitHub Actions, etc.) without the device authorization flow.
POST /v1/agents/provision
x-api-key: pc_your_api_key
{
"clientType": "cursor",
"label": "staging",
"name": "cursor-agent-1",
"ttlSeconds": 7200
}Response:
{
"agentId": "550e8400-e29b-41d4-a716-446655440000",
"token": "a1b2c3d4...",
"expiresAt": "2026-02-24T18:00:00.000Z",
"workspaceId": "ws-uuid",
"workspaceName": "my-workspace"
}| Field | Type | Description |
|---|---|---|
clientType |
string, required | Tool identity: cursor, claude-code, codex, devin, github-actions, cli, sdk, other |
label |
string, optional | Environment label (default: "default") |
name |
string, optional | Friendly agent name |
ttlSeconds |
number, optional | Token lifetime in seconds (default: 7200, min: 300, max: 86400) |
The returned token can be used immediately to connect via WebSocket. It auto-expires after the requested TTL.
Send commands to agents for remote control.
POST /v1/agents/:id/command
{
"action": "restart",
"params": {}
}| Endpoint | Description |
|---|---|
GET /v1/status |
Hub status and metrics |
GET /v1/agents |
List agents |
GET /v1/services |
List services |
POST /v1/auth/login |
Session login |
GET /v1/workspace |
Workspace info and usage |
GET /v1/api-keys |
Manage API keys |
- All traffic encrypted (TLS required in production)
- Agent tokens expire after 30 days, support rotation
- Provisioned tokens: short-lived (default 2h, max 24h) for AI agent runtimes
- Agent identity tracking:
clientTypelogged in audit trail for every token event - Credentials never transit hub—only metadata
- Workspace isolation for multi-tenant
- Audit logging for token usage with client type, IP, and user-agent
- Log scrubbing prevents data leakage
See docs/security.md for full architecture.