@smartergpt/lex-mcp 2.2.0 → 2.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.
Files changed (3) hide show
  1. package/README.md +4 -1
  2. package/index.mjs +25 -4
  3. package/package.json +9 -4
package/README.md CHANGED
@@ -53,7 +53,7 @@ Add to `claude_desktop_config.json`:
53
53
 
54
54
  ## Tools
55
55
 
56
- This MCP server provides 11 tools for episodic memory management:
56
+ This MCP server provides 14 tools for episodic memory management:
57
57
 
58
58
  - `frame_create` - Store episodic memory snapshot
59
59
  - `frame_search` - Search frames by reference, branch, or ticket
@@ -66,6 +66,9 @@ This MCP server provides 11 tools for episodic memory management:
66
66
  - `system_introspect` - Discover Lex capabilities and state
67
67
  - `help` - Usage help and examples
68
68
  - `hints_get` - Retrieve error recovery hints
69
+ - `contradictions_scan` - Detect conflicting information across frames
70
+ - `db_stats` - Database statistics and activity metrics
71
+ - `turncost_calculate` - Turn Cost governance metrics
69
72
 
70
73
  ## Learn More
71
74
 
package/index.mjs CHANGED
@@ -15,7 +15,8 @@
15
15
  */
16
16
 
17
17
  import { MCPServer } from "@smartergpt/lex/mcp-server";
18
- import { join } from "path";
18
+ import { join, dirname } from "path";
19
+ import { mkdirSync } from "fs";
19
20
 
20
21
  // Workspace root defaults to current working directory
21
22
  const repoRoot = process.env.LEX_WORKSPACE_ROOT || process.cwd();
@@ -29,6 +30,13 @@ if (!process.env.LEX_WORKSPACE_ROOT) {
29
30
  const dbPath =
30
31
  process.env.LEX_MEMORY_DB || join(repoRoot, ".smartergpt", "lex", "lex.db");
31
32
 
33
+ // Ensure the database directory exists (first-time setup)
34
+ try {
35
+ mkdirSync(dirname(dbPath), { recursive: true });
36
+ } catch {
37
+ // Ignore — directory may already exist or be read-only
38
+ }
39
+
32
40
  // Initialize MCP server
33
41
  let mcpServer;
34
42
  try {
@@ -42,6 +50,10 @@ try {
42
50
  process.exit(1);
43
51
  }
44
52
 
53
+ if (process.env.LEX_DEBUG) {
54
+ console.error(`[LEX-MCP] Ready (stdio mode)`);
55
+ }
56
+
45
57
  // MCP stdio protocol handler (JSON-RPC 2.0 over newline-delimited JSON)
46
58
  process.stdin.setEncoding("utf8");
47
59
  let buffer = "";
@@ -57,6 +69,15 @@ process.stdin.on("data", async (chunk) => {
57
69
  let request;
58
70
  try {
59
71
  request = JSON.parse(line);
72
+
73
+ // MCP notifications have no `id` — silently ignore them per spec
74
+ if (request.id === undefined || request.id === null) {
75
+ if (process.env.LEX_DEBUG) {
76
+ console.error(`[LEX-MCP] Notification: ${request.method}`);
77
+ }
78
+ continue;
79
+ }
80
+
60
81
  const response = await mcpServer.handleRequest(request);
61
82
 
62
83
  // MCP protocol response format
@@ -66,7 +87,7 @@ process.stdin.on("data", async (chunk) => {
66
87
  jsonrpc: "2.0",
67
88
  id: request.id,
68
89
  error: response.error,
69
- })
90
+ }),
70
91
  );
71
92
  } else {
72
93
  console.log(
@@ -74,7 +95,7 @@ process.stdin.on("data", async (chunk) => {
74
95
  jsonrpc: "2.0",
75
96
  id: request.id,
76
97
  result: response,
77
- })
98
+ }),
78
99
  );
79
100
  }
80
101
  } catch (error) {
@@ -86,7 +107,7 @@ process.stdin.on("data", async (chunk) => {
86
107
  message: error.message,
87
108
  code: error.code || "PARSE_ERROR",
88
109
  },
89
- })
110
+ }),
90
111
  );
91
112
  }
92
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartergpt/lex-mcp",
3
- "version": "2.2.0",
3
+ "version": "2.5.2",
4
4
  "description": "MCP server for Lex episodic memory - stdio transport wrapper",
5
5
  "mcpName": "dev.smartergpt/lex",
6
6
  "type": "module",
@@ -9,8 +9,14 @@
9
9
  "index.mjs",
10
10
  "README.md"
11
11
  ],
12
+ "scripts": {
13
+ "test:mcp": "node test-mcp-server.mjs --local --clean",
14
+ "test:mcp:verbose": "node test-mcp-server.mjs --local --clean --verbose",
15
+ "test:published": "node test-mcp-server.mjs --clean",
16
+ "link:local": "rm -rf node_modules/@smartergpt/lex && mkdir -p node_modules/@smartergpt && ln -s /srv/lex-mcp/lex node_modules/@smartergpt/lex"
17
+ },
12
18
  "dependencies": {
13
- "@smartergpt/lex": "^2.2.0"
19
+ "@smartergpt/lex": "^2.5.1"
14
20
  },
15
21
  "publishConfig": {
16
22
  "access": "public",
@@ -18,8 +24,7 @@
18
24
  },
19
25
  "repository": {
20
26
  "type": "git",
21
- "url": "https://github.com/Guffawaffle/lex.git",
22
- "directory": "lex-mcp"
27
+ "url": "https://github.com/Guffawaffle/lex-mcp.git"
23
28
  },
24
29
  "keywords": [
25
30
  "mcp",