Configuration reference
neo4j-mcp can be configured with environment variables or command-line flags.
When both are set for the same option, the command-line flag takes precedence over the environment variable.
Transport modes
The server supports two transport modes:
-
STDIO (default): Standard input/output mode for desktop clients.
-
HTTP: Stateless, multi-tenant mode for web clients and shared deployments.
Set the transport mode using NEO4J_MCP_TRANSPORT_MODE or --transport-mode.
STDIO mode
STDIO mode requires NEO4J_MCP_URI, NEO4J_MCP_USERNAME, NEO4J_MCP_PASSWORD, and NEO4J_MCP_DATABASE (or their CLI equivalents).
Provide the database explicitly with NEO4J_MCP_DATABASE or --database.
Connectivity, query execution, and APOC requirements are checked when the MCP handshake request (initialize or server/discover) is processed.
HTTP mode
HTTP mode accepts the target URI and authentication credentials per request.
The database is selected by the URL path in the form /db/{databaseName}/mcp.
Do not set NEO4J_MCP_URI, NEO4J_MCP_USERNAME, NEO4J_MCP_PASSWORD, or NEO4J_MCP_DATABASE in HTTP mode because the URI and credentials come from HTTP request headers and the database comes from the URL path.
See HTTP mode for endpoint, header, and error details.
General configuration
The following environment variables and equivalent command-line flags are general configuration options:
| Variable | Equivalent command-line flag | Description | Default |
|---|---|---|---|
|
|
Connection URI; required for STDIO and provided per request in HTTP |
Required for STDIO; unset for HTTP |
|
|
Database name; required for STDIO and selected in the HTTP URL |
Required for STDIO; unset for HTTP |
|
|
Set to |
|
|
|
Set to |
|
|
|
Log level (see Logging) |
|
|
|
Log output format: |
|
|
|
Number of nodes to sample for schema inference |
|
|
|
Transport mode: |
|
|
|
Comma-separated list of tools advertised by the server; see Tool filtering |
All four tools |
|
|
Maximum time allowed for an MCP request; specify a number followed by a time unit, such as |
|
Request timeout
MCP requests, including tool calls and the handshake, are bounded by the configured timeout.
Set NEO4J_MCP_REQUEST_TIMEOUT or --request-timeout as a number followed by a time unit:
-
msfor milliseconds, for example500ms -
sfor seconds, for example45s -
mfor minutes, for example5m
You can combine units, for example 1m30s.
The default is 3m and the maximum is 30m.
HTTP clients can use X-Neo4j-MCP-Request-Timeout to set a lower limit for an individual request.
See X-Neo4j-MCP-Request-Timeout.
STDIO configuration
Additional environment variables and equivalent command-line flags for STDIO mode:
| Variable | Equivalent command-line flag | Description | Default |
|---|---|---|---|
|
|
Neo4j username (STDIO mode only) |
Required for STDIO |
|
|
Neo4j password (STDIO mode only) |
Required for STDIO |
HTTP configuration
Additional environment variables and equivalent command-line flags for HTTP mode:
| Variable | Equivalent command-line flag | Description | Default |
|---|---|---|---|
|
|
Server binding address |
|
|
|
Server listening port |
|
|
|
CORS configuration (comma-separated list, |
empty (disabled) |
|
|
Header used for per-request credentials (see Custom auth header name) |
|
|
|
Allow JSON-RPC |
|
TLS/HTTPS configuration
Configure TLS for secure HTTPS connections in HTTP mode:
| Variable | Equivalent command-line flag | Description | Default |
|---|---|---|---|
|
|
Enable TLS/HTTPS |
|
|
|
Path to TLS certificate file |
Required if TLS enabled |
|
|
Path to TLS private key file |
Required if TLS enabled |