---
title: "Installation"
---
## npm
<Tabs>
<Tab title="npx">
```bash
# PostgreSQL example
npx @bytebase/dbhub \
--transport http \
--port 8080 \
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
```
</Tab>
<Tab title="Global Installation">
```bash
# Install globally
npm install -g @bytebase/dbhub
# Run the server
dbhub --transport http --port 8080 --dsn "postgres://..."
```
</Tab>
</Tabs>
## Docker
<Tabs>
<Tab title="Docker Run">
```bash
docker run --rm --init \
--name dbhub \
--publish 8080:8080 \
bytebase/dbhub \
--transport http \
--port 8080 \
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
```
<Warning>
When connecting to databases on your host machine from Docker, use `host.docker.internal` instead of `localhost`:
```bash
--dsn "postgres://user:password@host.docker.internal:5432/dbname"
```
</Warning>
</Tab>
<Tab title="Docker Compose">
For development environments using Docker Compose, add DBHub to your `docker-compose.yml`:
```yaml docker-compose.yml
services:
dbhub:
image: bytebase/dbhub:latest
container_name: dbhub
ports:
- "8080:8080"
environment:
- DBHUB_LOG_LEVEL=info
command:
- --transport
- http
- --port
- "8080"
- --dsn
- "postgres://user:password@database:5432/dbname"
depends_on:
- database
database:
image: postgres:15-alpine
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: dbname
```
</Tab>
</Tabs>
## Verifying Installation
### Test with Demo Mode
<Note>
The demo mode includes a bundled SQLite sample "employee" database with tables for employees, departments, salaries, and more - perfect for testing!
</Note>
```bash
# Start DBHub in demo mode
npx @bytebase/dbhub --transport http --port 8080 --demo
# In another terminal, test the MCP endpoint
curl http://localhost:8080/mcp
```
You should see a JSON response indicating the MCP server is running.
### Test with Your Database
```bash
# Start DBHub with your database
npx @bytebase/dbhub \
--transport http \
--port 8080 \
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
# Test connection
curl http://localhost:8080/mcp
```