purmemo-mcp 2.1.5 β†’ 3.2.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.
package/README.md CHANGED
@@ -229,66 +229,6 @@ The following remain proprietary:
229
229
  - Workflow intelligence system
230
230
  - Performance optimization techniques
231
231
 
232
- ## πŸ”§ Troubleshooting
233
-
234
- ### Common Issues and Solutions
235
-
236
- #### "Server disconnected" or "Connection closed" errors
237
- This usually happens when the MCP server produces console output that interferes with the JSON protocol.
238
-
239
- **Solution**: Update to the latest version:
240
- ```bash
241
- npx purmemo-mcp@latest setup
242
- ```
243
-
244
- #### "Unexpected token" or "Unexpected end of JSON input"
245
- This indicates console output is breaking the MCP protocol.
246
-
247
- **Quick fix**: Run diagnostics to identify the issue:
248
- ```bash
249
- npx purmemo-mcp diagnose
250
- ```
251
-
252
- #### Tools hang or timeout during authentication
253
- This happens when OAuth authentication blocks the MCP protocol.
254
-
255
- **Solution**: The latest version (2.1.3+) uses non-blocking authentication that returns helpful prompts instead of hanging.
256
-
257
- ### Step-by-Step Debugging
258
-
259
- 1. **Update to latest version**:
260
- ```bash
261
- npx purmemo-mcp@latest
262
- ```
263
-
264
- 2. **Run diagnostics**:
265
- ```bash
266
- npx purmemo-mcp diagnose
267
- ```
268
-
269
- 3. **Check Claude Desktop config**:
270
- Ensure you're using `purmemo-mcp@^2.1.3` or later in your configuration:
271
- ```json
272
- {
273
- "mcpServers": {
274
- "purmemo": {
275
- "command": "npx",
276
- "args": ["-y", "purmemo-mcp@^2.1.3"],
277
- "env": {
278
- "PURMEMO_API_URL": "https://api.purmemo.ai",
279
- "PURMEMO_OAUTH_CALLBACK_URL": "http://localhost:3456/callback",
280
- "PURMEMO_FRONTEND_URL": "https://app.purmemo.ai"
281
- }
282
- }
283
- }
284
- }
285
- ```
286
-
287
- 4. **Restart Claude Desktop** completely:
288
- - Quit with Cmd+Q (macOS) or close completely
289
- - Reopen Claude Desktop
290
- - Try connecting again
291
-
292
232
  ## πŸ†˜ Support
293
233
 
294
234
  - πŸ“§ Email: support@purmemo.ai
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "purmemo-mcp",
3
- "version": "2.1.5",
4
- "description": "Official Model Context Protocol (MCP) server for Purmemo - Seamless OAuth authentication for your AI-powered second brain",
5
- "main": "src/server-oauth.js",
3
+ "version": "3.2.0",
4
+ "description": "Official Model Context Protocol (MCP) server for Purmemo - Your AI-powered second brain with 5 complete tools",
5
+ "main": "src/server-final.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "purmemo-mcp": "./src/server-oauth.js",
8
+ "purmemo-mcp": "./src/server-final.js",
9
9
  "purmemo-mcp-setup": "./src/setup.js"
10
10
  },
11
11
  "files": [
@@ -15,13 +15,12 @@
15
15
  "LICENSE"
16
16
  ],
17
17
  "scripts": {
18
- "start": "node src/server-oauth.js",
18
+ "start": "node src/server-final.js",
19
19
  "setup": "node src/setup.js setup",
20
20
  "status": "node src/setup.js status",
21
21
  "logout": "node src/setup.js logout",
22
- "diagnose": "node src/diagnose.js",
23
22
  "test": "echo \"No tests yet\"",
24
- "postinstall": "node -e \"console.log('\\n🧠 pΕ«rmemo MCP v2.1.5 installed!\\n\\nπŸ”‘ Quick Setup:\\n1. Get API key: https://app.purmemo.ai/settings\\n2. Run: npx purmemo-mcp setup\\n3. Restart Claude Desktop\\n\\nπŸ“Š Diagnostics: npx purmemo-mcp diagnose\\n')\""
23
+ "postinstall": "node -e \"console.log('\\n🧠 Purmemo MCP v3.2.0 installed with 5 complete tools!\\n\\nQuick setup: Set PURMEMO_API_KEY environment variable\\nGet your API key at: https://app.purmemo.ai/settings/api-keys\\n\\nFull instructions: https://github.com/coladapo/purmemo-mcp#quick-start\\n')\""
25
24
  },
26
25
  "keywords": [
27
26
  "mcp",
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Production Diagnosis Tool for Purmemo MCP
4
+ * Tests authentication and API connectivity without console pollution
5
+ */
6
+
7
+ import { createWriteStream } from 'fs';
8
+ import { fileURLToPath } from 'url';
9
+ import { dirname, join } from 'path';
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+
14
+ const API_URL = process.env.PURMEMO_API_URL || 'https://api.purmemo.ai';
15
+ const logFile = createWriteStream(join(__dirname, '..', 'diagnosis.log'), { flags: 'w' });
16
+
17
+ function log(message) {
18
+ const timestamp = new Date().toISOString();
19
+ logFile.write(`${timestamp}: ${message}\n`);
20
+ }
21
+
22
+ async function diagnose() {
23
+ log('πŸ”¬ Starting Purmemo MCP Diagnosis');
24
+
25
+ // Check environment variables
26
+ const apiKey = process.env.PUO_MEMO_API_KEY || process.env.PURMEMO_API_KEY;
27
+ if (!apiKey) {
28
+ log('❌ No API key found in environment variables');
29
+ log(' Expected: PUO_MEMO_API_KEY or PURMEMO_API_KEY');
30
+ return false;
31
+ }
32
+
33
+ log('βœ… API key found in environment');
34
+ log(` Length: ${apiKey.length} characters`);
35
+ log(` Starts with: ${apiKey.substring(0, 10)}...`);
36
+
37
+ // Test API endpoints
38
+ const endpoints = [
39
+ '/api/v5/memories/',
40
+ '/api/v4/memories/',
41
+ '/api/memories/',
42
+ '/api/v5/entities',
43
+ '/api/v4/entities',
44
+ '/api/entities'
45
+ ];
46
+
47
+ let workingEndpoints = [];
48
+
49
+ for (const endpoint of endpoints) {
50
+ try {
51
+ log(`πŸ” Testing endpoint: ${API_URL}${endpoint}`);
52
+
53
+ const response = await fetch(`${API_URL}${endpoint}`, {
54
+ method: 'GET',
55
+ headers: {
56
+ 'Authorization': `Bearer ${apiKey}`,
57
+ 'Content-Type': 'application/json',
58
+ 'User-Agent': 'purmemo-mcp-diagnose/2.1.7'
59
+ },
60
+ signal: AbortSignal.timeout(10000)
61
+ });
62
+
63
+ log(` Status: ${response.status} ${response.statusText}`);
64
+
65
+ if (response.ok) {
66
+ workingEndpoints.push(endpoint);
67
+ log(' βœ… Endpoint working');
68
+
69
+ // Try to parse response
70
+ try {
71
+ const data = await response.json();
72
+ log(` πŸ“Š Response type: ${typeof data}`);
73
+ if (data && typeof data === 'object') {
74
+ log(` πŸ“Š Response keys: ${Object.keys(data).join(', ')}`);
75
+ }
76
+ } catch (parseError) {
77
+ log(` ⚠️ Response not JSON: ${parseError.message}`);
78
+ }
79
+ } else {
80
+ log(` ❌ Endpoint failed: ${response.status}`);
81
+
82
+ // Try to get error details
83
+ try {
84
+ const errorText = await response.text();
85
+ log(` πŸ“„ Error response: ${errorText.substring(0, 200)}`);
86
+ } catch (e) {
87
+ log(' πŸ“„ Could not read error response');
88
+ }
89
+ }
90
+
91
+ } catch (error) {
92
+ log(` ❌ Network error: ${error.message}`);
93
+
94
+ if (error.name === 'AbortError') {
95
+ log(' ⏱️ Request timed out (>10s)');
96
+ }
97
+ }
98
+ }
99
+
100
+ // Test memory creation
101
+ if (workingEndpoints.length > 0) {
102
+ const memoryEndpoint = workingEndpoints.find(e => e.includes('memories')) || workingEndpoints[0];
103
+ log(`πŸ§ͺ Testing memory creation on: ${memoryEndpoint}`);
104
+
105
+ try {
106
+ const testMemory = {
107
+ content: 'Test memory from diagnosis tool',
108
+ title: 'MCP Diagnosis Test',
109
+ tags: ['test', 'diagnosis']
110
+ };
111
+
112
+ const response = await fetch(`${API_URL}${memoryEndpoint}`, {
113
+ method: 'POST',
114
+ headers: {
115
+ 'Authorization': `Bearer ${apiKey}`,
116
+ 'Content-Type': 'application/json',
117
+ 'User-Agent': 'purmemo-mcp-diagnose/2.1.7'
118
+ },
119
+ body: JSON.stringify(testMemory),
120
+ signal: AbortSignal.timeout(10000)
121
+ });
122
+
123
+ log(` Memory creation status: ${response.status} ${response.statusText}`);
124
+
125
+ if (response.ok) {
126
+ const data = await response.json();
127
+ log(' βœ… Memory creation successful');
128
+ log(` πŸ“ Created memory ID: ${data.memory_id || data.id || 'unknown'}`);
129
+ } else {
130
+ const errorText = await response.text();
131
+ log(` ❌ Memory creation failed: ${errorText.substring(0, 200)}`);
132
+ }
133
+
134
+ } catch (error) {
135
+ log(` ❌ Memory creation error: ${error.message}`);
136
+ }
137
+ }
138
+
139
+ // Final summary
140
+ log('\nπŸ“Š DIAGNOSIS SUMMARY');
141
+ log(`Working endpoints: ${workingEndpoints.length}/${endpoints.length}`);
142
+ log(`API key present: ${!!apiKey}`);
143
+ log(`Working endpoints: ${workingEndpoints.join(', ')}`);
144
+
145
+ const success = workingEndpoints.length > 0;
146
+ log(`Overall status: ${success ? 'βœ… PASS' : '❌ FAIL'}`);
147
+
148
+ if (success) {
149
+ log('\nπŸŽ‰ Purmemo MCP should work correctly!');
150
+ log('πŸ’‘ If you still see issues, check Claude Desktop logs for JSON parsing errors');
151
+ } else {
152
+ log('\n🚨 Issues detected:');
153
+ log('1. Check your API key is valid and not expired');
154
+ log('2. Verify network connectivity to api.purmemo.ai');
155
+ log('3. Try getting a new API key from https://app.purmemo.ai/settings');
156
+ }
157
+
158
+ return success;
159
+ }
160
+
161
+ // Run diagnosis
162
+ diagnose()
163
+ .then(success => {
164
+ log('πŸ”¬ Diagnosis completed');
165
+ logFile.end();
166
+ process.exit(success ? 0 : 1);
167
+ })
168
+ .catch(error => {
169
+ log(`πŸ’₯ Diagnosis crashed: ${error.message}`);
170
+ logFile.end();
171
+ process.exit(1);
172
+ });