@ekkos/mcp-server 1.2.1 → 1.2.3
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/CHANGELOG.md +2 -0
- package/PUBLISH.md +2 -0
- package/README.md +256 -160
- package/build/index.d.ts +9 -7
- package/build/index.js +43 -23
- package/index.ts +45 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/PUBLISH.md
CHANGED
package/README.md
CHANGED
|
@@ -1,231 +1,327 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ekkOS™ Memory MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Give your AI agent (Claude, GPT-4, etc.) in Cursor, Windsurf, or VS Code a persistent memory. It remembers solutions, learns from mistakes, and gets smarter over time.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Quick Start
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### 1. Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @ekkos/mcp-server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### 2. Get Your API Key
|
|
10
14
|
|
|
11
|
-
1.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
1. Visit https://platform.ekkos.dev
|
|
16
|
+
2. Sign in or create an account
|
|
17
|
+
3. Copy your API key from the dashboard
|
|
18
|
+
4. Copy your User ID from your profile
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
- Permanent preferences
|
|
18
|
-
- Established patterns
|
|
19
|
-
- Semantic relationships
|
|
20
|
-
- Forever memory
|
|
20
|
+
### 3. Configure Your IDE
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- User corrections
|
|
24
|
-
- Pattern applications
|
|
25
|
-
- Recent failures
|
|
26
|
-
- Last 72h activity
|
|
22
|
+
**For Cursor:** Add to `~/.cursor/mcp.json`
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
- MUST/NEVER/PREFER/AVOID rules
|
|
30
|
-
- Derived from both short-term + long-term memory
|
|
31
|
-
- Updated in real-time
|
|
24
|
+
**For Windsurf:** Add to `~/.codeium/windsurf/mcp_config.json`
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"mcpServers": {
|
|
29
|
+
"ekkos-memory": {
|
|
30
|
+
"url": "https://mcp.ekkos.dev/api/v1/mcp/sse?api_key=your-api-key-here",
|
|
31
|
+
"transport": "sse",
|
|
32
|
+
"headers": {
|
|
33
|
+
"Authorization": "Bearer your-api-key-here",
|
|
34
|
+
"X-User-ID": "your-user-id-here"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
Search all memory systems at once.
|
|
41
|
+
**For Claude Code:** Add to `~/.claude/settings.json`
|
|
37
42
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"ekkos-memory": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["-y", "@ekkos/mcp-server"],
|
|
49
|
+
"env": {
|
|
50
|
+
"EKKOS_API_KEY": "your-api-key-here",
|
|
51
|
+
"EKKOS_USER_ID": "your-user-id-here"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
44
56
|
```
|
|
45
57
|
|
|
46
|
-
|
|
58
|
+
### 4. Restart Your IDE
|
|
47
59
|
|
|
48
|
-
|
|
49
|
-
Get current behavioral directives from auto-scan.
|
|
60
|
+
The MCP server will be available in all chat sessions. Your AI can now remember!
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
get_directives({
|
|
53
|
-
userId: "system",
|
|
54
|
-
windowHours: 72
|
|
55
|
-
})
|
|
56
|
-
```
|
|
62
|
+
## How It Works
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
Your AI agent can now access a 10-layer memory system that stores:
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
- **Patterns** - Proven solutions that worked
|
|
67
|
+
- **Conversations** - Past discussions and problem-solving sessions
|
|
68
|
+
- **Directives** - Rules your AI must follow (MUST/NEVER/PREFER/AVOID)
|
|
69
|
+
- **Codebase** - Semantic search across your project
|
|
70
|
+
- **And more** - Episodic memory, procedural workflows, collective knowledge
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
When you ask a question, your AI searches this memory first, finds relevant solutions, and applies them automatically.
|
|
73
|
+
|
|
74
|
+
## Core Tools
|
|
75
|
+
|
|
76
|
+
### `search_memory` 🔍
|
|
68
77
|
|
|
69
|
-
**
|
|
78
|
+
**What it does:** Searches all your memory layers to find relevant patterns, solutions, and past conversations.
|
|
70
79
|
|
|
71
|
-
|
|
72
|
-
Query recent learning signals by type.
|
|
80
|
+
**When to use:** Your AI calls this automatically before answering technical questions. It's the primary way your AI remembers.
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
**Example:**
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
You: "How did we fix the auth timeout issue?"
|
|
86
|
+
|
|
87
|
+
AI: [Searches memory automatically]
|
|
88
|
+
"Found it! We used the auth-timeout-mitigation pattern
|
|
89
|
+
from last week. Here's the solution..."
|
|
80
90
|
```
|
|
81
91
|
|
|
82
|
-
**
|
|
92
|
+
**What you get back:**
|
|
93
|
+
|
|
94
|
+
- Relevant patterns with success rates
|
|
95
|
+
- Past conversations about similar problems
|
|
96
|
+
- Code examples that worked
|
|
97
|
+
- Solutions sorted by how well they worked
|
|
98
|
+
|
|
99
|
+
---
|
|
83
100
|
|
|
84
|
-
### `
|
|
85
|
-
|
|
101
|
+
### `forge_pattern` 🔥
|
|
102
|
+
|
|
103
|
+
**What it does:** Saves a solution that worked as a reusable pattern. Future AI agents (including yourself) will find it automatically.
|
|
104
|
+
|
|
105
|
+
**When to use:** After you solve a problem, fix a bug, or discover a better approach. Your AI should call this automatically, but you can also trigger it.
|
|
106
|
+
|
|
107
|
+
**Example:**
|
|
86
108
|
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
limit: 10
|
|
92
|
-
})
|
|
109
|
+
```
|
|
110
|
+
AI: [After fixing a bug]
|
|
111
|
+
"I've saved this solution as a pattern. Next time we
|
|
112
|
+
encounter this issue, I'll remember the fix instantly."
|
|
93
113
|
```
|
|
94
114
|
|
|
95
|
-
**
|
|
115
|
+
**What happens:**
|
|
96
116
|
|
|
97
|
-
|
|
117
|
+
- Pattern is stored in memory
|
|
118
|
+
- Becomes searchable immediately
|
|
119
|
+
- Success rate tracked over time
|
|
120
|
+
- Automatically suggested for similar problems
|
|
98
121
|
|
|
99
|
-
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### `forge_directive` 📜
|
|
125
|
+
|
|
126
|
+
**What it does:** Creates a rule your AI must follow. These are MUST/NEVER/PREFER/AVOID rules that guide behavior.
|
|
127
|
+
|
|
128
|
+
**When to use:** When you want to establish permanent rules for how your AI should behave.
|
|
129
|
+
|
|
130
|
+
**Example:**
|
|
100
131
|
|
|
101
|
-
```bash
|
|
102
|
-
cd mcp-servers/echo-memory
|
|
103
|
-
npm install
|
|
104
|
-
npm run build
|
|
105
132
|
```
|
|
133
|
+
You: "Always use TypeScript strict mode"
|
|
106
134
|
|
|
107
|
-
|
|
135
|
+
AI: [Creates directive]
|
|
136
|
+
"Rule saved. I'll always use strict mode going forward."
|
|
137
|
+
```
|
|
108
138
|
|
|
109
|
-
|
|
139
|
+
**Types of rules:**
|
|
140
|
+
|
|
141
|
+
- **MUST** - Always do this (highest priority)
|
|
142
|
+
- **NEVER** - Never do this (high priority)
|
|
143
|
+
- **PREFER** - Prefer this approach (medium priority)
|
|
144
|
+
- **AVOID** - Try to avoid this (lower priority)
|
|
145
|
+
|
|
146
|
+
**What happens:**
|
|
147
|
+
|
|
148
|
+
- Rule is enforced in all future interactions
|
|
149
|
+
- AI checks against rules before taking actions
|
|
150
|
+
- Rules can be project-specific or global
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### `recall_conversation` 💬
|
|
155
|
+
|
|
156
|
+
**What it does:** Finds past conversations about a topic, even from days or weeks ago.
|
|
157
|
+
|
|
158
|
+
**When to use:** When you want to remember what you discussed before, or check if you've already solved a problem.
|
|
159
|
+
|
|
160
|
+
**Example:**
|
|
110
161
|
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"mcpServers": {
|
|
114
|
-
"echo-memory": {
|
|
115
|
-
"command": "node",
|
|
116
|
-
"args": [
|
|
117
|
-
"/Volumes/MacMiniPort/DEV/echo/mcp-servers/echo-memory/build/index.js"
|
|
118
|
-
],
|
|
119
|
-
"env": {
|
|
120
|
-
"ECHO_API_URL": "http://localhost:3000",
|
|
121
|
-
"ECHO_API_KEY": "your-api-key-here"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
162
|
```
|
|
163
|
+
You: "What did we decide about the database schema?"
|
|
164
|
+
|
|
165
|
+
AI: [Searches past conversations]
|
|
166
|
+
"We discussed this 2 weeks ago. You decided to use
|
|
167
|
+
PostgreSQL with JSONB for flexible fields..."
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**What you get back:**
|
|
127
171
|
|
|
128
|
-
|
|
172
|
+
- Relevant excerpts from past conversations
|
|
173
|
+
- Context about decisions made
|
|
174
|
+
- Solutions you've tried before
|
|
175
|
+
- Semantic matches (finds related topics, not just keywords)
|
|
129
176
|
|
|
130
|
-
|
|
177
|
+
---
|
|
131
178
|
|
|
132
|
-
|
|
179
|
+
### `check_conflict` ⚖️
|
|
133
180
|
|
|
134
|
-
|
|
181
|
+
**What it does:** Validates an action against your rules and patterns before executing it. Prevents your AI from doing something that violates your preferences.
|
|
182
|
+
|
|
183
|
+
**When to use:** Before executing destructive operations, deploying changes, or modifying critical configs.
|
|
184
|
+
|
|
185
|
+
**Example:**
|
|
135
186
|
|
|
136
187
|
```
|
|
137
|
-
|
|
188
|
+
AI: [Before deleting files]
|
|
189
|
+
"I want to delete /tmp files. Let me check if this
|
|
190
|
+
violates any rules..."
|
|
138
191
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
192
|
+
[Checks conflicts]
|
|
193
|
+
"⚠️ CONFLICT: This violates NEVER rule: 'Never delete
|
|
194
|
+
files without user confirmation'. I'll ask first."
|
|
142
195
|
```
|
|
143
196
|
|
|
144
|
-
**
|
|
197
|
+
**What you get back:**
|
|
145
198
|
|
|
146
|
-
|
|
199
|
+
- List of violated rules (if any)
|
|
200
|
+
- Conflicting patterns
|
|
201
|
+
- Recommendations to proceed safely
|
|
202
|
+
- Clear explanation of why it conflicts
|
|
147
203
|
|
|
148
|
-
|
|
204
|
+
---
|
|
149
205
|
|
|
150
|
-
|
|
151
|
-
- `ECHO_API_KEY`: API key for authentication (optional, for production)
|
|
206
|
+
## How to Use It Day-to-Day
|
|
152
207
|
|
|
153
|
-
###
|
|
208
|
+
### When Starting Work
|
|
154
209
|
|
|
155
|
-
|
|
156
|
-
# Watch mode (rebuilds on changes)
|
|
157
|
-
npm run watch
|
|
210
|
+
Your AI automatically searches memory when you ask questions. You don't need to do anything special - just ask:
|
|
158
211
|
|
|
159
|
-
# Test the server
|
|
160
|
-
node build/index.js
|
|
161
212
|
```
|
|
213
|
+
You: "Fix the authentication bug"
|
|
214
|
+
AI: [Searches memory] "Found 3 solutions from past work..."
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### When Solving Problems
|
|
162
218
|
|
|
163
|
-
|
|
219
|
+
After your AI solves something, it should automatically save it as a pattern:
|
|
164
220
|
|
|
165
221
|
```
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
└───────────────────┬─────────────────────────────────────┘
|
|
169
|
-
↓
|
|
170
|
-
┌─────────────────────────────────────────────────────────┐
|
|
171
|
-
│ Echo Memory MCP Server │
|
|
172
|
-
│ • search_memory │
|
|
173
|
-
│ • get_directives │
|
|
174
|
-
│ • recall_pattern │
|
|
175
|
-
│ • query_signals │
|
|
176
|
-
│ • search_knowledge_graph │
|
|
177
|
-
└───────────────────┬─────────────────────────────────────┘
|
|
178
|
-
↓
|
|
179
|
-
┌─────────────────────────────────────────────────────────┐
|
|
180
|
-
│ Echo API (localhost:3000) │
|
|
181
|
-
│ ├─ /api/asi/semantic-search (REFLEX_LOG) │
|
|
182
|
-
│ ├─ /api/asi/scan (Auto-Scan) │
|
|
183
|
-
│ ├─ /api/graphiti (Knowledge Graph) │
|
|
184
|
-
│ └─ /api/asi/log-signal (Signals) │
|
|
185
|
-
└───────────────────┬─────────────────────────────────────┘
|
|
186
|
-
↓
|
|
187
|
-
┌─────────────────────────────────────────────────────────┐
|
|
188
|
-
│ Memory Stores │
|
|
189
|
-
│ ├─ REFLEX_LOG.md (Patterns) │
|
|
190
|
-
│ ├─ Supabase asi_signals (Short-term, 72h) │
|
|
191
|
-
│ └─ Graphiti/Neo4j (Long-term, forever) │
|
|
192
|
-
└─────────────────────────────────────────────────────────┘
|
|
222
|
+
AI: [After fixing bug]
|
|
223
|
+
"Solution saved. Future agents will find this automatically."
|
|
193
224
|
```
|
|
194
225
|
|
|
195
|
-
|
|
226
|
+
If it doesn't, you can remind it:
|
|
196
227
|
|
|
197
|
-
|
|
228
|
+
```
|
|
229
|
+
You: "Save this solution as a pattern"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### When Setting Rules
|
|
233
|
+
|
|
234
|
+
Tell your AI what you want it to always/never do:
|
|
198
235
|
|
|
199
236
|
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
[Might repeat past mistakes]
|
|
203
|
-
[Might not use proven patterns]
|
|
237
|
+
You: "Never use `any` type in TypeScript"
|
|
238
|
+
AI: [Creates directive] "Rule saved. I'll avoid `any` going forward."
|
|
204
239
|
```
|
|
205
240
|
|
|
206
|
-
###
|
|
241
|
+
### When Checking Past Work
|
|
242
|
+
|
|
243
|
+
Ask about past conversations:
|
|
207
244
|
|
|
208
245
|
```
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"Found 3 proven solutions from past work!
|
|
212
|
-
Applying the highest-success pattern..."
|
|
213
|
-
[Uses established solution instantly] ✅
|
|
246
|
+
You: "What did we decide about the API structure?"
|
|
247
|
+
AI: [Searches conversations] "We discussed this last week..."
|
|
214
248
|
```
|
|
215
249
|
|
|
216
|
-
|
|
250
|
+
## The Golden Loop
|
|
217
251
|
|
|
218
|
-
|
|
252
|
+
ekkOS uses a continuous learning cycle that makes your AI smarter:
|
|
219
253
|
|
|
220
|
-
1.
|
|
221
|
-
2.
|
|
222
|
-
3.
|
|
223
|
-
4.
|
|
224
|
-
|
|
254
|
+
1. **Retrieve** - `search_memory` finds relevant patterns
|
|
255
|
+
2. **Apply** - AI uses patterns to solve problems
|
|
256
|
+
3. **Measure** - System tracks if solutions worked
|
|
257
|
+
4. **Learn** - `forge_pattern` saves new solutions
|
|
258
|
+
|
|
259
|
+
This creates a self-improving system. Every problem solved makes future problems easier.
|
|
260
|
+
|
|
261
|
+
## Troubleshooting
|
|
262
|
+
|
|
263
|
+
### MCP Server Not Appearing
|
|
264
|
+
|
|
265
|
+
- Make sure Node.js 18+ is installed
|
|
266
|
+
- Check your API key is correct in the config file
|
|
267
|
+
- Restart your IDE after adding the config
|
|
268
|
+
- Check IDE logs for connection errors
|
|
269
|
+
|
|
270
|
+
### No Patterns Found
|
|
271
|
+
|
|
272
|
+
- You need to forge some patterns first (solve problems and save them)
|
|
273
|
+
- Check your API key has access to your memory
|
|
274
|
+
- Make sure `EKKOS_USER_ID` is set for user-scoped patterns
|
|
275
|
+
|
|
276
|
+
### Authentication Errors
|
|
277
|
+
|
|
278
|
+
- Verify your API key at https://platform.ekkos.dev
|
|
279
|
+
- Check the key hasn't expired
|
|
280
|
+
- Make sure the key has correct permissions
|
|
281
|
+
|
|
282
|
+
## What Gets Stored
|
|
283
|
+
|
|
284
|
+
Your memory includes:
|
|
285
|
+
|
|
286
|
+
- **Patterns** - Solutions that worked, with success rates
|
|
287
|
+
- **Conversations** - Past discussions, searchable semantically
|
|
288
|
+
- **Directives** - Rules your AI follows (MUST/NEVER/PREFER/AVOID)
|
|
289
|
+
- **Codebase** - Semantic search across your project files
|
|
290
|
+
- **Episodic** - Problem-solving sessions and workflows
|
|
291
|
+
- **Procedural** - Step-by-step processes that worked
|
|
292
|
+
- **Collective** - Knowledge shared across AI agents
|
|
293
|
+
- **Code** - Code embeddings for finding similar code
|
|
294
|
+
|
|
295
|
+
All of this is searchable instantly when your AI needs it.
|
|
296
|
+
|
|
297
|
+
## Example Workflow
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
1. You: "Fix the login bug"
|
|
301
|
+
|
|
302
|
+
2. AI: [Calls search_memory("login bug fix")]
|
|
303
|
+
"Found 2 patterns from past work. Applying the
|
|
304
|
+
highest-success solution..."
|
|
305
|
+
|
|
306
|
+
3. AI: [Fixes bug using pattern]
|
|
307
|
+
"Fixed! This solution has worked 8 times before."
|
|
308
|
+
|
|
309
|
+
4. AI: [Calls forge_pattern automatically]
|
|
310
|
+
"Saved this fix as a pattern for next time."
|
|
311
|
+
|
|
312
|
+
5. Next time: AI remembers instantly and applies the fix
|
|
313
|
+
```
|
|
225
314
|
|
|
226
315
|
## Related
|
|
227
316
|
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
317
|
+
- **Platform Dashboard**: https://platform.ekkos.dev
|
|
318
|
+
- **Documentation**: https://docs.ekkos.dev
|
|
319
|
+
- **GitHub**: https://github.com/ekkos-ai/ekkos
|
|
320
|
+
|
|
321
|
+
## License
|
|
322
|
+
|
|
323
|
+
MIT
|
|
324
|
+
|
|
325
|
+
---
|
|
231
326
|
|
|
327
|
+
**ekkOS™** - The memory substrate for AI agents. Making AI smarter, one pattern at a time. 🧠♾️
|
package/build/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ekkOS™ Memory MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Provides Claude
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
5
|
+
* Provides AI agents (Claude, GPT-4, etc.) in Cursor, Windsurf, VS Code, and Claude Code
|
|
6
|
+
* with direct access to ekkOS's 10-layer memory architecture:
|
|
7
|
+
* - Layer 1-10 memory systems (working, episodic, semantic, patterns, procedural, collective, meta, codebase, directives, conflicts)
|
|
8
|
+
* - Unified context retrieval via Memory Orchestrator
|
|
9
|
+
* - Pattern search and forging (Golden Loop)
|
|
10
|
+
* - Knowledge graph queries (Graphiti/Neo4j)
|
|
11
|
+
* - Behavioral directives (MUST/NEVER/PREFER/AVOID)
|
|
10
12
|
*
|
|
11
|
-
* This bridges the gap between built infrastructure and AI access.
|
|
13
|
+
* This bridges the gap between ekkOS's built memory infrastructure and AI agent access.
|
|
12
14
|
*/
|
|
13
15
|
export {};
|
package/build/index.js
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ekkOS™ Memory MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Provides Claude
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
5
|
+
* Provides AI agents (Claude, GPT-4, etc.) in Cursor, Windsurf, VS Code, and Claude Code
|
|
6
|
+
* with direct access to ekkOS's 10-layer memory architecture:
|
|
7
|
+
* - Layer 1-10 memory systems (working, episodic, semantic, patterns, procedural, collective, meta, codebase, directives, conflicts)
|
|
8
|
+
* - Unified context retrieval via Memory Orchestrator
|
|
9
|
+
* - Pattern search and forging (Golden Loop)
|
|
10
|
+
* - Knowledge graph queries (Graphiti/Neo4j)
|
|
11
|
+
* - Behavioral directives (MUST/NEVER/PREFER/AVOID)
|
|
10
12
|
*
|
|
11
|
-
* This bridges the gap between built infrastructure and AI access.
|
|
13
|
+
* This bridges the gap between ekkOS's built memory infrastructure and AI agent access.
|
|
12
14
|
*/
|
|
13
15
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
14
16
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
15
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
17
|
+
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
16
18
|
import { createClient } from '@supabase/supabase-js';
|
|
17
19
|
import http from 'http';
|
|
18
20
|
import https from 'https';
|
|
19
21
|
// Server configuration - USE DIRECT SUPABASE CONNECTION
|
|
20
22
|
// Bypass broken production API, query database directly
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
+
// SECURITY: Never hardcode credentials - require environment variables
|
|
24
|
+
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL || process.env.SUPABASE_URL;
|
|
25
|
+
const SUPABASE_KEY = process.env.SUPABASE_SERVICE_ROLE_KEY || process.env.MEMORY_API_TOKEN;
|
|
26
|
+
// Fail fast if credentials are missing (prevents accidental exposure)
|
|
27
|
+
if (!SUPABASE_URL) {
|
|
28
|
+
console.error('[MCP:ekkos-memory] ERROR: SUPABASE_URL or NEXT_PUBLIC_SUPABASE_URL environment variable is required');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
if (!SUPABASE_KEY) {
|
|
32
|
+
console.error('[MCP:ekkos-memory] ERROR: SUPABASE_SERVICE_ROLE_KEY or MEMORY_API_TOKEN environment variable is required');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
23
35
|
// Create Supabase client for direct database access
|
|
24
36
|
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
|
|
25
37
|
// Keep legacy Memory API config for non-pattern queries
|
|
@@ -34,11 +46,11 @@ const ECHO_API_KEY = process.env.ECHO_API_KEY; // For authentication
|
|
|
34
46
|
const EKKOS_USER_ID = process.env.EKKOS_USER_ID; // User ID for tracking retrievals
|
|
35
47
|
const EKKOS_API_KEY = process.env.EKKOS_API_KEY; // User's API key
|
|
36
48
|
// Debug: Log configuration on startup (to stderr so it doesn't interfere with MCP protocol)
|
|
37
|
-
console.error(`[MCP:
|
|
38
|
-
console.error(`[MCP:
|
|
39
|
-
console.error(`[MCP:
|
|
40
|
-
console.error(`[MCP:
|
|
41
|
-
console.error(`[MCP:
|
|
49
|
+
console.error(`[MCP:ekkos-memory] Using DIRECT Supabase connection`);
|
|
50
|
+
console.error(`[MCP:ekkos-memory] SUPABASE_URL: ${SUPABASE_URL}`);
|
|
51
|
+
console.error(`[MCP:ekkos-memory] SUPABASE_KEY: ${SUPABASE_KEY ? 'set (' + SUPABASE_KEY.length + ' chars)' : 'NOT SET'}`);
|
|
52
|
+
console.error(`[MCP:ekkos-memory] EKKOS_USER_ID: ${EKKOS_USER_ID || 'NOT SET (Golden Loop tracking disabled)'}`);
|
|
53
|
+
console.error(`[MCP:ekkos-memory] EKKOS_API_KEY: ${EKKOS_API_KEY ? 'set' : 'NOT SET'}`);
|
|
42
54
|
// In-memory store for tracking pattern applications (maps application_id -> pattern_ids)
|
|
43
55
|
// This bridges track_memory_application and record_memory_outcome
|
|
44
56
|
const applicationStore = new Map();
|
|
@@ -974,10 +986,11 @@ This is essential for:
|
|
|
974
986
|
// Server implementation
|
|
975
987
|
const server = new Server({
|
|
976
988
|
name: 'ekkos-memory',
|
|
977
|
-
version: '1.
|
|
989
|
+
version: '1.2.3',
|
|
978
990
|
}, {
|
|
979
991
|
capabilities: {
|
|
980
992
|
tools: {},
|
|
993
|
+
resources: {}, // Support resources listing (even if empty)
|
|
981
994
|
},
|
|
982
995
|
});
|
|
983
996
|
// List available tools
|
|
@@ -986,6 +999,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
986
999
|
tools: TOOLS,
|
|
987
1000
|
};
|
|
988
1001
|
});
|
|
1002
|
+
// List available resources (ekkOS uses tools, not resources, but we support the request)
|
|
1003
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
1004
|
+
return {
|
|
1005
|
+
resources: [], // ekkOS uses tools for all operations, not resources
|
|
1006
|
+
};
|
|
1007
|
+
});
|
|
989
1008
|
// User-friendly tool names for display
|
|
990
1009
|
const toolDisplayNames = {
|
|
991
1010
|
'search_memory': '🔍 Search Memory',
|
|
@@ -1653,14 +1672,15 @@ The ingestion worker will pick this up within 1-5 minutes.`,
|
|
|
1653
1672
|
const contentHash = createHash('sha256').update(content).digest('hex');
|
|
1654
1673
|
try {
|
|
1655
1674
|
// Insert directly into patterns table via Supabase
|
|
1656
|
-
|
|
1657
|
-
const
|
|
1658
|
-
const
|
|
1675
|
+
// Use the same SUPABASE_URL and SUPABASE_KEY from top-level config
|
|
1676
|
+
const localSupabaseUrl = SUPABASE_URL;
|
|
1677
|
+
const localSupabaseKey = SUPABASE_KEY;
|
|
1678
|
+
const insertResponse = await fetch(`${localSupabaseUrl}/rest/v1/patterns`, {
|
|
1659
1679
|
method: 'POST',
|
|
1660
1680
|
headers: {
|
|
1661
1681
|
'Content-Type': 'application/json',
|
|
1662
|
-
'apikey':
|
|
1663
|
-
'Authorization': `Bearer ${
|
|
1682
|
+
'apikey': localSupabaseKey,
|
|
1683
|
+
'Authorization': `Bearer ${localSupabaseKey}`,
|
|
1664
1684
|
'Prefer': 'return=representation',
|
|
1665
1685
|
},
|
|
1666
1686
|
body: JSON.stringify({
|
|
@@ -1774,7 +1794,7 @@ Future agents will find it when facing similar problems.
|
|
|
1774
1794
|
case 'get_memory_layer_info': {
|
|
1775
1795
|
try {
|
|
1776
1796
|
const stats = await fetchMemory('/api/v1/memory/metrics');
|
|
1777
|
-
const formatted = `**
|
|
1797
|
+
const formatted = `**ekkOS Memory Layer Statistics** (10-Layer Architecture)
|
|
1778
1798
|
|
|
1779
1799
|
**Core Memory Layers:**
|
|
1780
1800
|
- 🧠 Layer 2 (Episodic): ${stats.episodic || 0} episodes
|
|
@@ -1831,7 +1851,7 @@ The memory metrics endpoint may not be available. Check that:
|
|
|
1831
1851
|
This is ekkOS, the memory substrate for AI agents.
|
|
1832
1852
|
|
|
1833
1853
|
**Connection Status:** ✅ MCP server is running and responding
|
|
1834
|
-
**Server:**
|
|
1854
|
+
**Server:** ekkOS Memory MCP Server v1.2.1
|
|
1835
1855
|
**Time:** ${new Date().toISOString()}
|
|
1836
1856
|
|
|
1837
1857
|
You've successfully connected to ekkOS via the Model Context Protocol. This proves that:
|
package/index.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* ekkOS™ Memory MCP Server
|
|
4
4
|
*
|
|
5
|
-
* Provides Claude
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
5
|
+
* Provides AI agents (Claude, GPT-4, etc.) in Cursor, Windsurf, VS Code, and Claude Code
|
|
6
|
+
* with direct access to ekkOS's 10-layer memory architecture:
|
|
7
|
+
* - Layer 1-10 memory systems (working, episodic, semantic, patterns, procedural, collective, meta, codebase, directives, conflicts)
|
|
8
|
+
* - Unified context retrieval via Memory Orchestrator
|
|
9
|
+
* - Pattern search and forging (Golden Loop)
|
|
10
|
+
* - Knowledge graph queries (Graphiti/Neo4j)
|
|
11
|
+
* - Behavioral directives (MUST/NEVER/PREFER/AVOID)
|
|
10
12
|
*
|
|
11
|
-
* This bridges the gap between built infrastructure and AI access.
|
|
13
|
+
* This bridges the gap between ekkOS's built memory infrastructure and AI agent access.
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
15
17
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
16
18
|
import {
|
|
17
19
|
CallToolRequestSchema,
|
|
20
|
+
ListResourcesRequestSchema,
|
|
18
21
|
ListToolsRequestSchema,
|
|
19
22
|
Tool,
|
|
20
23
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -24,8 +27,19 @@ import https from 'https';
|
|
|
24
27
|
|
|
25
28
|
// Server configuration - USE DIRECT SUPABASE CONNECTION
|
|
26
29
|
// Bypass broken production API, query database directly
|
|
27
|
-
|
|
28
|
-
const
|
|
30
|
+
// SECURITY: Never hardcode credentials - require environment variables
|
|
31
|
+
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL || process.env.SUPABASE_URL;
|
|
32
|
+
const SUPABASE_KEY = process.env.SUPABASE_SERVICE_ROLE_KEY || process.env.MEMORY_API_TOKEN;
|
|
33
|
+
|
|
34
|
+
// Fail fast if credentials are missing (prevents accidental exposure)
|
|
35
|
+
if (!SUPABASE_URL) {
|
|
36
|
+
console.error('[MCP:ekkos-memory] ERROR: SUPABASE_URL or NEXT_PUBLIC_SUPABASE_URL environment variable is required');
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
if (!SUPABASE_KEY) {
|
|
40
|
+
console.error('[MCP:ekkos-memory] ERROR: SUPABASE_SERVICE_ROLE_KEY or MEMORY_API_TOKEN environment variable is required');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
29
43
|
|
|
30
44
|
// Create Supabase client for direct database access
|
|
31
45
|
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
|
|
@@ -44,11 +58,11 @@ const EKKOS_USER_ID = process.env.EKKOS_USER_ID; // User ID for tracking retriev
|
|
|
44
58
|
const EKKOS_API_KEY = process.env.EKKOS_API_KEY; // User's API key
|
|
45
59
|
|
|
46
60
|
// Debug: Log configuration on startup (to stderr so it doesn't interfere with MCP protocol)
|
|
47
|
-
console.error(`[MCP:
|
|
48
|
-
console.error(`[MCP:
|
|
49
|
-
console.error(`[MCP:
|
|
50
|
-
console.error(`[MCP:
|
|
51
|
-
console.error(`[MCP:
|
|
61
|
+
console.error(`[MCP:ekkos-memory] Using DIRECT Supabase connection`);
|
|
62
|
+
console.error(`[MCP:ekkos-memory] SUPABASE_URL: ${SUPABASE_URL}`);
|
|
63
|
+
console.error(`[MCP:ekkos-memory] SUPABASE_KEY: ${SUPABASE_KEY ? 'set (' + SUPABASE_KEY.length + ' chars)' : 'NOT SET'}`);
|
|
64
|
+
console.error(`[MCP:ekkos-memory] EKKOS_USER_ID: ${EKKOS_USER_ID || 'NOT SET (Golden Loop tracking disabled)'}`);
|
|
65
|
+
console.error(`[MCP:ekkos-memory] EKKOS_API_KEY: ${EKKOS_API_KEY ? 'set' : 'NOT SET'}`);
|
|
52
66
|
|
|
53
67
|
// In-memory store for tracking pattern applications (maps application_id -> pattern_ids)
|
|
54
68
|
// This bridges track_memory_application and record_memory_outcome
|
|
@@ -1021,11 +1035,12 @@ This is essential for:
|
|
|
1021
1035
|
const server = new Server(
|
|
1022
1036
|
{
|
|
1023
1037
|
name: 'ekkos-memory',
|
|
1024
|
-
version: '1.
|
|
1038
|
+
version: '1.2.3',
|
|
1025
1039
|
},
|
|
1026
1040
|
{
|
|
1027
1041
|
capabilities: {
|
|
1028
1042
|
tools: {},
|
|
1043
|
+
resources: {}, // Support resources listing (even if empty)
|
|
1029
1044
|
},
|
|
1030
1045
|
}
|
|
1031
1046
|
);
|
|
@@ -1037,6 +1052,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
1037
1052
|
};
|
|
1038
1053
|
});
|
|
1039
1054
|
|
|
1055
|
+
// List available resources (ekkOS uses tools, not resources, but we support the request)
|
|
1056
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
1057
|
+
return {
|
|
1058
|
+
resources: [], // ekkOS uses tools for all operations, not resources
|
|
1059
|
+
};
|
|
1060
|
+
});
|
|
1061
|
+
|
|
1040
1062
|
// User-friendly tool names for display
|
|
1041
1063
|
const toolDisplayNames: Record<string, string> = {
|
|
1042
1064
|
'search_memory': '🔍 Search Memory',
|
|
@@ -1770,15 +1792,16 @@ The ingestion worker will pick this up within 1-5 minutes.`,
|
|
|
1770
1792
|
|
|
1771
1793
|
try {
|
|
1772
1794
|
// Insert directly into patterns table via Supabase
|
|
1773
|
-
|
|
1774
|
-
const
|
|
1795
|
+
// Use the same SUPABASE_URL and SUPABASE_KEY from top-level config
|
|
1796
|
+
const localSupabaseUrl = SUPABASE_URL;
|
|
1797
|
+
const localSupabaseKey = SUPABASE_KEY;
|
|
1775
1798
|
|
|
1776
|
-
const insertResponse = await fetch(`${
|
|
1799
|
+
const insertResponse = await fetch(`${localSupabaseUrl}/rest/v1/patterns`, {
|
|
1777
1800
|
method: 'POST',
|
|
1778
1801
|
headers: {
|
|
1779
1802
|
'Content-Type': 'application/json',
|
|
1780
|
-
'apikey':
|
|
1781
|
-
'Authorization': `Bearer ${
|
|
1803
|
+
'apikey': localSupabaseKey as string,
|
|
1804
|
+
'Authorization': `Bearer ${localSupabaseKey}`,
|
|
1782
1805
|
'Prefer': 'return=representation',
|
|
1783
1806
|
},
|
|
1784
1807
|
body: JSON.stringify({
|
|
@@ -1897,7 +1920,7 @@ Future agents will find it when facing similar problems.
|
|
|
1897
1920
|
try {
|
|
1898
1921
|
const stats = await fetchMemory('/api/v1/memory/metrics');
|
|
1899
1922
|
|
|
1900
|
-
const formatted = `**
|
|
1923
|
+
const formatted = `**ekkOS Memory Layer Statistics** (10-Layer Architecture)
|
|
1901
1924
|
|
|
1902
1925
|
**Core Memory Layers:**
|
|
1903
1926
|
- 🧠 Layer 2 (Episodic): ${stats.episodic || 0} episodes
|
|
@@ -1955,7 +1978,7 @@ The memory metrics endpoint may not be available. Check that:
|
|
|
1955
1978
|
This is ekkOS, the memory substrate for AI agents.
|
|
1956
1979
|
|
|
1957
1980
|
**Connection Status:** ✅ MCP server is running and responding
|
|
1958
|
-
**Server:**
|
|
1981
|
+
**Server:** ekkOS Memory MCP Server v1.2.1
|
|
1959
1982
|
**Time:** ${new Date().toISOString()}
|
|
1960
1983
|
|
|
1961
1984
|
You've successfully connected to ekkOS via the Model Context Protocol. This proves that:
|
package/package.json
CHANGED