@lojban/semantic-search-mcp 1.0.14 → 1.0.16
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/package.json +1 -1
- package/src/index.ts +3 -2
- package/src/storage.ts +2 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,16 +6,17 @@ import {
|
|
|
6
6
|
ListToolsRequestSchema,
|
|
7
7
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
8
8
|
import path from 'path';
|
|
9
|
+
import os from 'os';
|
|
9
10
|
import { getEmbedding, getBatchEmbeddings } from './embeddings.js';
|
|
10
11
|
import { createVectorStorage, type SearchResult } from './storage.js';
|
|
11
12
|
import { normalizePath } from './path-util.js';
|
|
12
13
|
import { listFilesInDirectories, readFileWithMetadata } from './scanner.js';
|
|
13
14
|
import { getSampuVlasteDir } from './download-sampu-vlaste.js';
|
|
14
15
|
|
|
15
|
-
// Data dir: use env, or
|
|
16
|
+
// Data dir: use env, or $HOME/.semantic-search/data so the same index is used across MCP version upgrades (npx cwd can change per version)
|
|
16
17
|
const dataDir =
|
|
17
18
|
process.env.SEMANTIC_SEARCH_DATA_DIR ||
|
|
18
|
-
path.join(
|
|
19
|
+
path.join(os.homedir(), '.semantic-search', 'data');
|
|
19
20
|
const DB_PATH = path.join(dataDir, 'vectors.db');
|
|
20
21
|
|
|
21
22
|
// Background indexing state (progress for get_index_stats)
|
package/src/storage.ts
CHANGED
|
@@ -128,11 +128,11 @@ export class VectorStorage {
|
|
|
128
128
|
l.file_path,
|
|
129
129
|
l.line_number,
|
|
130
130
|
l.content,
|
|
131
|
-
vec_distance_cosine(v.embedding, ?
|
|
131
|
+
vec_distance_cosine(v.embedding, ?) AS distance
|
|
132
132
|
FROM vec_lines v
|
|
133
133
|
INNER JOIN lines l ON v.line_id = l.id
|
|
134
134
|
ORDER BY distance
|
|
135
|
-
LIMIT ?
|
|
135
|
+
LIMIT ?
|
|
136
136
|
`);
|
|
137
137
|
const rows = stmt.all([queryEmbedding.buffer, limit]) as Array<{
|
|
138
138
|
file_path: string;
|