-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 1.0.0
-
Component/s: None
-
None
-
Developer Tools
Related to PR - https://github.com/mongodb-js/mongodb-mcp-server/pull/562
VSCode project works(not directly) with yargs-parser@21 and our project pulls in version 22. The dependency resolution in VSCode resolves yargs-parser to version 21 and thus the usage of this dependency in the imported mcp-server-code breaks.
Ideally, we wouldn't have to do this because the imported code in VSCode, theoretically, in no way relies on yargs-parser. But because of our code setup, the yargs-parser does come in the imported path eventually:
1. exporting types and vaues from config.js in lib entry point which imports yargs-parser. Ideally we should re-organise this to different files, one with schema and one with config helpers.
2. imports from config.js in our trasport/base.js which sets up default connectionManager imported from connectionManager.js which further imports config.js which imports yargs-parser.
3. imports from config.js in our config resource which imports defaultDriverOptions.
To fix this long term there are two options:
1. Re-organise files and imports such that un-necessary code does not end up in lib entry point. This will compromise a bit on DX but is more preferable, we do the same in Compass, btw. Additionally we will have to setup VSCode integration tests.
2. Use bundler to bundle the lib entry point with all the dependencies it might accidentally end up importing. Less preferred because the lib entry point might just grow without us noticing but this will work flawlessly.