Skip to content

Commit d3344b8

Browse files
committed
fix: project root path calculation
1 parent f68c388 commit d3344b8

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.changeset/tired-teeth-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"ansible-database-mcp": patch
3+
---
4+
5+
fix project root path calculation

src/config/paths.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { fileURLToPath } from 'node:url';
66
import { existsSync, readFileSync } from 'node:fs';
77

88
const __dirname = path.dirname(fileURLToPath(import.meta.url));
9-
const PROJECT_ROOT = path.resolve(__dirname, '../..');
9+
const PROJECT_ROOT = __dirname.endsWith('/dist')
10+
? path.resolve(__dirname, '..') // dist/main.js -> project root
11+
: path.resolve(__dirname, '../..'); // src/config/paths.ts -> project root
1012

1113
export class Paths {
1214
static getConfigPath(): string {

src/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const mcpMiddleware = async (req: Request, res: Response) => {
5656
},
5757
(args) => {
5858
const question = args.question as string;
59-
const useContext: boolean = args['use-context'] === 'true';
59+
const useContext: string = args['useContext'] as string;
6060
return ask.handler(question, useContext);
6161
}
6262
);

0 commit comments

Comments
 (0)