Skip to content

Conversation

@himanshusinghs
Copy link
Collaborator

@himanshusinghs himanshusinghs commented Dec 4, 2025

Proposed changes

Adds support for loading configuration from a file. As a drive by:

  • have added coverage for Server.tools interface as well
  • disabled overriding voyageApiKey from request headers

Checklist

@himanshusinghs himanshusinghs requested a review from a team as a code owner December 4, 2025 13:11
Copilot AI review requested due to automatic review settings December 4, 2025 13:11
Copy link
Contributor

Copilot AI left a 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

himanshusinghs and others added 2 commits December 4, 2025 14:23
Co-authored-by: Gagik Amaryan <me@gagik.co>
@coveralls
Copy link
Collaborator

coveralls commented Dec 4, 2025

Pull Request Test Coverage Report for Build 19933887292

Warning: 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

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.5%) to 80.313%

Files with Coverage Reduction New Missed Lines %
src/common/config/configOverrides.ts 2 90.91%
Totals Coverage Status
Change from base Build 19928391156: 0.5%
Covered Lines: 6656
Relevant Lines: 8204

💛 - Coveralls

@gagik
Copy link
Collaborator

gagik commented Dec 4, 2025

Let's delete the --config instructions though. If we give instructions then one will do it.

@himanshusinghs himanshusinghs merged commit e869fd3 into main Dec 4, 2025
23 of 25 checks passed
@himanshusinghs himanshusinghs deleted the chore/load-config-from-file branch December 4, 2025 15:37
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.

4 participants