Skip to content

Conversation

technicalpickles
Copy link

Summary

  • Add MCP_CLI_CONFIG environment variable support with priority hierarchy (CLI flag → env var → default)
  • Improve config file validation with detailed, user-friendly error messages
  • Add comprehensive JSON parsing error handling with line/column information
  • Validate server configurations and provide helpful structure examples

Test plan

  • Test invalid JSON syntax - provides helpful error with line/column info
  • Test missing config files - shows clear error message
  • Test MCP_CLI_CONFIG environment variable - works correctly
  • Test missing mcpServers section - shows expected structure
  • Test backward compatibility - existing functionality unchanged

🤖 Generated with Claude Code

…andling

- Add MCP_CLI_CONFIG environment variable support with priority hierarchy
- Improve config file validation with detailed error messages
- Add comprehensive JSON parsing error handling with line/column info
- Validate server configurations and provide helpful structure examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@technicalpickles technicalpickles changed the title feat: enhance --config with MCP_CLI_CONFIG env var and better error handling feat: add support for using MCP_CLI_CONFIG env var for config file, and improve error handling Sep 6, 2025
@technicalpickles technicalpickles marked this pull request as ready for review September 6, 2025 22:07
- Document configuration priority hierarchy (CLI flag → env var → default)
- Add MCP_CLI_CONFIG environment variable usage example
- Document enhanced error handling with JSON syntax validation
- Add configuration file format section with structure examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
technicalpickles and others added 4 commits September 8, 2025 11:50
- Create new src/config/index.js with all config-related functions
- Move resolveConfigPath, validateConfigStructure, readConfig, pickServer from mcp.js
- Move getClaudeConfigPath from utils.js to config module
- Add backward compatibility re-export in utils.js
- Improve separation of concerns and maintainability
- All existing functionality preserved

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Combine resolveConfigPath + readConfig + validation into single loadConfig()
- Inline getClaudeConfigPath and validateConfigStructure as private helpers
- Streamline error messages while maintaining helpful UX
- Reduce from 5 exports to 2 main functions (loadConfig, pickServer)
- Remove backward compatibility exports, clean API surface
- ~23% code reduction (39 lines saved) with same functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Consolidate all path resolution logic in one place
- getDefaultConfigPath now handles CLI arg → env var → platform default priority
- Cleaner separation of concerns in loadConfig function
- Same functionality with better organization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add Zod dependency for type-safe schema validation
- Replace 27 lines of manual validation with concise schema definition
- Improve error messages with precise field-level feedback
- Reduce code complexity and improve maintainability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants