Overview
MCP Server MotherDuck supports a comprehensive set of command-line parameters that control database connections, security, performance, and transport configuration. All parameters can also be set via environment variables (see Environment Variables).Connection Parameters
These parameters control how the server connects to DuckDB or MotherDuck databases.Path to local DuckDB database file or MotherDuck database.
- Use
:memory:for an in-memory database (requires--read-writeflag) - Use
md:for MotherDuck default database - Use
md:database_namefor a specific MotherDuck database - Use absolute file path for local DuckDB files (e.g.,
/path/to/database.duckdb) - Use
s3://bucket/path.duckdbfor S3-hosted databases
MCP_DB_PATHExamples:Access token to use for MotherDuck database connections.If not specified, the server will look for the token in environment variables Example:
motherduck_token or MOTHERDUCK_TOKEN.Environment variables: motherduck_token, MOTHERDUCK_TOKENFor read-only MotherDuck connections, you need a read-scaling token. Regular tokens require
--read-write mode.Override the home directory for DuckDB. Defaults to system HOME environment variable.DuckDB uses the home directory to store extensions and configuration files. This parameter allows you to override the default location.Example:
Additional MotherDuck connection string parameters in
key=value format separated by &.These parameters are appended to the MotherDuck connection string and allow fine-tuning of connection behavior.Environment variable: MCP_MOTHERDUCK_CONNECTION_PARAMETERSExample:Security Parameters
These parameters control access permissions and security settings.Enable write access to the database. By default, the server runs in read-only mode for local DuckDB files and MotherDuck databases.Environment variable:
MCP_READ_WRITEExamples:Flag for connecting to MotherDuck in SaaS mode.SaaS mode restricts local filesystem access for enhanced security. Recommended for production deployments with third-party access.Environment variable: Example:
MCP_SAAS_MODESee Securing for Production for deployment guidance. Consider using MotherDuck Remote MCP for fully-managed production deployments.
Enable the
switch_database_connection tool to change databases at runtime.When enabled, AI assistants can switch between different database connections (local files, S3, or MotherDuck) during a session.Environment variable: MCP_ALLOW_SWITCH_DATABASESExample:SQL file path or SQL string to execute on startup for database initialization.Useful for applying security settings, creating tables, loading extensions, or setting up the database environment.Environment variable:
MCP_INIT_SQLExamples:For securing DuckDB deployments, see the Securing DuckDB guide.
Performance Parameters
These parameters control query execution and result limits.Maximum number of rows to return from queries.Use SQL
LIMIT clauses in your queries for specific row counts. This parameter provides a global limit to prevent overwhelming responses.Environment variable: MCP_MAX_ROWSExample:Maximum number of characters in query results.Prevents issues with wide rows or large text columns by truncating results if they exceed this limit.Environment variable:
MCP_MAX_CHARSExample:Query execution timeout in seconds. Set to
-1 to disable timeout.Environment variable: MCP_QUERY_TIMEOUTExamples:Use temporary connections for read-only local DuckDB files.When enabled, the server creates a new connection for each query, keeping the file unlocked so other processes can write to it. Use
--no-ephemeral-connections to maintain a persistent connection.Environment variable: MCP_EPHEMERAL_CONNECTIONSExamples:Ephemeral connections are only used for read-only local DuckDB files. They have no effect on in-memory databases or MotherDuck connections.
Transport Parameters
These parameters control how the MCP server communicates with clients.Transport type for the MCP server.Choices:
stdio, http, sse, streamstdio: Standard input/output (default, for local AI assistants)http: Streamable HTTP transport (for remote connections)sse,stream: Deprecated aliases forhttp
MCP_TRANSPORTExamples:Use stateless Streamable HTTP when Example:
--transport http.Required for platforms that inject Mcp-Session-Id headers (e.g., AWS Bedrock AgentCore Runtime).Environment variable: MCP_STATELESS_HTTPThis is for protocol compatibility only. The server still maintains global state via the shared DatabaseClient.
Host to bind the MCP server when using HTTP transport.Environment variable:
MCP_HOSTExamples:Port to listen on for HTTP transport.Environment variable:
MCP_PORTExample:Complete Configuration Examples
Development: In-Memory with Full Access
Production: MotherDuck Read-Only with SaaS Mode
Local File: Read-Write with Initialization
HTTP Transport: Remote Access
Deprecated Parameters
The following parameters are deprecated and should not be used:--saas-mode: Use--motherduck-saas-modeinstead--read-only: Read-only is now the default. Use--read-writefor write access--json-response: No longer needed, JSON responses are automatic