@debugg-ai/debugg-ai-mcp 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +21 -5
- package/package.json +1 -1
package/dist/config/index.js
CHANGED
|
@@ -2,10 +2,26 @@
|
|
|
2
2
|
* Centralized configuration management for DebuggAI MCP Server
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { readFileSync } from 'fs';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import { dirname, join } from 'path';
|
|
8
|
+
function findPackageVersion() {
|
|
9
|
+
const __dir = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
let dir = __dir;
|
|
11
|
+
while (true) {
|
|
12
|
+
try {
|
|
13
|
+
const pkg = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf-8'));
|
|
14
|
+
if (pkg.name === '@debugg-ai/debugg-ai-mcp')
|
|
15
|
+
return pkg.version;
|
|
16
|
+
}
|
|
17
|
+
catch { /* keep walking */ }
|
|
18
|
+
const parent = dirname(dir);
|
|
19
|
+
if (parent === dir)
|
|
20
|
+
return 'unknown';
|
|
21
|
+
dir = parent;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const _version = findPackageVersion();
|
|
9
25
|
const configSchema = z.object({
|
|
10
26
|
server: z.object({
|
|
11
27
|
name: z.string().default('DebuggAI MCP Server'),
|
|
@@ -32,7 +48,7 @@ export function loadConfig() {
|
|
|
32
48
|
const rawConfig = {
|
|
33
49
|
server: {
|
|
34
50
|
name: 'DebuggAI MCP Server',
|
|
35
|
-
version:
|
|
51
|
+
version: _version,
|
|
36
52
|
},
|
|
37
53
|
api: {
|
|
38
54
|
// Priority: DEBUGGAI_API_TOKEN → DEBUGGAI_JWT_TOKEN → DEBUGGAI_API_KEY
|