Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ MULTI_DB_WRITE_MODE=false
MYSQL_SSL=false
MYSQL_SSL_REJECT_UNAUTHORIZED=true

# Timezone and date handling
# Set timezone for date/time values (e.g., "+08:00" for UTC+8, "Z" for UTC, "local" for system timezone)
# MYSQL_TIMEZONE=+08:00
# Return date/datetime values as strings instead of JavaScript Date objects
# Useful for preserving exact database values without timezone conversion
# MYSQL_DATE_STRINGS=false

# Performance settings
MYSQL_POOL_SIZE=10
MYSQL_QUERY_TIMEOUT=30000
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,14 @@ When `MYSQL_CONNECTION_STRING` is provided, it takes precedence over individual
- `SCHEMA_DDL_PERMISSIONS`: Schema-specific DDL permissions
- `MULTI_DB_WRITE_MODE`: Enable write operations in multi-DB mode (default: "false")

### Timezone and Date Configuration

- `MYSQL_TIMEZONE`: Set the timezone for date/time values. Accepts formats like `+08:00` (UTC+8), `-05:00` (UTC-5), `Z` (UTC), or `local` (system timezone). Useful for ensuring consistent date/time handling across different server locations.
- `MYSQL_DATE_STRINGS`: When set to `"true"`, returns date/datetime values as strings instead of JavaScript Date objects. This preserves the exact database values without any timezone conversion, which is particularly useful for:
- Applications that need precise control over date formatting
- Cross-timezone database operations
- Avoiding JavaScript Date timezone quirks

### Monitoring Configuration

- `MYSQL_ENABLE_LOGGING`: Enable query logging (default: "false")
Expand Down
12 changes: 12 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ export const mcpConfig = {
},
}
: {}),
// Timezone configuration for date/time handling
...(process.env.MYSQL_TIMEZONE
? {
timezone: process.env.MYSQL_TIMEZONE,
}
: {}),
// Return date values as strings instead of JavaScript Date objects
...(process.env.MYSQL_DATE_STRINGS === "true"
? {
dateStrings: true,
}
: {}),
},
paths: {
schema: "schema",
Expand Down