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"] = {
164
164
applyProxyToOIDC : true ,
165
165
} ;
166
166
167
+ export const driverOptions = setupDriverConfig ( {
168
+ config,
169
+ defaults : defaultDriverOptions ,
170
+ } ) ;
171
+
167
172
function getLogPath ( ) : string {
168
173
const logPath = path . join ( getLocalDataPath ( ) , "mongodb-mcp" , ".app-logs" ) ;
169
174
return logPath ;
@@ -302,3 +307,17 @@ export function setupUserConfig({
302
307
303
308
return userConfig ;
304
309
}
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" ;
2
2
import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver" ;
3
3
import EventEmitter from "events" ;
4
4
import { setAppNameParamIfMissing } from "../helpers/connectionOptions.js" ;
@@ -92,7 +92,7 @@ export class ConnectionManager extends EventEmitter<ConnectionManagerEvents> {
92
92
serviceProvider = await NodeDriverServiceProvider . connect ( settings . connectionString , {
93
93
productDocsLink : "https://github.com/mongodb-js/mongodb-mcp-server/" ,
94
94
productName : "MongoDB MCP" ,
95
- ...defaultDriverOptions ,
95
+ ...driverOptions ,
96
96
} ) ;
97
97
} catch ( error : unknown ) {
98
98
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) => {
88
88
process . exit ( 1 ) ;
89
89
} ) ;
90
90
91
- function assertFIPSMode ( ) {
91
+ function assertFIPSMode ( ) : void | never {
92
92
let fipsError : Error | undefined = undefined ;
93
93
if ( config . tlsFIPSMode ) {
94
94
if ( ! fipsError && ! crypto . getFips ( ) ) {
@@ -110,15 +110,15 @@ function assertFIPSMode() {
110
110
}
111
111
}
112
112
113
- function assertHelpMode ( ) {
113
+ function assertHelpMode ( ) : void | never {
114
114
if ( config . help ) {
115
115
console . log ( "For usage information refer to the README.md:" ) ;
116
116
console . log ( "https://github.com/mongodb-js/mongodb-mcp-server?tab=readme-ov-file#quick-start" ) ;
117
117
process . exit ( 0 ) ;
118
118
}
119
119
}
120
120
121
- function assertVersionMode ( ) {
121
+ function assertVersionMode ( ) : void | never {
122
122
if ( config . version ) {
123
123
console . log ( packageInfo . version ) ;
124
124
process . exit ( 0 ) ;
You can’t perform that action at this time.
0 commit comments