@@ -3,8 +3,7 @@ import { Session } from "./session.js";
33import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js" ;
44import { AtlasTools } from "./tools/atlas/tools.js" ;
55import { MongoDbTools } from "./tools/mongodb/tools.js" ;
6- import logger , { initializeLogger } from "./logger.js" ;
7- import { mongoLogId } from "mongodb-log-writer" ;
6+ import logger , { initializeLogger , LogId } from "./logger.js" ;
87import { ObjectId } from "mongodb" ;
98import { Telemetry } from "./telemetry/telemetry.js" ;
109import { UserConfig } from "./config.js" ;
@@ -23,7 +22,7 @@ export class Server {
2322 public readonly session : Session ;
2423 private readonly mcpServer : McpServer ;
2524 private readonly telemetry : Telemetry ;
26- private readonly userConfig : UserConfig ;
25+ public readonly userConfig : UserConfig ;
2726 private readonly startTime : number ;
2827
2928 constructor ( { session, mcpServer, userConfig } : ServerOptions ) {
@@ -71,7 +70,7 @@ export class Server {
7170 this . session . sessionId = new ObjectId ( ) . toString ( ) ;
7271
7372 logger . info (
74- mongoLogId ( 1_000_004 ) ,
73+ LogId . serverInitialized ,
7574 "server" ,
7675 `Server started with transport ${ transport . constructor . name } and agent runner ${ this . session . agentRunner ?. name } `
7776 ) ;
@@ -135,6 +134,32 @@ export class Server {
135134 }
136135
137136 private registerResources ( ) {
137+ this . mcpServer . resource (
138+ "config" ,
139+ "config://config" ,
140+ {
141+ description :
142+ "Server configuration, supplied by the user either as environment variables or as startup arguments" ,
143+ } ,
144+ ( uri ) => {
145+ const result = {
146+ telemetry : this . userConfig . telemetry ,
147+ logPath : this . userConfig . logPath ,
148+ connectionString : this . userConfig . connectionString
149+ ? "set; no explicit connect needed, use switch-connection tool to connect to a different connection if necessary"
150+ : "not set; before using any mongodb tool, you need to call the connect tool with a connection string" ,
151+ connectOptions : this . userConfig . connectOptions ,
152+ } ;
153+ return {
154+ contents : [
155+ {
156+ text : JSON . stringify ( result ) ,
157+ uri : uri . href ,
158+ } ,
159+ ] ,
160+ } ;
161+ }
162+ ) ;
138163 if ( this . userConfig . connectionString ) {
139164 this . mcpServer . resource (
140165 "connection-string" ,
0 commit comments