@jussmor/commit-memory-mcp 0.3.3 → 0.3.5

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.
Files changed (2) hide show
  1. package/dist/mcp/server.js +20 -1
  2. package/package.json +1 -1
@@ -3,7 +3,9 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
5
  import { execFileSync } from "node:child_process";
6
+ import fs from "node:fs";
6
7
  import path from "node:path";
8
+ import { pathToFileURL } from "node:url";
7
9
  import { openDatabase } from "../db/client.js";
8
10
  import { indexRepository } from "../indexer.js";
9
11
  import { explainCommitMatch, searchRelatedCommits } from "../search/query.js";
@@ -145,7 +147,24 @@ export async function startMcpServer() {
145
147
  const transport = new StdioServerTransport();
146
148
  await server.connect(transport);
147
149
  }
148
- if (import.meta.url === `file://${process.argv[1]}`) {
150
+ function isDirectExecution() {
151
+ const argvPath = process.argv[1];
152
+ if (!argvPath) {
153
+ return false;
154
+ }
155
+ const directHref = pathToFileURL(path.resolve(argvPath)).href;
156
+ if (directHref === import.meta.url) {
157
+ return true;
158
+ }
159
+ try {
160
+ const realHref = pathToFileURL(fs.realpathSync(argvPath)).href;
161
+ return realHref === import.meta.url;
162
+ }
163
+ catch {
164
+ return false;
165
+ }
166
+ }
167
+ if (isDirectExecution()) {
149
168
  startMcpServer().catch((error) => {
150
169
  const message = error instanceof Error ? error.message : "Unknown error";
151
170
  process.stderr.write(`${message}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jussmor/commit-memory-mcp",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "mcpName": "io.github.jussmor/commit-memory",
5
5
  "description": "Commit-aware RAG with sqlite-vec and MCP tools for local agent workflows",
6
6
  "license": "MIT",