File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed
Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 11import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver" ;
22import { ApiClient } from "./common/atlas/apiClient.js" ;
3- import config from "./config.js" ;
3+ import defaultConfig from "./config.js" ;
44import { Implementation } from "@modelcontextprotocol/sdk/types.js" ;
55
66export class Session {
@@ -13,15 +13,17 @@ export class Session {
1313 } ;
1414 private credentials ?: { clientId : string ; clientSecret : string } ;
1515 private baseUrl : string ;
16+ private readonly config : any ;
1617
17- constructor ( ) {
18- this . baseUrl = config . apiBaseUrl ?? "https://cloud.mongodb.com/" ;
18+ constructor ( config = defaultConfig ) {
19+ this . config = config ;
20+ this . baseUrl = this . config . apiBaseUrl ?? "https://cloud.mongodb.com/" ;
1921
2022 // Store credentials if available
21- if ( config . apiClientId && config . apiClientSecret ) {
23+ if ( this . config . apiClientId && this . config . apiClientSecret ) {
2224 this . credentials = {
23- clientId : config . apiClientId ,
24- clientSecret : config . apiClientSecret ,
25+ clientId : this . config . apiClientId ,
26+ clientSecret : this . config . apiClientSecret ,
2527 } ;
2628
2729 // Initialize API client with credentials
Original file line number Diff line number Diff line change 1+ import pkg from "../../package.json" with { type : "json" } ;
2+ import config from "../config.js" ;
3+
4+ /**
5+ * Machine-specific metadata formatted for telemetry
6+ */
7+ export const MACHINE_METADATA = Object . freeze ( {
8+ device_id : "id" , // TODO: use @mongodb -js/machine-id
9+ mcp_server_version : pkg . version ,
10+ mcp_server_name : config . mcpServerName ,
11+ platform : process . platform ,
12+ arch : process . arch ,
13+ os_type : process . platform ,
14+ os_version : process . version ,
15+ } ) ;
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ export class Telemetry {
9393 const result = await this . sendEvents ( this . session . apiClient , allEvents ) ;
9494 if ( result . success ) {
9595 await this . clearCache ( ) ;
96+ logger . debug ( mongoLogId ( 1_000_000 ) , "telemetry" , `Sent ${ allEvents . length } events successfully` ) ;
9697 return ;
9798 }
9899
You can’t perform that action at this time.
0 commit comments