@pragmatic-growth/memory-mcp 2.4.0 → 3.0.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/AGENTS.md ADDED
@@ -0,0 +1,15 @@
1
+ # MCP Stdio Package Instructions
2
+
3
+ ## Package Role
4
+ - `packages/mcp-stdio` is the stdio proxy CLI that bridges MCP clients to the HTTP server.
5
+ - Entry point: `packages/mcp-stdio/src/index.ts` -> build output in `packages/mcp-stdio/dist/`.
6
+
7
+ ## Change Guidelines
8
+ - Keep Node >= 18 compatibility and ESM (`"type": "module"`).
9
+ - Use `zod` for input validation and keep CLI flags backward compatible.
10
+ - If you change CLI behavior, update `packages/mcp-stdio/README.md`.
11
+ - Any change to this package requires a version bump and a publish to npm.
12
+
13
+ ## Build & Test
14
+ - Build: `pnpm --filter @pragmatic-growth/memory-mcp build`.
15
+ - Run locally: `pnpm --filter @pragmatic-growth/memory-mcp dev`.
package/README.md CHANGED
@@ -7,15 +7,15 @@ Stdio proxy for PG-Memory - connects stdio-based MCP clients to your PG-Memory H
7
7
  PG-Memory supports **two MCP transport modes**:
8
8
 
9
9
  ### 1. HTTP Transport (Direct)
10
- For clients that support HTTP/SSE transport (Claude Code, mcp-remote):
10
+ For clients that support HTTP/SSE transport (Codex, Cursor, Claude Code):
11
11
  ```json
12
12
  {
13
13
  "mcpServers": {
14
14
  "pg-memory": {
15
15
  "command": "npx",
16
- "args": ["-y", "mcp-remote", "https://your-server.up.railway.app/api/mcp"],
17
- "env": {
18
- "API_KEY": "your-api-key"
16
+ "url": "https://your-server.up.railway.app/api/mcp",
17
+ "headers": {
18
+ "X-API-Key": "your-clerk-api-key"
19
19
  }
20
20
  }
21
21
  }
@@ -31,7 +31,7 @@ For clients that only support stdio (Raycast, local tools):
31
31
  "command": "npx",
32
32
  "args": ["-y", "@pragmatic-growth/memory-mcp"],
33
33
  "env": {
34
- "MCP_API_KEY": "your-api-key"
34
+ "CLERK_API_KEY": "your-api-key"
35
35
  }
36
36
  }
37
37
  ```
@@ -65,7 +65,7 @@ Includes all read-only tools PLUS write operations:
65
65
  "command": "npx",
66
66
  "args": ["-y", "@pragmatic-growth/memory-mcp"],
67
67
  "env": {
68
- "MCP_API_KEY": "your-api-key-here"
68
+ "CLERK_API_KEY": "your-api-key-here"
69
69
  }
70
70
  }
71
71
  ```
@@ -79,7 +79,7 @@ Includes all read-only tools PLUS write operations:
79
79
  "command": "npx",
80
80
  "args": ["-y", "@pragmatic-growth/memory-mcp", "--full"],
81
81
  "env": {
82
- "MCP_API_KEY": "your-api-key-here"
82
+ "CLERK_API_KEY": "your-api-key-here"
83
83
  }
84
84
  }
85
85
  ```
@@ -94,17 +94,17 @@ Then run directly:
94
94
 
95
95
  ```bash
96
96
  # Read-only mode (default)
97
- MCP_API_KEY=your-key memory-mcp
97
+ CLERK_API_KEY=your-key memory-mcp
98
98
 
99
99
  # Full mode
100
- MCP_API_KEY=your-key memory-mcp --full
100
+ CLERK_API_KEY=your-key memory-mcp --full
101
101
  ```
102
102
 
103
103
  ## Environment Variables
104
104
 
105
105
  | Variable | Required | Description |
106
106
  |----------|----------|-------------|
107
- | `MCP_API_KEY` | Yes | API key for authentication |
107
+ | `CLERK_API_KEY` | Yes | Clerk API key for authentication |
108
108
  | `MCP_SERVER_URL` | No | Custom server URL (default: production) |
109
109
  | `MCP_MODE` | No | Set to `full` to enable write operations |
110
110
 
@@ -191,7 +191,12 @@ For full mode to work:
191
191
 
192
192
  ## Changelog
193
193
 
194
- ### v2.4.0 (Latest)
194
+ ### v3.0.0 (Latest)
195
+ - Breaking: `CLERK_API_KEY` replaces `MCP_API_KEY`
196
+ - Adds MCP protocol negotiation for 2025-11-25, 2025-06-18, 2025-03-26
197
+ - Sends `MCP-Protocol-Version` on follow-up requests
198
+
199
+ ### v2.4.0
195
200
  - Changed default server URL to custom domain: `https://memory.pragmaticgrowth.com/api/mcp`
196
201
  - Simplified authentication to API key only (removed OAuth infrastructure)
197
202
  - Updated dependencies to latest versions
@@ -202,7 +207,7 @@ For full mode to work:
202
207
  - Added Knowledge Graph tools: `find_related`, `get_entities`, `search_entities`, `get_knowledge_graph`
203
208
  - Added Episodic Memory tools: `start_conversation`, `add_message`, `get_conversation`, `list_conversations`, `get_session_context`
204
209
  - Added Q&A tool: `add_question`
205
- - Updated to MCP Protocol 2025-11-25
210
+ - Updated to MCP Protocol (supports 2025-11-25, 2025-06-18, 2025-03-26)
206
211
 
207
212
  ### v2.1.1
208
213
  - Initial public release with core knowledge tools
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * npx @pragmatic-growth/memory-mcp --edit # Alias for --full
12
12
  *
13
13
  * Environment variables:
14
- * MCP_API_KEY - Clerk API key for authentication (required)
14
+ * CLERK_API_KEY - Clerk API key for authentication (required)
15
15
  * MCP_SERVER_URL - Server URL (default: https://pg-memory-production.up.railway.app/api/mcp)
16
16
  * MCP_MODE - Mode: 'readonly' (default) or 'full' for edit capabilities
17
17
  *
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * npx @pragmatic-growth/memory-mcp --edit # Alias for --full
12
12
  *
13
13
  * Environment variables:
14
- * MCP_API_KEY - Clerk API key for authentication (required)
14
+ * CLERK_API_KEY - Clerk API key for authentication (required)
15
15
  * MCP_SERVER_URL - Server URL (default: https://pg-memory-production.up.railway.app/api/mcp)
16
16
  * MCP_MODE - Mode: 'readonly' (default) or 'full' for edit capabilities
17
17
  *
@@ -29,15 +29,16 @@ const envMode = process.env.MCP_MODE?.toLowerCase();
29
29
  const isFullMode = hasFullFlag || envMode === 'full' || envMode === 'edit';
30
30
  // Configuration
31
31
  const SERVER_URL = process.env.MCP_SERVER_URL || 'https://memory.pragmaticgrowth.com/api/mcp';
32
- const API_KEY = process.env.MCP_API_KEY;
32
+ const API_KEY = process.env.CLERK_API_KEY;
33
33
  if (!API_KEY) {
34
- console.error('Error: MCP_API_KEY environment variable is required');
34
+ console.error('Error: CLERK_API_KEY environment variable is required');
35
35
  console.error('Get your Clerk API key from the Clerk Dashboard or app API Docs page');
36
36
  console.error('Set it in your MCP client configuration under "env"');
37
37
  process.exit(1);
38
38
  }
39
39
  // HTTP session management
40
40
  let sessionId = null;
41
+ let negotiatedProtocolVersion = null;
41
42
  /**
42
43
  * Make an HTTP request to the remote MCP server.
43
44
  * Uses X-API-Key header for Clerk API key authentication.
@@ -50,6 +51,9 @@ async function callRemoteServer(method, params) {
50
51
  if (sessionId) {
51
52
  headers['Mcp-Session-Id'] = sessionId;
52
53
  }
54
+ if (negotiatedProtocolVersion && method !== 'initialize') {
55
+ headers['Mcp-Protocol-Version'] = negotiatedProtocolVersion;
56
+ }
53
57
  const body = {
54
58
  jsonrpc: '2.0',
55
59
  id: Date.now(),
@@ -76,14 +80,20 @@ async function callRemoteServer(method, params) {
76
80
  * Initialize connection to remote server.
77
81
  */
78
82
  async function initializeRemoteSession() {
79
- await callRemoteServer('initialize', {
83
+ const result = await callRemoteServer('initialize', {
80
84
  protocolVersion: '2025-11-25',
81
85
  capabilities: {},
82
86
  clientInfo: {
83
87
  name: 'pg-memory-stdio',
84
- version: '2.4.0',
88
+ version: '3.0.0',
85
89
  },
86
90
  });
91
+ if (typeof result === 'object' && result && 'protocolVersion' in result) {
92
+ const protocolVersion = result.protocolVersion;
93
+ if (protocolVersion) {
94
+ negotiatedProtocolVersion = protocolVersion;
95
+ }
96
+ }
87
97
  }
88
98
  /**
89
99
  * Create and start the stdio MCP server.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pragmatic-growth/memory-mcp",
3
- "version": "2.4.0",
3
+ "version": "3.0.0",
4
4
  "description": "Stdio proxy for PG-Memory - connects stdio-based MCP clients (Claude Desktop, Raycast) to your PG-Memory HTTP server using Clerk API key authentication. Supports both read-only and full edit modes.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@
11
11
  * npx @pragmatic-growth/memory-mcp --edit # Alias for --full
12
12
  *
13
13
  * Environment variables:
14
- * MCP_API_KEY - Clerk API key for authentication (required)
14
+ * CLERK_API_KEY - Clerk API key for authentication (required)
15
15
  * MCP_SERVER_URL - Server URL (default: https://pg-memory-production.up.railway.app/api/mcp)
16
16
  * MCP_MODE - Mode: 'readonly' (default) or 'full' for edit capabilities
17
17
  *
@@ -32,10 +32,10 @@ const isFullMode = hasFullFlag || envMode === 'full' || envMode === 'edit';
32
32
 
33
33
  // Configuration
34
34
  const SERVER_URL = process.env.MCP_SERVER_URL || 'https://memory.pragmaticgrowth.com/api/mcp';
35
- const API_KEY = process.env.MCP_API_KEY;
35
+ const API_KEY = process.env.CLERK_API_KEY;
36
36
 
37
37
  if (!API_KEY) {
38
- console.error('Error: MCP_API_KEY environment variable is required');
38
+ console.error('Error: CLERK_API_KEY environment variable is required');
39
39
  console.error('Get your Clerk API key from the Clerk Dashboard or app API Docs page');
40
40
  console.error('Set it in your MCP client configuration under "env"');
41
41
  process.exit(1);
@@ -43,6 +43,7 @@ if (!API_KEY) {
43
43
 
44
44
  // HTTP session management
45
45
  let sessionId: string | null = null;
46
+ let negotiatedProtocolVersion: string | null = null;
46
47
 
47
48
  interface JsonRpcResponse {
48
49
  result?: {
@@ -65,6 +66,9 @@ async function callRemoteServer(method: string, params?: Record<string, unknown>
65
66
  if (sessionId) {
66
67
  headers['Mcp-Session-Id'] = sessionId;
67
68
  }
69
+ if (negotiatedProtocolVersion && method !== 'initialize') {
70
+ headers['Mcp-Protocol-Version'] = negotiatedProtocolVersion;
71
+ }
68
72
 
69
73
  const body = {
70
74
  jsonrpc: '2.0',
@@ -98,14 +102,20 @@ async function callRemoteServer(method: string, params?: Record<string, unknown>
98
102
  * Initialize connection to remote server.
99
103
  */
100
104
  async function initializeRemoteSession(): Promise<void> {
101
- await callRemoteServer('initialize', {
105
+ const result = await callRemoteServer('initialize', {
102
106
  protocolVersion: '2025-11-25',
103
107
  capabilities: {},
104
108
  clientInfo: {
105
109
  name: 'pg-memory-stdio',
106
- version: '2.4.0',
110
+ version: '3.0.0',
107
111
  },
108
112
  });
113
+ if (typeof result === 'object' && result && 'protocolVersion' in result) {
114
+ const protocolVersion = (result as { protocolVersion?: string }).protocolVersion;
115
+ if (protocolVersion) {
116
+ negotiatedProtocolVersion = protocolVersion;
117
+ }
118
+ }
109
119
  }
110
120
 
111
121
  /**