pkm-mcp-server 1.5.1 → 1.5.2
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/hooks/capture-handler.sh +10 -3
- package/package.json +1 -1
package/hooks/capture-handler.sh
CHANGED
|
@@ -35,13 +35,20 @@ if [ -z "$CAPTURE_TYPE" ] || [ -z "$CAPTURE_TITLE" ] || [ -z "$CAPTURE_CONTENT"
|
|
|
35
35
|
exit 0
|
|
36
36
|
fi
|
|
37
37
|
|
|
38
|
-
# MCP config
|
|
38
|
+
# MCP config — auto-detect repo (../index.js exists) vs installed (use npx)
|
|
39
39
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd -P)
|
|
40
40
|
MCP_CONFIG=$(node -e "
|
|
41
|
+
const { existsSync } = require('fs');
|
|
42
|
+
const path = require('path');
|
|
43
|
+
const localIndex = path.join(process.argv[1], '..', 'index.js');
|
|
44
|
+
const useLocal = existsSync(localIndex);
|
|
41
45
|
const env = { VAULT_PATH: process.argv[2] };
|
|
42
46
|
if (process.env.OPENAI_API_KEY) env.OPENAI_API_KEY = process.env.OPENAI_API_KEY;
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
const server = useLocal
|
|
48
|
+
? { command: 'node', args: [localIndex], env }
|
|
49
|
+
: { command: 'npx', args: ['-y', 'pkm-mcp-server@latest'], env };
|
|
50
|
+
console.log(JSON.stringify({ mcpServers: { 'obsidian-pkm': server } }));
|
|
51
|
+
" "$SCRIPT_DIR" "${VAULT_PATH:-$HOME/Documents/PKM}")
|
|
45
52
|
|
|
46
53
|
# Build prompt via Node.js to avoid shell injection from user content
|
|
47
54
|
PROMPT_FILE=$(mktemp)
|