@@ -211,6 +211,51 @@ See **[Configuration Specification](https://github.com/github/gh-aw/blob/main/do
211211- ** Passthrough** : Set value to empty string (` "" ` ) to pass through from host
212212- ** Expansion** : Use ` ${VAR_NAME} ` syntax for dynamic substitution (fails if undefined)
213213
214+ ### Configuration Validation and Error Handling
215+
216+ MCP Gateway provides detailed error messages and validation to help catch configuration issues early:
217+
218+ #### Parse Errors with Precise Location
219+
220+ When there's a syntax error in your TOML configuration, the gateway reports the exact line and column:
221+
222+ ``` bash
223+ $ awmg --config config.toml
224+ Error: failed to parse TOML at line 2, column 6: expected ' .' or ' =' , but got ' 3' instead
225+ ```
226+
227+ This helps you quickly identify and fix syntax issues.
228+
229+ #### Unknown Key Detection (Typo Detection)
230+
231+ The gateway detects and warns about unknown configuration keys, helping catch typos and deprecated options:
232+
233+ ``` toml
234+ [gateway ]
235+ prot = 3000 # Typo: should be 'port'
236+ startup_timout = 30 # Typo: should be 'startup_timeout'
237+ ```
238+
239+ When you run the gateway with these typos, you'll see warnings in the log file:
240+
241+ ```
242+ [2026-02-07T17:46:51Z] [WARN] [config] Unknown configuration key 'gateway.prot' - check for typos or deprecated options
243+ [2026-02-07T17:46:51Z] [WARN] [config] Unknown configuration key 'gateway.startup_timout' - check for typos or deprecated options
244+ ```
245+
246+ The gateway will use default values for unrecognized keys, so it will still start, but the warnings help you identify and fix configuration issues.
247+
248+ #### Memory-Efficient Parsing
249+
250+ The gateway uses streaming parsing for configuration files, making it efficient even with large configuration files containing many servers.
251+
252+ #### Best Practices
253+
254+ 1 . ** Check logs for warnings** : After starting the gateway, check the log file for any warnings about unknown keys
255+ 2 . ** Use precise error messages** : When you see a parse error, the line and column numbers point exactly to the problem
256+ 3 . ** Validate configuration** : Test your configuration changes by running the gateway and checking for warnings
257+ 4 . ** Keep configuration clean** : Remove any deprecated or unused configuration options
258+
214259## Usage
215260
216261```
0 commit comments