-
Notifications
You must be signed in to change notification settings - Fork 165
feat: allow reading config from a file and support toolMetadataOverrides MCP-292 #743
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
base: main
Are you sure you want to change the base?
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 introduces support for reading configuration from a file and adds the ability to override tool metadata (name and description) through user configuration. The changes enable users to customize tool names and descriptions while maintaining internal tool identification.
Key Changes:
- Added
toolMetadataOverridesconfiguration option to UserConfig schema - Refactored all tools to use
internalNameandinternalDescriptionproperties alongside computednameanddescriptiongetters - Implemented config file loading via CLI argument (
--config) and environment variable (MDB_MCP_CONFIG)
Reviewed Changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/common/config/userConfig.ts | Added toolMetadataOverrides field to UserConfig schema |
| src/common/config/createUserConfig.ts | Added config file loading support via yargs-parser |
| src/tools/tool.ts | Refactored to support internal vs configured tool metadata with getters |
| src/tools/mongodb/connect/connect.ts | Updated to use new internal metadata properties and override logic |
| tests/unit/common/config.test.ts | Added comprehensive tests for config file loading and precedence |
| tests/integration/tools/mongodb/connect/connect.test.ts | Added integration tests for metadata override functionality |
| tests/fixtures/*.json | Added fixture files for config loading tests |
| src/tools/mongodb/**/*.ts | Updated all MongoDB tools to use internalName/internalDescription |
| src/tools/atlas/**/*.ts | Updated all Atlas tools to use internalName/internalDescription |
| src/tools/atlasLocal/**/*.ts | Updated all Atlas Local tools to use internalName/internalDescription |
| tests/unit/toolBase.test.ts | Updated test tool to use new property names |
| tests/integration/**/*.ts | Updated test tools to use new property names |
Pull Request Test Coverage Report for Build 19577555100Details
💛 - Coveralls |
|
please update README.md |
|
please add validation to guard rail for name collision |
This commit ensures that we register the tool with correct metadata , taking into consideration the toolMetadataOverrides provided by the users.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit ensures that when toolMetadataOverrides accidentally lead to tool name collision then we error out before even starting the server.
fc66307 to
2587b6e
Compare
Proposed changes
This PR introduces support for reading configuration from a file specified either by command line argument
--configor by environment variableMDB_MCP_CONFIG. The configuration from the file is used as the base on top of which configuration from environment variables are applied and then config from CLI arguments. The precedence order is provided and maintained by yargs-parser itself.Furthermore, we've added a new config property called
toolMetadataOverrideswhich allows specifying name and description overrides for tool. It is basically a map of internal tool name to the override object.We expect users to be using config file for specifying this configuration and ensuring that access to the config is locked down to the user running the MongoDB MCP Server. Doing the same through command line arguments is gruesome but possible and not encouraged at all. An example:
CLI Arguments (nested keys separated by dot)
Checklist