File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed
Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,11 @@ export const defaultDriverOptions: ConnectionInfo["driverOptions"] = {
164164 applyProxyToOIDC : true ,
165165} ;
166166
167+ export const driverOptions = setupDriverConfig ( {
168+ config,
169+ defaults : defaultDriverOptions ,
170+ } ) ;
171+
167172function getLogPath ( ) : string {
168173 const logPath = path . join ( getLocalDataPath ( ) , "mongodb-mcp" , ".app-logs" ) ;
169174 return logPath ;
@@ -302,3 +307,17 @@ export function setupUserConfig({
302307
303308 return userConfig ;
304309}
310+
311+ export function setupDriverConfig ( {
312+ config,
313+ defaults,
314+ } : {
315+ config : UserConfig ;
316+ defaults : ConnectionInfo [ "driverOptions" ] ;
317+ } ) : ConnectionInfo [ "driverOptions" ] {
318+ const { driverOptions } = generateConnectionInfoFromCliArgs ( config ) ;
319+ return {
320+ ...defaults ,
321+ ...driverOptions ,
322+ } ;
323+ }
Original file line number Diff line number Diff line change 1- import { defaultDriverOptions } from "./config.js" ;
1+ import { driverOptions } from "./config.js" ;
22import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver" ;
33import EventEmitter from "events" ;
44import { setAppNameParamIfMissing } from "../helpers/connectionOptions.js" ;
@@ -92,7 +92,7 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
9292 serviceProvider = await NodeDriverServiceProvider . connect ( settings . connectionString , {
9393 productDocsLink : "https://github.com/mongodb-js/mongodb-mcp-server/" ,
9494 productName : "MongoDB MCP" ,
95- ...defaultDriverOptions ,
95+ ...driverOptions ,
9696 } ) ;
9797 } catch ( error : unknown ) {
9898 const errorReason = error instanceof Error ? error . message : `${ error as string } ` ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ main().catch((error: unknown) => {
8888 process . exit ( 1 ) ;
8989} ) ;
9090
91- function assertFIPSMode ( ) {
91+ function assertFIPSMode ( ) : void | never {
9292 let fipsError : Error | undefined = undefined ;
9393 if ( config . tlsFIPSMode ) {
9494 if ( ! fipsError && ! crypto . getFips ( ) ) {
@@ -110,15 +110,15 @@ function assertFIPSMode() {
110110 }
111111}
112112
113- function assertHelpMode ( ) {
113+ function assertHelpMode ( ) : void | never {
114114 if ( config . help ) {
115115 console . log ( "For usage information refer to the README.md:" ) ;
116116 console . log ( "https://github.com/mongodb-js/mongodb-mcp-server?tab=readme-ov-file#quick-start" ) ;
117117 process . exit ( 0 ) ;
118118 }
119119}
120120
121- function assertVersionMode ( ) {
121+ function assertVersionMode ( ) : void | never {
122122 if ( config . version ) {
123123 console . log ( packageInfo . version ) ;
124124 process . exit ( 0 ) ;
You can’t perform that action at this time.
0 commit comments