Skip to content

Commit fc0ec9f

Browse files
feat: log MCP server version on startup and use dynamic version (#47)
* feat: log MCP server version on startup and use dynamic version - Add version reading from package.json using require() - Log server version on startup using console.error for consistency - Use dynamic version in McpServer constructor instead of hardcoded '0.0.1' - Remove TODO comment about reading version from package.json Fixes #46 * fixup! feat: log MCP server version on startup and use dynamic version * fixup! fixup! feat: log MCP server version on startup and use dynamic version
1 parent b2bc24a commit fc0ec9f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { config } from 'dotenv';
1515
import { z, ZodRawShape, ZodTypeAny } from "zod";
1616

17+
import { version as VERSION } from '../package.json';
1718
import { createOAuthClient } from "./dynatrace-clients";
1819
import { listVulnerabilities } from "./capabilities/list-vulnerabilities";
1920
import { listProblems } from "./capabilities/list-problems";
@@ -84,11 +85,11 @@ const main = async () => {
8485
// create an oauth-client
8586
const dtClient = await createOAuthClient(oauthClient, oauthClientSecret, dtEnvironment, scopes);
8687

87-
console.error("Starting Dynatrace MCP Server...");
88+
console.error(`Starting Dynatrace MCP Server v${VERSION}...`);
8889
const server = new McpServer(
8990
{
9091
name: "Dynatrace MCP Server",
91-
version: "0.0.1", // ToDo: Read from package.json / hard-code?
92+
version: VERSION,
9293
},
9394
{
9495
capabilities: {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"strict": true,
88
"module": "CommonJS",
99
"outDir": "./dist",
10+
"resolveJsonModule": true
1011
},
1112
"include": ["src/**/*"],
1213
"exclude": ["node_modules"]

0 commit comments

Comments
 (0)