File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,14 @@ import { z } from "zod";
55import fetch from 'node-fetch' ;
66import winston from 'winston' ;
77import readline from 'readline' ;
8- const VERSION = "0.0.1" ; // Version of the MCP server
8+ import { fileURLToPath } from 'url' ;
9+ import { dirname , join } from 'path' ;
10+ import { readFileSync } from 'fs' ;
11+ const __filename = fileURLToPath ( import . meta. url ) ;
12+ const __dirname = dirname ( __filename ) ;
13+ // Extract version from package.json
14+ const packageJson = JSON . parse ( readFileSync ( join ( __dirname , '../package.json' ) , 'utf8' ) ) ;
15+ const VERSION = packageJson . version || "0.0.1" ;
916// Configure winston logger
1017const logger = winston . createLogger ( {
1118 level : 'info' ,
@@ -15,6 +22,7 @@ const logger = winston.createLogger({
1522 new winston . transports . File ( { filename : 'socket-mcp.log' } )
1623 ]
1724} ) ;
25+ logger . info ( `Starting Socket MCP server version ${ VERSION } ` ) ;
1826const SOCKET_API_URL = "https://api.socket.dev/v0/purl?alerts=false&compact=false&fixable=false&licenseattrib=false&licensedetails=false" ;
1927let SOCKET_API_KEY = process . env . SOCKET_API_KEY || "" ;
2028if ( ! SOCKET_API_KEY ) {
Original file line number Diff line number Diff line change @@ -5,9 +5,16 @@ import { z } from "zod";
55import fetch from 'node-fetch' ;
66import winston from 'winston' ;
77import readline from 'readline' ;
8- import readline from 'readline' ;
8+ import { fileURLToPath } from 'url' ;
9+ import { dirname , join } from 'path' ;
10+ import { readFileSync } from 'fs' ;
11+
12+ const __filename = fileURLToPath ( import . meta. url ) ;
13+ const __dirname = dirname ( __filename ) ;
914
10- const VERSION = "0.0.1" ; // Version of the MCP server
15+ // Extract version from package.json
16+ const packageJson = JSON . parse ( readFileSync ( join ( __dirname , '../package.json' ) , 'utf8' ) ) ;
17+ const VERSION = packageJson . version || "0.0.1" ;
1118
1219// Configure winston logger
1320const logger = winston . createLogger ( {
@@ -23,6 +30,8 @@ const logger = winston.createLogger({
2330 ]
2431} ) ;
2532
33+ logger . info ( `Starting Socket MCP server version ${ VERSION } ` ) ;
34+
2635const SOCKET_API_URL = "https://api.socket.dev/v0/purl?alerts=false&compact=false&fixable=false&licenseattrib=false&licensedetails=false" ;
2736
2837let SOCKET_API_KEY = process . env . SOCKET_API_KEY || "" ;
You can’t perform that action at this time.
0 commit comments