File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11import { ClientOptions } from 'contentful-management' ;
22import { env } from '../config/env.js' ;
3+ import { getVersion } from '../utils/getVersion.js' ;
34
45/**
56 * Creates a default Contentful client configuration without actually initializing it.
@@ -14,7 +15,7 @@ export function getDefaultClientConfig(): ClientOptions {
1415 host : env . data . CONTENTFUL_HOST ,
1516 space : env . data . SPACE_ID ,
1617 headers : {
17- 'X-Contentful-User-Agent-Tool' : ' contentful-mcp/0.0.1' , //Include user agent header for telemetry tracking
18+ 'X-Contentful-User-Agent-Tool' : ` contentful-mcp/${ getVersion ( ) } ` , //Include user agent header for telemetry tracking
1819 } ,
1920 } ;
2021
Original file line number Diff line number Diff line change 1+ import { readFileSync } from 'node:fs' ;
2+ import { join } from 'node:path' ;
3+ import { fileURLToPath } from 'node:url' ;
4+ import { dirname } from 'node:path' ;
5+
6+ export const getVersion = ( ) => {
7+ const __filename = fileURLToPath ( import . meta. url ) ;
8+ const __dirname = dirname ( __filename ) ;
9+ const packageJsonPath = join ( __dirname , '../../package.json' ) ;
10+ const packageJson = JSON . parse ( readFileSync ( packageJsonPath , 'utf8' ) ) ;
11+ return packageJson . version ;
12+ } ;
You can’t perform that action at this time.
0 commit comments