@cognistore/mcp-server 1.0.15 → 1.2.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/dist/index.js +42 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -407,6 +407,7 @@ function createPlansEmbeddingsTable(sqlite, dimensions = DEFAULT_EMBEDDING_DIMEN
|
|
|
407
407
|
|
|
408
408
|
// ../../packages/core/dist/repositories/knowledge.repository.js
|
|
409
409
|
import { eq, ne, sql, and, or, isNull } from "drizzle-orm";
|
|
410
|
+
var OPERATIONS_RETENTION_DAYS = 30;
|
|
410
411
|
var KnowledgeRepository = class {
|
|
411
412
|
db;
|
|
412
413
|
sqlite;
|
|
@@ -796,7 +797,7 @@ var KnowledgeRepository = class {
|
|
|
796
797
|
return Object.entries(map).map(([date, counts]) => ({ date, ...counts }));
|
|
797
798
|
}
|
|
798
799
|
cleanupOldOperations() {
|
|
799
|
-
const cutoff = new Date(Date.now() -
|
|
800
|
+
const cutoff = new Date(Date.now() - OPERATIONS_RETENTION_DAYS * 24 * 60 * 60 * 1e3).toISOString();
|
|
800
801
|
return this.sqlite.prepare("DELETE FROM operations_log WHERE created_at < ?").run(cutoff).changes;
|
|
801
802
|
}
|
|
802
803
|
/**
|
|
@@ -1311,7 +1312,8 @@ var OllamaEmbeddingClient = class {
|
|
|
1311
1312
|
async embed(text2) {
|
|
1312
1313
|
const body = {
|
|
1313
1314
|
model: this.model,
|
|
1314
|
-
prompt: this.truncateText(text2, this.maxInputChars)
|
|
1315
|
+
prompt: this.truncateText(text2, this.maxInputChars),
|
|
1316
|
+
options: { num_ctx: 8192 }
|
|
1315
1317
|
};
|
|
1316
1318
|
const response = await this.fetchWithRetry(`${this.host}/api/embeddings`, {
|
|
1317
1319
|
method: "POST",
|
|
@@ -2241,6 +2243,44 @@ function createServer(sdk) {
|
|
|
2241
2243
|
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
2242
2244
|
}
|
|
2243
2245
|
);
|
|
2246
|
+
server.tool(
|
|
2247
|
+
"listPlans",
|
|
2248
|
+
"List plans with optional status/scope filters. Shows task progress per plan \u2014 use to find abandoned or in-progress plans.",
|
|
2249
|
+
{
|
|
2250
|
+
limit: z2.number().optional().describe("Max plans to return (default: 20)"),
|
|
2251
|
+
status: z2.enum(knowledgeStatusValues).optional().describe("Filter: draft, active, completed, archived"),
|
|
2252
|
+
scope: z2.string().optional().describe('Filter by scope (e.g. "workspace:my-project")')
|
|
2253
|
+
},
|
|
2254
|
+
READ_ONLY,
|
|
2255
|
+
async (params) => {
|
|
2256
|
+
const plans = sdk.listPlans(params.limit ?? 20, params.status, params.scope);
|
|
2257
|
+
const enriched = plans.map((plan) => {
|
|
2258
|
+
const tasks = sdk.listPlanTasks(plan.id);
|
|
2259
|
+
const completedTasks = tasks.filter((t) => t.status === "completed").length;
|
|
2260
|
+
return {
|
|
2261
|
+
id: plan.id,
|
|
2262
|
+
title: plan.title,
|
|
2263
|
+
status: plan.status,
|
|
2264
|
+
scope: plan.scope,
|
|
2265
|
+
taskCount: tasks.length,
|
|
2266
|
+
completedTasks,
|
|
2267
|
+
createdAt: plan.createdAt,
|
|
2268
|
+
updatedAt: plan.updatedAt
|
|
2269
|
+
};
|
|
2270
|
+
});
|
|
2271
|
+
const abandoned = enriched.filter(
|
|
2272
|
+
(p) => (p.status === "draft" || p.status === "active") && p.completedTasks < p.taskCount
|
|
2273
|
+
);
|
|
2274
|
+
const response = {
|
|
2275
|
+
plans: enriched,
|
|
2276
|
+
total: enriched.length
|
|
2277
|
+
};
|
|
2278
|
+
if (abandoned.length > 0) {
|
|
2279
|
+
response.hint = `${abandoned.length} plan(s) have incomplete tasks. Resume them with listPlanTasks(planId).`;
|
|
2280
|
+
}
|
|
2281
|
+
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
2282
|
+
}
|
|
2283
|
+
);
|
|
2244
2284
|
server.resource(
|
|
2245
2285
|
"knowledge-context",
|
|
2246
2286
|
new ResourceTemplate("cognistore://context/{scope}", { list: void 0 }),
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognistore/mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MCP server for CogniStore — integrates with Claude Code and GitHub Copilot",
|
|
7
|
-
"license": "
|
|
7
|
+
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/Sithion/cognistore.git",
|