Skip to main content

Connection Reference

This page provides a comprehensive reference for all connection options available for each supported database type.

SQLite Connection Options

SQLite is the simplest database to connect to, as it only requires a path to the database file.

node dist/src/index.js /path/to/your/database.db

Special Paths

  • :memory: - Creates an in-memory database (data is lost when connection is closed)
  • "" (empty string) - Creates a temporary on-disk database

SQL Server Connection Options

OptionDescriptionDefaultRequired
--sqlserverSpecifies SQL Server mode-Yes
--serverSQL Server hostname or IP-Yes
--databaseDatabase name-Yes
--userSQL Server username-No*
--passwordSQL Server password-No*
--portSQL Server port1433No
--trustServerCertificateTrust server certificate (true/false)falseNo
--connectionTimeoutConnection timeout in ms15000No
--requestTimeoutRequest timeout in ms15000No

*Windows Authentication is used if user and password are omitted

Example with Windows Authentication

node dist/src/index.js --sqlserver --server localhost\\SQLEXPRESS --database Northwind

Example with SQL Authentication

node dist/src/index.js --sqlserver --server dbserver.example.com --database Northwind --user sa --password P@ssw0rd --port 1433

PostgreSQL Connection Options

OptionDescriptionDefaultRequired
--postgresql or --postgresSpecifies PostgreSQL mode-Yes
--hostPostgreSQL hostname or IP-Yes
--databaseDatabase name-Yes
--userPostgreSQL username-No
--passwordPostgreSQL password-No
--portPostgreSQL port5432No
--sslUse SSL connection (true/false)falseNo
--connection-timeoutConnection timeout in ms30000No

Basic Example

node dist/src/index.js --postgresql --host localhost --database sample_db --user postgres --password secret

Example with SSL and Custom Port

node dist/src/index.js --postgresql --host dbserver.example.com --database sample_db --user appuser --password Secure123! --port 5433 --ssl true

Environment Variables

Instead of specifying sensitive credentials on the command line, you can use environment variables:

SQL Server Environment Variables

  • MSSQL_SERVER - SQL Server hostname
  • MSSQL_DATABASE - Database name
  • MSSQL_USER - SQL Server username
  • MSSQL_PASSWORD - SQL Server password

PostgreSQL Environment Variables

  • PGHOST - PostgreSQL hostname
  • PGDATABASE - Database name
  • PGUSER - PostgreSQL username
  • PGPASSWORD - PostgreSQL password
  • PGPORT - PostgreSQL port

Connection Pooling

All database connections use connection pooling for better performance:

  • SQLite: Uses a single persistent connection
  • SQL Server: Default pool of 5 connections
  • PostgreSQL: Default pool of 10 connections

Connection Security

For secure connections:

  1. SQL Server: Use --trustServerCertificate false in production and ensure proper SSL certificates are installed on the server.

  2. PostgreSQL: Use --ssl true and ensure the server is configured for SSL connections.

  3. For all database types, consider using environment variables instead of passing credentials on the command line.

  4. Store your Claude Desktop configuration file with appropriate file system permissions.