From 699662cf11bf30951cfe769bd9faa3a2c2bf6974 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Tue, 10 Jun 2025 12:45:19 -0500 Subject: [PATCH] Parse version from package.json --- index.ts | 4 +++- package.json | 1 + tsconfig.json | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index c31140a..3fad225 100644 --- a/index.ts +++ b/index.ts @@ -17,12 +17,14 @@ import { } from "@elastic/elasticsearch"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import fs from "fs"; +// @ts-expect-error ignore `with` keyword +import pkg from './package.json' with { type: 'json' } // Product metadata, used to generate the request User-Agent header and // passed to the McpServer constructor. const product = { name: "elasticsearch-mcp", - version: "0.1.1", + version: pkg.version, }; // Prepend a path prefix to every request path diff --git a/package.json b/package.json index 147b279..4a63b42 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "mcp-server" ], "files": [ + "package.json", "dist", "NOTICE.txt", "LICENSE", diff --git a/tsconfig.json b/tsconfig.json index a76cdbe..1cef8d7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,8 @@ "strict": true, "declaration": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true }, "include": [ "*.ts"