-
Notifications
You must be signed in to change notification settings - Fork 170
chore: add support for loading config from file MCP-327 #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for loading server configuration from a JSON file, enabling users to configure the MongoDB MCP Server via --config CLI argument or MDB_MCP_CONFIG environment variable. The implementation includes comprehensive test coverage for the new feature and a drive-by fix for testing the Server.tools interface with custom tools.
Key changes:
- Configuration can now be loaded from JSON files with proper precedence (CLI args > env vars > config file > defaults)
- Documentation updated with security best practices for config file handling
- Test coverage added for valid/invalid config file scenarios and configuration precedence rules
- Integration tests added to verify Server initialization with custom tool sets
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/common/config/createUserConfig.ts | Added config file loading support via parserOptions.config |
| src/common/config/userConfig.ts | Changed voyageApiKey override behavior from "override" to "not-allowed" |
| tests/unit/common/config.test.ts | Added comprehensive tests for config file loading and updated precedence tests |
| tests/integration/server.test.ts | Added test tools and integration tests for Server.tools interface |
| tests/fixtures/valid-config.json | New fixture with valid configuration |
| tests/fixtures/config-with-invalid-value.json | New fixture with invalid configuration for error testing |
| README.md | Added documentation for configuration file usage with security guidance |
Co-authored-by: Gagik Amaryan <me@gagik.co>
Pull Request Test Coverage Report for Build 19933887292Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
Let's delete the |
Proposed changes
Adds support for loading configuration from a file. As a drive by:
voyageApiKeyfrom request headersChecklist