Skip to content

Commit a6ecda6

Browse files
authored
Parse version from package.json (#81)
1 parent ba1e3fb commit a6ecda6

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ import {
1717
} from "@elastic/elasticsearch";
1818
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
1919
import fs from "fs";
20+
// @ts-expect-error ignore `with` keyword
21+
import pkg from './package.json' with { type: 'json' }
2022

2123
// Product metadata, used to generate the request User-Agent header and
2224
// passed to the McpServer constructor.
2325
const product = {
2426
name: "elasticsearch-mcp",
25-
version: "0.1.1",
27+
version: pkg.version,
2628
};
2729

2830
// Prepend a path prefix to every request path

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"mcp-server"
2121
],
2222
"files": [
23+
"package.json",
2324
"dist",
2425
"NOTICE.txt",
2526
"LICENSE",

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"strict": true,
1010
"declaration": true,
1111
"skipLibCheck": true,
12-
"forceConsistentCasingInFileNames": true
12+
"forceConsistentCasingInFileNames": true,
13+
"resolveJsonModule": true
1314
},
1415
"include": [
1516
"*.ts"

0 commit comments

Comments
 (0)