cf-memory-mcp 3.0.0 → 3.1.0

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 (2) hide show
  1. package/bin/cf-memory-mcp.js +30 -13
  2. package/package.json +19 -7
@@ -19,7 +19,8 @@ const os = require('os');
19
19
  const process = require('process');
20
20
 
21
21
  // Configuration
22
- const SERVER_URL = 'https://cf-memory-mcp.johnlam90.workers.dev/mcp/message';
22
+ const STREAMABLE_HTTP_URL = 'https://cf-memory-mcp.johnlam90.workers.dev/mcp';
23
+ const LEGACY_SERVER_URL = 'https://cf-memory-mcp.johnlam90.workers.dev/mcp/message';
23
24
  const PACKAGE_VERSION = require('../package.json').version;
24
25
  const TIMEOUT_MS = 30000;
25
26
  const CONNECT_TIMEOUT_MS = 10000;
@@ -33,9 +34,11 @@ const API_KEY = process.env.CF_MEMORY_API_KEY;
33
34
  */
34
35
  class CFMemoryMCP {
35
36
  constructor() {
36
- this.serverUrl = SERVER_URL;
37
+ this.streamableHttpUrl = STREAMABLE_HTTP_URL;
38
+ this.legacyServerUrl = LEGACY_SERVER_URL;
37
39
  this.userAgent = `cf-memory-mcp/${PACKAGE_VERSION} (${os.platform()} ${os.arch()}; Node.js ${process.version})`;
38
-
40
+ this.useStreamableHttp = true; // Try Streamable HTTP first
41
+
39
42
  // Handle process termination gracefully
40
43
  process.on('SIGINT', () => this.shutdown('SIGINT'));
41
44
  process.on('SIGTERM', () => this.shutdown('SIGTERM'));
@@ -43,13 +46,14 @@ class CFMemoryMCP {
43
46
  this.logError('Uncaught exception:', error);
44
47
  this.shutdown('ERROR');
45
48
  });
46
-
49
+
47
50
  // Set up stdio encoding
48
51
  process.stdin.setEncoding('utf8');
49
52
  process.stdout.setEncoding('utf8');
50
-
53
+
51
54
  this.logDebug('CF Memory MCP server starting...');
52
- this.logDebug(`Server URL: ${this.serverUrl}`);
55
+ this.logDebug(`Streamable HTTP URL: ${this.streamableHttpUrl}`);
56
+ this.logDebug(`Legacy Server URL: ${this.legacyServerUrl}`);
53
57
  this.logDebug(`User Agent: ${this.userAgent}`);
54
58
  }
55
59
 
@@ -92,13 +96,13 @@ class CFMemoryMCP {
92
96
  */
93
97
  async testConnectivity() {
94
98
  this.logDebug('Testing connectivity to Cloudflare Worker...');
95
-
99
+
96
100
  const testMessage = {
97
101
  jsonrpc: '2.0',
98
102
  id: 'connectivity-test',
99
103
  method: 'initialize',
100
104
  params: {
101
- protocolVersion: '2024-11-05',
105
+ protocolVersion: '2025-03-26',
102
106
  capabilities: { tools: {} },
103
107
  clientInfo: {
104
108
  name: 'cf-memory-mcp',
@@ -106,15 +110,27 @@ class CFMemoryMCP {
106
110
  }
107
111
  }
108
112
  };
109
-
113
+
110
114
  try {
115
+ // Try Streamable HTTP first
111
116
  const response = await this.makeRequest(testMessage);
112
117
  if (response.error) {
113
118
  throw new Error(`Server responded with error: ${response.error.message}`);
114
119
  }
115
- this.logDebug('Connectivity test successful');
120
+ this.logDebug('Connectivity test successful with Streamable HTTP');
116
121
  } catch (error) {
117
- throw new Error(`Cannot connect to CF Memory server: ${error.message}`);
122
+ // If Streamable HTTP fails, try legacy endpoint
123
+ this.logDebug('Streamable HTTP failed, trying legacy endpoint...');
124
+ this.useStreamableHttp = false;
125
+ try {
126
+ const response = await this.makeRequest(testMessage);
127
+ if (response.error) {
128
+ throw new Error(`Server responded with error: ${response.error.message}`);
129
+ }
130
+ this.logDebug('Connectivity test successful with legacy endpoint');
131
+ } catch (legacyError) {
132
+ throw new Error(`Cannot connect to CF Memory server: ${error.message} (Legacy also failed: ${legacyError.message})`);
133
+ }
118
134
  }
119
135
  }
120
136
 
@@ -183,7 +199,8 @@ class CFMemoryMCP {
183
199
  */
184
200
  async makeRequest(message) {
185
201
  return new Promise((resolve) => {
186
- const url = new URL(this.serverUrl);
202
+ const serverUrl = this.useStreamableHttp ? this.streamableHttpUrl : this.legacyServerUrl;
203
+ const url = new URL(serverUrl);
187
204
  const postData = JSON.stringify(message);
188
205
 
189
206
  const options = {
@@ -234,7 +251,7 @@ class CFMemoryMCP {
234
251
  error: {
235
252
  code: -32603,
236
253
  message: 'Network error',
237
- data: `Failed to connect to ${this.serverUrl}: ${error.message}`
254
+ data: `Failed to connect to ${serverUrl}: ${error.message}`
238
255
  }
239
256
  });
240
257
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Best-in-class MCP (Model Context Protocol) server for AI memory storage with MIRIX-Inspired Specialized Memory Types (Core, Episodic, Semantic, Procedural, Resource, Knowledge Vault), Progressive Disclosure, AI-Powered Summaries, Context Window Optimization, Summary Memory Feature (TL;DR), Enhanced JSON Processing, Temporal Relationship Tracking, AI-Enhanced Context-Aware + Temporal Intelligence, Smart Tool Recommendation Engine, Memory Intelligence Engine, autonomous optimization, A/B testing, self-improving algorithms, intelligent search, smart auto-features, memory collections, project onboarding workflows, advanced lifecycle management, Project Intelligence for seamless agent handoff, and Unified Project Intelligence Tool with 57% performance improvement",
5
5
  "main": "bin/cf-memory-mcp.js",
6
6
  "bin": {
@@ -86,23 +86,30 @@
86
86
  },
87
87
  "scripts": {
88
88
  "start": "node bin/cf-memory-mcp.js",
89
- "test": "node test/test-package.js",
89
+ "test": "jest",
90
+ "test:watch": "jest --watch",
91
+ "test:coverage": "jest --coverage",
92
+ "test:unit": "jest --testPathPatterns=unit",
93
+ "test:integration": "jest --testPathPatterns=integration",
94
+ "test:e2e": "jest --testPathPatterns=e2e",
95
+ "test:performance": "jest --testPathPatterns=performance",
96
+ "test:legacy": "node test/test-package.js",
90
97
  "test:mcp": "node test/mcp-integration.test.js",
98
+ "test:benchmark": "node test/performance-benchmark.js",
99
+ "test:all": "npm run test && npm run test:mcp",
100
+ "test:full": "npm run test:coverage && npm run test:mcp && npm run test:benchmark",
91
101
  "prepublishOnly": "echo 'Skipping tests for publishing - package tested manually'",
92
102
  "deploy": "wrangler deploy",
93
103
  "dev": "wrangler dev",
94
104
  "cf-typegen": "wrangler types",
95
- "test:performance": "node test/performance-benchmark.js",
96
- "test:all": "npm test && npm run test:mcp",
97
- "test:full": "npm run test:all && npm run test:performance",
98
- "benchmark": "npm run test:performance",
105
+ "benchmark": "npm run test:benchmark",
99
106
  "validate": "npm run cf-typegen && npm run test:all",
100
107
  "setup-vectorize": "./scripts/setup-vectorize.sh",
101
108
  "setup-paid-tier": "./scripts/setup-vectorize.sh && npm run deploy",
102
109
  "migrate-to-vectorize": "node scripts/migrate-to-vectorize.js"
103
110
  },
104
111
  "dependencies": {
105
- "@modelcontextprotocol/sdk": "^1.13.1",
112
+ "@modelcontextprotocol/sdk": "^1.16.0",
106
113
  "autoprefixer": "^10.4.21",
107
114
  "chanfana": "^2.6.3",
108
115
  "hono": "^4.6.20",
@@ -114,8 +121,13 @@
114
121
  },
115
122
  "devDependencies": {
116
123
  "@cloudflare/workers-types": "^4.20250129.0",
124
+ "@jest/globals": "^30.0.4",
125
+ "@types/jest": "^30.0.0",
117
126
  "@types/node": "22.13.0",
118
127
  "@types/uuid": "^9.0.8",
128
+ "jest": "^30.0.4",
129
+ "jest-environment-node": "^30.0.4",
130
+ "ts-jest": "^29.4.0",
119
131
  "typescript": "^5.7.3",
120
132
  "wrangler": "^4.21.2"
121
133
  }