@aeriondyseti/vector-memory-mcp 1.1.0-dev.6 → 2.0.0-rc
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/README.md +22 -4
- package/package.json +12 -18
- package/scripts/migrate-from-lancedb.ts +56 -0
- package/scripts/smoke-test.ts +699 -0
- package/scripts/test-runner.ts +11 -1
- package/src/db/connection.ts +18 -4
- package/src/db/conversation.repository.ts +164 -79
- package/src/db/memory.repository.ts +182 -170
- package/src/db/migrations.ts +70 -0
- package/src/db/sqlite-utils.ts +78 -0
- package/src/http/server.ts +40 -35
- package/src/index.ts +33 -3
- package/src/mcp/server.ts +2 -1
- package/src/migration.ts +254 -0
- package/dist/package.json +0 -71
- package/dist/scripts/test-runner.d.ts +0 -9
- package/dist/scripts/test-runner.d.ts.map +0 -1
- package/dist/scripts/test-runner.js +0 -61
- package/dist/scripts/test-runner.js.map +0 -1
- package/dist/scripts/warmup.d.ts +0 -8
- package/dist/scripts/warmup.d.ts.map +0 -1
- package/dist/scripts/warmup.js +0 -61
- package/dist/scripts/warmup.js.map +0 -1
- package/dist/src/config/index.d.ts +0 -41
- package/dist/src/config/index.d.ts.map +0 -1
- package/dist/src/config/index.js +0 -75
- package/dist/src/config/index.js.map +0 -1
- package/dist/src/db/connection.d.ts +0 -3
- package/dist/src/db/connection.d.ts.map +0 -1
- package/dist/src/db/connection.js +0 -10
- package/dist/src/db/connection.js.map +0 -1
- package/dist/src/db/conversation.repository.d.ts +0 -26
- package/dist/src/db/conversation.repository.d.ts.map +0 -1
- package/dist/src/db/conversation.repository.js +0 -73
- package/dist/src/db/conversation.repository.js.map +0 -1
- package/dist/src/db/conversation.schema.d.ts +0 -4
- package/dist/src/db/conversation.schema.d.ts.map +0 -1
- package/dist/src/db/conversation.schema.js +0 -15
- package/dist/src/db/conversation.schema.js.map +0 -1
- package/dist/src/db/lancedb-utils.d.ts +0 -57
- package/dist/src/db/lancedb-utils.d.ts.map +0 -1
- package/dist/src/db/lancedb-utils.js +0 -124
- package/dist/src/db/lancedb-utils.js.map +0 -1
- package/dist/src/db/memory.repository.d.ts +0 -40
- package/dist/src/db/memory.repository.d.ts.map +0 -1
- package/dist/src/db/memory.repository.js +0 -183
- package/dist/src/db/memory.repository.js.map +0 -1
- package/dist/src/db/schema.d.ts +0 -7
- package/dist/src/db/schema.d.ts.map +0 -1
- package/dist/src/db/schema.js +0 -19
- package/dist/src/db/schema.js.map +0 -1
- package/dist/src/http/mcp-transport.d.ts +0 -19
- package/dist/src/http/mcp-transport.d.ts.map +0 -1
- package/dist/src/http/mcp-transport.js +0 -191
- package/dist/src/http/mcp-transport.js.map +0 -1
- package/dist/src/http/server.d.ts +0 -13
- package/dist/src/http/server.d.ts.map +0 -1
- package/dist/src/http/server.js +0 -224
- package/dist/src/http/server.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -68
- package/dist/src/index.js.map +0 -1
- package/dist/src/mcp/handlers.d.ts +0 -15
- package/dist/src/mcp/handlers.d.ts.map +0 -1
- package/dist/src/mcp/handlers.js +0 -313
- package/dist/src/mcp/handlers.js.map +0 -1
- package/dist/src/mcp/server.d.ts +0 -5
- package/dist/src/mcp/server.d.ts.map +0 -1
- package/dist/src/mcp/server.js +0 -22
- package/dist/src/mcp/server.js.map +0 -1
- package/dist/src/mcp/tools.d.ts +0 -13
- package/dist/src/mcp/tools.d.ts.map +0 -1
- package/dist/src/mcp/tools.js +0 -352
- package/dist/src/mcp/tools.js.map +0 -1
- package/dist/src/services/conversation.service.d.ts +0 -38
- package/dist/src/services/conversation.service.d.ts.map +0 -1
- package/dist/src/services/conversation.service.js +0 -252
- package/dist/src/services/conversation.service.js.map +0 -1
- package/dist/src/services/embeddings.service.d.ts +0 -12
- package/dist/src/services/embeddings.service.d.ts.map +0 -1
- package/dist/src/services/embeddings.service.js +0 -37
- package/dist/src/services/embeddings.service.js.map +0 -1
- package/dist/src/services/memory.service.d.ts +0 -40
- package/dist/src/services/memory.service.d.ts.map +0 -1
- package/dist/src/services/memory.service.js +0 -258
- package/dist/src/services/memory.service.js.map +0 -1
- package/dist/src/services/parsers/claude-code.parser.d.ts +0 -8
- package/dist/src/services/parsers/claude-code.parser.d.ts.map +0 -1
- package/dist/src/services/parsers/claude-code.parser.js +0 -191
- package/dist/src/services/parsers/claude-code.parser.js.map +0 -1
- package/dist/src/services/parsers/types.d.ts +0 -9
- package/dist/src/services/parsers/types.d.ts.map +0 -1
- package/dist/src/services/parsers/types.js +0 -2
- package/dist/src/services/parsers/types.js.map +0 -1
- package/dist/src/types/conversation.d.ts +0 -99
- package/dist/src/types/conversation.d.ts.map +0 -1
- package/dist/src/types/conversation.js +0 -2
- package/dist/src/types/conversation.js.map +0 -1
- package/dist/src/types/memory.d.ts +0 -30
- package/dist/src/types/memory.d.ts.map +0 -1
- package/dist/src/types/memory.js +0 -18
- package/dist/src/types/memory.js.map +0 -1
- package/src/db/conversation.schema.ts +0 -33
- package/src/db/lancedb-utils.ts +0 -142
- package/src/db/schema.ts +0 -38
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { TABLE_NAME, memorySchema } from "./schema.js";
|
|
2
|
-
import { arrowTimestampToDate, arrowVectorToArray, createFtsMutex, createRerankerMutex, escapeSql, safeParseJsonObject } from "./lancedb-utils.js";
|
|
3
|
-
import { DELETED_TOMBSTONE, } from "../types/memory.js";
|
|
4
|
-
export class MemoryRepository {
|
|
5
|
-
db;
|
|
6
|
-
// Mutex for schema migration - runs once per instance to add missing columns
|
|
7
|
-
migrationPromise = null;
|
|
8
|
-
// FTS index mutex — once created, the promise is never cleared (index persists in LanceDB)
|
|
9
|
-
ensureFtsIndex;
|
|
10
|
-
// Cached reranker — k=60 is constant, no need to recreate per search
|
|
11
|
-
getReranker = createRerankerMutex();
|
|
12
|
-
constructor(db) {
|
|
13
|
-
this.db = db;
|
|
14
|
-
this.ensureFtsIndex = createFtsMutex(() => this.getTable());
|
|
15
|
-
}
|
|
16
|
-
async getTable() {
|
|
17
|
-
const names = await this.db.tableNames();
|
|
18
|
-
if (names.includes(TABLE_NAME)) {
|
|
19
|
-
const table = await this.db.openTable(TABLE_NAME);
|
|
20
|
-
await this.ensureMigration(table);
|
|
21
|
-
return table;
|
|
22
|
-
}
|
|
23
|
-
// Create with empty data to initialize schema
|
|
24
|
-
return await this.db.createTable(TABLE_NAME, [], { schema: memorySchema });
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Ensures schema migration has run. Uses a mutex pattern identical to ensureFtsIndex.
|
|
28
|
-
* Adds columns introduced after the initial schema (usefulness, access_count, last_accessed).
|
|
29
|
-
*/
|
|
30
|
-
ensureMigration(table) {
|
|
31
|
-
if (this.migrationPromise) {
|
|
32
|
-
return this.migrationPromise;
|
|
33
|
-
}
|
|
34
|
-
this.migrationPromise = this.migrateSchemaIfNeeded(table).catch((error) => {
|
|
35
|
-
this.migrationPromise = null;
|
|
36
|
-
throw error;
|
|
37
|
-
});
|
|
38
|
-
return this.migrationPromise;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Inspects the existing table schema and adds any missing columns with safe defaults.
|
|
42
|
-
* This handles databases created before the hybrid memory system was introduced.
|
|
43
|
-
*/
|
|
44
|
-
async migrateSchemaIfNeeded(table) {
|
|
45
|
-
const schema = await table.schema();
|
|
46
|
-
const existingFields = new Set(schema.fields.map((f) => f.name));
|
|
47
|
-
const migrations = [];
|
|
48
|
-
if (!existingFields.has("usefulness")) {
|
|
49
|
-
migrations.push({ name: "usefulness", valueSql: "cast(0.0 as float)" });
|
|
50
|
-
}
|
|
51
|
-
if (!existingFields.has("access_count")) {
|
|
52
|
-
migrations.push({ name: "access_count", valueSql: "cast(0 as int)" });
|
|
53
|
-
}
|
|
54
|
-
if (!existingFields.has("last_accessed")) {
|
|
55
|
-
migrations.push({ name: "last_accessed", valueSql: "cast(NULL as timestamp)" });
|
|
56
|
-
}
|
|
57
|
-
if (migrations.length > 0) {
|
|
58
|
-
await table.addColumns(migrations);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Converts a raw LanceDB row to a Memory object.
|
|
63
|
-
*/
|
|
64
|
-
rowToMemory(row) {
|
|
65
|
-
return {
|
|
66
|
-
id: row.id,
|
|
67
|
-
content: row.content,
|
|
68
|
-
embedding: arrowVectorToArray(row.vector),
|
|
69
|
-
metadata: safeParseJsonObject(row.metadata),
|
|
70
|
-
createdAt: arrowTimestampToDate(row.created_at),
|
|
71
|
-
updatedAt: arrowTimestampToDate(row.updated_at),
|
|
72
|
-
supersededBy: row.superseded_by,
|
|
73
|
-
usefulness: row.usefulness ?? 0,
|
|
74
|
-
accessCount: row.access_count ?? 0,
|
|
75
|
-
lastAccessed: row.last_accessed
|
|
76
|
-
? arrowTimestampToDate(row.last_accessed)
|
|
77
|
-
: null,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
async insert(memory) {
|
|
81
|
-
const table = await this.getTable();
|
|
82
|
-
await table.add([
|
|
83
|
-
{
|
|
84
|
-
id: memory.id,
|
|
85
|
-
vector: memory.embedding,
|
|
86
|
-
content: memory.content,
|
|
87
|
-
metadata: JSON.stringify(memory.metadata),
|
|
88
|
-
created_at: memory.createdAt.getTime(),
|
|
89
|
-
updated_at: memory.updatedAt.getTime(),
|
|
90
|
-
superseded_by: memory.supersededBy,
|
|
91
|
-
usefulness: memory.usefulness,
|
|
92
|
-
access_count: memory.accessCount,
|
|
93
|
-
last_accessed: memory.lastAccessed?.getTime() ?? null,
|
|
94
|
-
},
|
|
95
|
-
]);
|
|
96
|
-
}
|
|
97
|
-
async upsert(memory) {
|
|
98
|
-
const table = await this.getTable();
|
|
99
|
-
const existing = await table.query().where(`id = '${escapeSql(memory.id)}'`).limit(1).toArray();
|
|
100
|
-
if (existing.length === 0) {
|
|
101
|
-
return await this.insert(memory);
|
|
102
|
-
}
|
|
103
|
-
await table.update({
|
|
104
|
-
where: `id = '${escapeSql(memory.id)}'`,
|
|
105
|
-
values: {
|
|
106
|
-
vector: memory.embedding,
|
|
107
|
-
content: memory.content,
|
|
108
|
-
metadata: JSON.stringify(memory.metadata),
|
|
109
|
-
created_at: memory.createdAt.getTime(),
|
|
110
|
-
updated_at: memory.updatedAt.getTime(),
|
|
111
|
-
superseded_by: memory.supersededBy,
|
|
112
|
-
usefulness: memory.usefulness,
|
|
113
|
-
access_count: memory.accessCount,
|
|
114
|
-
last_accessed: memory.lastAccessed?.getTime() ?? null,
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
async findById(id) {
|
|
119
|
-
const table = await this.getTable();
|
|
120
|
-
const results = await table.query().where(`id = '${escapeSql(id)}'`).limit(1).toArray();
|
|
121
|
-
if (results.length === 0) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
return this.rowToMemory(results[0]);
|
|
125
|
-
}
|
|
126
|
-
async findByIds(ids) {
|
|
127
|
-
if (ids.length === 0)
|
|
128
|
-
return [];
|
|
129
|
-
const table = await this.getTable();
|
|
130
|
-
const inList = ids.map((id) => `'${escapeSql(id)}'`).join(", ");
|
|
131
|
-
const results = await table
|
|
132
|
-
.query()
|
|
133
|
-
.where(`id IN (${inList})`)
|
|
134
|
-
.toArray();
|
|
135
|
-
return results.map((row) => this.rowToMemory(row));
|
|
136
|
-
}
|
|
137
|
-
async markDeleted(id) {
|
|
138
|
-
const table = await this.getTable();
|
|
139
|
-
// Verify existence first to match previous behavior (return false if not found)
|
|
140
|
-
const existing = await table.query().where(`id = '${escapeSql(id)}'`).limit(1).toArray();
|
|
141
|
-
if (existing.length === 0) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
const now = Date.now();
|
|
145
|
-
await table.update({
|
|
146
|
-
where: `id = '${escapeSql(id)}'`,
|
|
147
|
-
values: {
|
|
148
|
-
superseded_by: DELETED_TOMBSTONE,
|
|
149
|
-
updated_at: now,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Performs hybrid search combining vector similarity and full-text search.
|
|
156
|
-
* Uses RRF (Reciprocal Rank Fusion) to combine rankings from both search methods.
|
|
157
|
-
*
|
|
158
|
-
* @param embedding - Query embedding vector
|
|
159
|
-
* @param query - Text query for full-text search
|
|
160
|
-
* @param limit - Maximum number of results to return
|
|
161
|
-
* @returns Array of HybridRow containing full Memory data plus RRF score
|
|
162
|
-
*/
|
|
163
|
-
async findHybrid(embedding, query, limit) {
|
|
164
|
-
await this.ensureFtsIndex();
|
|
165
|
-
const table = await this.getTable();
|
|
166
|
-
const reranker = await this.getReranker();
|
|
167
|
-
const results = await table
|
|
168
|
-
.query()
|
|
169
|
-
.nearestTo(embedding)
|
|
170
|
-
.fullTextSearch(query)
|
|
171
|
-
.rerank(reranker)
|
|
172
|
-
.limit(limit)
|
|
173
|
-
.toArray();
|
|
174
|
-
return results.map((row) => {
|
|
175
|
-
const memory = this.rowToMemory(row);
|
|
176
|
-
return {
|
|
177
|
-
...memory,
|
|
178
|
-
rrfScore: row._relevance_score ?? 0,
|
|
179
|
-
};
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
//# sourceMappingURL=memory.repository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory.repository.js","sourceRoot":"","sources":["../../../src/db/memory.repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACnJ,OAAO,EAGL,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,gBAAgB;IAUP;IATpB,6EAA6E;IACrE,gBAAgB,GAAyB,IAAI,CAAC;IAEtD,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CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1C,MAAM,OAAO,GAAG,MAAM,KAAK;aACxB,KAAK,EAAE;aACP,SAAS,CAAC,SAAS,CAAC;aACpB,cAAc,CAAC,KAAK,CAAC;aACrB,MAAM,CAAC,QAAQ,CAAC;aAChB,KAAK,CAAC,KAAK,CAAC;aACZ,OAAO,EAAE,CAAC;QAEb,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACzB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAA8B,CAAC,CAAC;YAChE,OAAO;gBACL,GAAG,MAAM;gBACT,QAAQ,EAAG,GAAG,CAAC,gBAA2B,IAAI,CAAC;aAChD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/src/db/schema.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Schema, Field, FixedSizeList, Float32, Timestamp } from "apache-arrow";
|
|
2
|
-
export declare const EMBEDDING_DIMENSION = 384;
|
|
3
|
-
export declare const vectorField: () => Field<FixedSizeList<Float32>>;
|
|
4
|
-
export declare const timestampField: (name: string, nullable?: boolean) => Field<Timestamp<import("apache-arrow").Type.Timestamp | import("apache-arrow").Type.TimestampSecond | import("apache-arrow").Type.TimestampMillisecond | import("apache-arrow").Type.TimestampMicrosecond | import("apache-arrow").Type.TimestampNanosecond>>;
|
|
5
|
-
export declare const TABLE_NAME = "memories";
|
|
6
|
-
export declare const memorySchema: Schema<any>;
|
|
7
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/db/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EACL,aAAa,EACb,OAAO,EAEP,SAAS,EAGV,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,eAAO,MAAM,WAAW,qCAKrB,CAAC;AAEJ,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,kBAAgB,kQACU,CAAC;AAExE,eAAO,MAAM,UAAU,aAAa,CAAC;AAErC,eAAO,MAAM,YAAY,aAWvB,CAAC"}
|
package/dist/src/db/schema.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Schema, Field, FixedSizeList, Float32, Utf8, Timestamp, TimeUnit, Int32, } from "apache-arrow";
|
|
2
|
-
// Shared field helpers — used by both memory and conversation history schemas
|
|
3
|
-
export const EMBEDDING_DIMENSION = 384;
|
|
4
|
-
export const vectorField = () => new Field("vector", new FixedSizeList(EMBEDDING_DIMENSION, new Field("item", new Float32())), false);
|
|
5
|
-
export const timestampField = (name, nullable = false) => new Field(name, new Timestamp(TimeUnit.MILLISECOND, "UTC"), nullable);
|
|
6
|
-
export const TABLE_NAME = "memories";
|
|
7
|
-
export const memorySchema = new Schema([
|
|
8
|
-
new Field("id", new Utf8(), false),
|
|
9
|
-
vectorField(),
|
|
10
|
-
new Field("content", new Utf8(), false),
|
|
11
|
-
new Field("metadata", new Utf8(), false), // JSON string
|
|
12
|
-
timestampField("created_at"),
|
|
13
|
-
timestampField("updated_at"),
|
|
14
|
-
new Field("superseded_by", new Utf8(), true), // Nullable
|
|
15
|
-
new Field("usefulness", new Float32(), false),
|
|
16
|
-
new Field("access_count", new Int32(), false),
|
|
17
|
-
timestampField("last_accessed", true),
|
|
18
|
-
]);
|
|
19
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/db/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,EACL,aAAa,EACb,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,GACN,MAAM,cAAc,CAAC;AAEtB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TP Transport Handler
|
|
3
|
-
*
|
|
4
|
-
* Provides StreamableHTTP transport for MCP over HTTP.
|
|
5
|
-
* and other HTTP-based MCP clients to connect to the memory server.
|
|
6
|
-
*
|
|
7
|
-
* This implementation handles the MCP protocol directly using Hono's streaming
|
|
8
|
-
* capabilities, since StreamableHTTPServerTransport expects Node.js req/res objects.
|
|
9
|
-
*/
|
|
10
|
-
import { Hono } from "hono";
|
|
11
|
-
import type { MemoryService } from "../services/memory.service.js";
|
|
12
|
-
/**
|
|
13
|
-
* Creates MCP routes for a Hono app.
|
|
14
|
-
*
|
|
15
|
-
* Uses InMemoryTransport internally and bridges to HTTP/SSE manually,
|
|
16
|
-
* since StreamableHTTPServerTransport requires Node.js req/res objects.
|
|
17
|
-
*/
|
|
18
|
-
export declare function createMcpRoutes(memoryService: MemoryService): Hono;
|
|
19
|
-
//# sourceMappingURL=mcp-transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-transport.d.ts","sourceRoot":"","sources":["../../../src/http/mcp-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAe5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAUnE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAkLlE"}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP HTTP Transport Handler
|
|
3
|
-
*
|
|
4
|
-
* Provides StreamableHTTP transport for MCP over HTTP.
|
|
5
|
-
* and other HTTP-based MCP clients to connect to the memory server.
|
|
6
|
-
*
|
|
7
|
-
* This implementation handles the MCP protocol directly using Hono's streaming
|
|
8
|
-
* capabilities, since StreamableHTTPServerTransport expects Node.js req/res objects.
|
|
9
|
-
*/
|
|
10
|
-
import { Hono } from "hono";
|
|
11
|
-
import { streamSSE } from "hono/streaming";
|
|
12
|
-
import { randomUUID } from "node:crypto";
|
|
13
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
14
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
15
|
-
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
16
|
-
import { tools } from "../mcp/tools.js";
|
|
17
|
-
import { handleToolCall } from "../mcp/handlers.js";
|
|
18
|
-
/**
|
|
19
|
-
* Creates MCP routes for a Hono app.
|
|
20
|
-
*
|
|
21
|
-
* Uses InMemoryTransport internally and bridges to HTTP/SSE manually,
|
|
22
|
-
* since StreamableHTTPServerTransport requires Node.js req/res objects.
|
|
23
|
-
*/
|
|
24
|
-
export function createMcpRoutes(memoryService) {
|
|
25
|
-
const app = new Hono();
|
|
26
|
-
// Store active sessions by session ID
|
|
27
|
-
const sessions = new Map();
|
|
28
|
-
/**
|
|
29
|
-
* Creates a new MCP server instance configured with memory tools.
|
|
30
|
-
*/
|
|
31
|
-
async function createSession() {
|
|
32
|
-
const server = new Server({ name: "vector-memory-mcp", version: "0.6.0" }, { capabilities: { tools: {} } });
|
|
33
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
34
|
-
return { tools };
|
|
35
|
-
});
|
|
36
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
37
|
-
const { name, arguments: args } = request.params;
|
|
38
|
-
return handleToolCall(name, args, memoryService);
|
|
39
|
-
});
|
|
40
|
-
// Create linked in-memory transports
|
|
41
|
-
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
42
|
-
// Connect server to its transport
|
|
43
|
-
await server.connect(serverTransport);
|
|
44
|
-
const session = {
|
|
45
|
-
server,
|
|
46
|
-
serverTransport,
|
|
47
|
-
clientTransport,
|
|
48
|
-
pendingResponses: new Map(),
|
|
49
|
-
sseClients: new Set(),
|
|
50
|
-
};
|
|
51
|
-
// Handle messages from server (responses and notifications)
|
|
52
|
-
clientTransport.onmessage = (message) => {
|
|
53
|
-
// Check if this is a response to a pending request
|
|
54
|
-
if ("id" in message && message.id !== undefined) {
|
|
55
|
-
const resolver = session.pendingResponses.get(message.id);
|
|
56
|
-
if (resolver) {
|
|
57
|
-
resolver(message);
|
|
58
|
-
session.pendingResponses.delete(message.id);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// Otherwise, broadcast to SSE clients (notifications)
|
|
63
|
-
for (const sendToClient of session.sseClients) {
|
|
64
|
-
sendToClient(message);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
return session;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Handle POST requests - session initialization and message handling
|
|
71
|
-
*/
|
|
72
|
-
app.post("/mcp", async (c) => {
|
|
73
|
-
const sessionId = c.req.header("mcp-session-id");
|
|
74
|
-
const body = await c.req.json();
|
|
75
|
-
let session;
|
|
76
|
-
let newSessionId;
|
|
77
|
-
if (sessionId && sessions.has(sessionId)) {
|
|
78
|
-
// Reuse existing session
|
|
79
|
-
session = sessions.get(sessionId);
|
|
80
|
-
}
|
|
81
|
-
else if (isInitializeRequest(body)) {
|
|
82
|
-
// New session initialization
|
|
83
|
-
newSessionId = randomUUID();
|
|
84
|
-
session = await createSession();
|
|
85
|
-
sessions.set(newSessionId, session);
|
|
86
|
-
console.error(`[vector-memory-mcp] MCP session initialized: ${newSessionId}`);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
// Invalid request - no session ID and not an initialize request
|
|
90
|
-
return c.json({
|
|
91
|
-
jsonrpc: "2.0",
|
|
92
|
-
error: {
|
|
93
|
-
code: -32000,
|
|
94
|
-
message: "Invalid session. Send initialize request without session ID to start.",
|
|
95
|
-
},
|
|
96
|
-
id: body.id ?? null,
|
|
97
|
-
}, 400);
|
|
98
|
-
}
|
|
99
|
-
// Send message to server and wait for response
|
|
100
|
-
const response = await sendAndWaitForResponse(session, body);
|
|
101
|
-
// Include session ID header for new sessions
|
|
102
|
-
if (newSessionId) {
|
|
103
|
-
c.header("mcp-session-id", newSessionId);
|
|
104
|
-
}
|
|
105
|
-
return c.json(response);
|
|
106
|
-
});
|
|
107
|
-
/**
|
|
108
|
-
* Handle GET requests - SSE stream for server-to-client notifications
|
|
109
|
-
*/
|
|
110
|
-
app.get("/mcp", async (c) => {
|
|
111
|
-
const sessionId = c.req.header("mcp-session-id");
|
|
112
|
-
if (!sessionId || !sessions.has(sessionId)) {
|
|
113
|
-
return c.json({
|
|
114
|
-
jsonrpc: "2.0",
|
|
115
|
-
error: { code: -32000, message: "Invalid or missing session ID" },
|
|
116
|
-
id: null,
|
|
117
|
-
}, 400);
|
|
118
|
-
}
|
|
119
|
-
const session = sessions.get(sessionId);
|
|
120
|
-
return streamSSE(c, async (stream) => {
|
|
121
|
-
// Register this SSE client
|
|
122
|
-
const sendMessage = (message) => {
|
|
123
|
-
stream.writeSSE({
|
|
124
|
-
data: JSON.stringify(message),
|
|
125
|
-
event: "message",
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
session.sseClients.add(sendMessage);
|
|
129
|
-
// Keep connection open
|
|
130
|
-
try {
|
|
131
|
-
// Send a ping every 30 seconds to keep connection alive
|
|
132
|
-
while (true) {
|
|
133
|
-
await stream.sleep(30000);
|
|
134
|
-
await stream.writeSSE({ event: "ping", data: "" });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
finally {
|
|
138
|
-
session.sseClients.delete(sendMessage);
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
/**
|
|
143
|
-
* Handle DELETE requests - session termination
|
|
144
|
-
*/
|
|
145
|
-
app.delete("/mcp", async (c) => {
|
|
146
|
-
const sessionId = c.req.header("mcp-session-id");
|
|
147
|
-
if (!sessionId || !sessions.has(sessionId)) {
|
|
148
|
-
return c.json({
|
|
149
|
-
jsonrpc: "2.0",
|
|
150
|
-
error: { code: -32000, message: "Invalid or missing session ID" },
|
|
151
|
-
id: null,
|
|
152
|
-
}, 400);
|
|
153
|
-
}
|
|
154
|
-
const session = sessions.get(sessionId);
|
|
155
|
-
// Close transports
|
|
156
|
-
await session.clientTransport.close();
|
|
157
|
-
await session.serverTransport.close();
|
|
158
|
-
await session.server.close();
|
|
159
|
-
sessions.delete(sessionId);
|
|
160
|
-
console.error(`[vector-memory-mcp] MCP session closed: ${sessionId}`);
|
|
161
|
-
return c.json({ success: true });
|
|
162
|
-
});
|
|
163
|
-
return app;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Send a message to the server and wait for its response.
|
|
167
|
-
*/
|
|
168
|
-
async function sendAndWaitForResponse(session, message) {
|
|
169
|
-
return new Promise((resolve) => {
|
|
170
|
-
// Register response handler for requests (messages with id)
|
|
171
|
-
if ("id" in message && message.id !== undefined) {
|
|
172
|
-
session.pendingResponses.set(message.id, resolve);
|
|
173
|
-
}
|
|
174
|
-
// Send message to server
|
|
175
|
-
session.clientTransport.send(message);
|
|
176
|
-
// For notifications (no id), resolve immediately with empty response
|
|
177
|
-
if (!("id" in message) || message.id === undefined) {
|
|
178
|
-
resolve({ jsonrpc: "2.0" });
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Check if a message is an initialize request.
|
|
184
|
-
*/
|
|
185
|
-
function isInitializeRequest(body) {
|
|
186
|
-
return (typeof body === "object" &&
|
|
187
|
-
body !== null &&
|
|
188
|
-
"method" in body &&
|
|
189
|
-
body.method === "initialize");
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=mcp-transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-transport.js","sourceRoot":"","sources":["../../../src/http/mcp-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAA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Aa;IACxC,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QACf,IAA2B,CAAC,MAAM,KAAK,YAAY,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import type { MemoryService } from "../services/memory.service.js";
|
|
3
|
-
import type { Config } from "../config/index.js";
|
|
4
|
-
export interface HttpServerOptions {
|
|
5
|
-
memoryService: MemoryService;
|
|
6
|
-
config: Config;
|
|
7
|
-
}
|
|
8
|
-
export declare function createHttpApp(memoryService: MemoryService, config: Config): Hono;
|
|
9
|
-
export declare function startHttpServer(memoryService: MemoryService, config: Config): Promise<{
|
|
10
|
-
stop: () => void;
|
|
11
|
-
port: number;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/http/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAqDjD,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,wBAAgB,aAAa,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA2KhF;AAED,wBAAsB,eAAe,CACnC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAuC7C"}
|