kratos-mcp 4.0.0 โ 4.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.
- package/README.md +177 -329
- package/bin/kratos-mcp +11 -9
- package/dist/cli/capture-handler.d.ts +13 -0
- package/dist/cli/capture-handler.d.ts.map +1 -0
- package/dist/cli/capture-handler.js +112 -0
- package/dist/cli/capture-handler.js.map +1 -0
- package/dist/cli/commands/ask.d.ts +5 -0
- package/dist/cli/commands/ask.d.ts.map +1 -0
- package/dist/cli/commands/ask.js +64 -0
- package/dist/cli/commands/ask.js.map +1 -0
- package/dist/cli/commands/capture.d.ts +5 -0
- package/dist/cli/commands/capture.d.ts.map +1 -0
- package/dist/cli/commands/capture.js +31 -0
- package/dist/cli/commands/capture.js.map +1 -0
- package/dist/cli/commands/forget.d.ts +3 -0
- package/dist/cli/commands/forget.d.ts.map +1 -0
- package/dist/cli/commands/forget.js +12 -0
- package/dist/cli/commands/forget.js.map +1 -0
- package/dist/cli/commands/get.d.ts +3 -0
- package/dist/cli/commands/get.d.ts.map +1 -0
- package/dist/cli/commands/get.js +28 -0
- package/dist/cli/commands/get.js.map +1 -0
- package/dist/cli/commands/hooks.d.ts +2 -0
- package/dist/cli/commands/hooks.d.ts.map +1 -0
- package/dist/cli/commands/hooks.js +136 -0
- package/dist/cli/commands/hooks.js.map +1 -0
- package/dist/cli/commands/migrate.d.ts +5 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +56 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/recent.d.ts +6 -0
- package/dist/cli/commands/recent.d.ts.map +1 -0
- package/dist/cli/commands/recent.js +21 -0
- package/dist/cli/commands/recent.js.map +1 -0
- package/dist/cli/commands/save.d.ts +8 -0
- package/dist/cli/commands/save.d.ts.map +1 -0
- package/dist/cli/commands/save.js +31 -0
- package/dist/cli/commands/save.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +5 -0
- package/dist/cli/commands/scan.d.ts.map +1 -0
- package/dist/cli/commands/scan.js +28 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/commands/search.d.ts +8 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +45 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/status.d.ts +3 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +89 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/switch.d.ts +3 -0
- package/dist/cli/commands/switch.d.ts.map +1 -0
- package/dist/cli/commands/switch.js +18 -0
- package/dist/cli/commands/switch.js.map +1 -0
- package/dist/cli/core.d.ts +15 -0
- package/dist/cli/core.d.ts.map +1 -0
- package/dist/cli/core.js +18 -0
- package/dist/cli/core.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +176 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/output.d.ts +22 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +74 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/compression/api-compressor.d.ts +15 -0
- package/dist/compression/api-compressor.d.ts.map +1 -0
- package/dist/compression/api-compressor.js +84 -0
- package/dist/compression/api-compressor.js.map +1 -0
- package/dist/compression/factory.d.ts +6 -0
- package/dist/compression/factory.d.ts.map +1 -0
- package/dist/compression/factory.js +8 -0
- package/dist/compression/factory.js.map +1 -0
- package/dist/compression/index.d.ts +10 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/index.js +2 -0
- package/dist/compression/index.js.map +1 -0
- package/dist/compression/ollama-compressor.d.ts +9 -0
- package/dist/compression/ollama-compressor.d.ts.map +1 -0
- package/dist/compression/ollama-compressor.js +51 -0
- package/dist/compression/ollama-compressor.js.map +1 -0
- package/dist/compression/rule-compressor.d.ts +9 -0
- package/dist/compression/rule-compressor.d.ts.map +1 -0
- package/dist/compression/rule-compressor.js +43 -0
- package/dist/compression/rule-compressor.js.map +1 -0
- package/dist/memory-server/database.d.ts.map +1 -1
- package/dist/memory-server/database.js.map +1 -1
- package/dist/memory-server/embeddings-api.d.ts +14 -0
- package/dist/memory-server/embeddings-api.d.ts.map +1 -0
- package/dist/memory-server/embeddings-api.js +37 -0
- package/dist/memory-server/embeddings-api.js.map +1 -0
- package/dist/memory-server/embeddings-ollama.d.ts +14 -0
- package/dist/memory-server/embeddings-ollama.d.ts.map +1 -0
- package/dist/memory-server/embeddings-ollama.js +46 -0
- package/dist/memory-server/embeddings-ollama.js.map +1 -0
- package/dist/memory-server/embeddings.d.ts +9 -0
- package/dist/memory-server/embeddings.d.ts.map +1 -0
- package/dist/memory-server/embeddings.js +2 -0
- package/dist/memory-server/embeddings.js.map +1 -0
- package/dist/memory-server/hybrid-search.d.ts +22 -0
- package/dist/memory-server/hybrid-search.d.ts.map +1 -0
- package/dist/memory-server/hybrid-search.js +33 -0
- package/dist/memory-server/hybrid-search.js.map +1 -0
- package/dist/memory-server/vector-store.d.ts +30 -0
- package/dist/memory-server/vector-store.d.ts.map +1 -0
- package/dist/memory-server/vector-store.js +99 -0
- package/dist/memory-server/vector-store.js.map +1 -0
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -1,408 +1,256 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```
|
|
4
|
+
โโโ โโโโโโโโโโ โโโโโโ โโโโโโโโโ โโโโโโโ โโโโโโโโ
|
|
5
|
+
โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
6
|
+
โโโโโโโ โโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโ
|
|
7
|
+
โโโโโโโ โโโโโโโโโโโโโโโโ โโโ โโโ โโโโโโโโโโโ
|
|
8
|
+
โโโ โโโโโโ โโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโโ
|
|
9
|
+
โโโ โโโโโโ โโโโโโ โโโ โโโ โโโโโโโ โโโโโโโโ
|
|
10
|
+
```
|
|
4
11
|
|
|
5
|
-
###
|
|
12
|
+
### The God of War remembers everything.
|
|
6
13
|
|
|
7
14
|
[](https://www.npmjs.com/package/kratos-mcp)
|
|
8
15
|
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
[](https://modelcontextprotocol.io)
|
|
10
16
|
[](https://www.typescriptlang.org/)
|
|
11
17
|
|
|
12
|
-
**
|
|
18
|
+
**Persistent memory for AI coding agents. CLI-first. Auto-capture. Encrypted. Zero network calls.**
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
[Installation](#installation) ยท [Quick Start](#quick-start) ยท [Commands](#commands) ยท [Plugin](#plugin-mode) ยท [Security](#security)
|
|
15
21
|
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
24
|
---
|
|
19
25
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
After building 30+ production apps with AI, we discovered a critical problem: **AI tools forget everything between sessions**. You explain your architecture, your patterns, your decisionsโand tomorrow, you explain it all again.
|
|
23
|
-
|
|
24
|
-
Kratos MCP solves this with an **ultra-lean memory system** that gives AI perfect recall of your projectโwith minimal context overhead.
|
|
25
|
-
|
|
26
|
-
## โจ Features
|
|
26
|
+
## What is Kratos?
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
<tr>
|
|
30
|
-
<td width="50%">
|
|
28
|
+
AI coding tools forget everything between sessions. You explain your architecture, your patterns, your decisions โ and tomorrow, you explain it all again.
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
Each project gets its own SQLite database. No cross-contamination. Ever.
|
|
30
|
+
Kratos gives your AI agent **permanent memory**. It auto-captures what happens during coding sessions and recalls relevant context when you start a new one. No manual work. No setup. Just install and code.
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
```
|
|
33
|
+
Session 1: You build auth with JWT โ Kratos remembers
|
|
34
|
+
Session 2: "How does auth work?" โ Kratos recalls instantly
|
|
35
|
+
```
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
Auto-detects projects via git, package.json, or directory structure. Just install and code.
|
|
37
|
+
## Installation
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<td width="50%">
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g kratos-mcp
|
|
41
|
+
```
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
Just 12 essential tools. 64% smaller context footprint than competitors.
|
|
43
|
+
That's it. Kratos auto-detects your project from `.git`, `package.json`, `Cargo.toml`, `go.mod`, or `pyproject.toml`.
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
<td width="50%">
|
|
45
|
+
## Quick Start
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
```bash
|
|
48
|
+
# Save a memory
|
|
49
|
+
kratos save "Auth uses JWT with RS256, refresh tokens in httpOnly cookies" --tags auth,jwt --importance 5
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</table>
|
|
51
|
+
# Search memories
|
|
52
|
+
kratos search "authentication"
|
|
58
53
|
|
|
59
|
-
|
|
54
|
+
# Ask in natural language
|
|
55
|
+
kratos ask "how does the auth system work?"
|
|
60
56
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
# See what Kratos knows
|
|
58
|
+
kratos status
|
|
59
|
+
```
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
npx kratos-mcp
|
|
61
|
+
**Output:**
|
|
67
62
|
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
```
|
|
64
|
+
KRATOS โ Memory System
|
|
65
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
66
|
+
|
|
67
|
+
ACTIVE PROJECT
|
|
68
|
+
โ my-app
|
|
69
|
+
|
|
70
|
+
MEMORY STATS
|
|
71
|
+
Total: 47
|
|
72
|
+
Last saved: 3/15/2026, 2:16:21 PM
|
|
73
|
+
Importance:
|
|
74
|
+
5 โโโโโโโโโโโโโโโโโโโโ 12
|
|
75
|
+
4 โโโโโโโโโโโโโโโโโโโโ 8
|
|
76
|
+
3 โโโโโโโโโโโโโโโโโโโโ 5
|
|
77
|
+
2 โโโโโโโโโโโโโโโโโโโโ 4
|
|
78
|
+
1 โโโโโโโโโโโโโโโโโโโโ 0
|
|
79
|
+
|
|
80
|
+
TOP TAGS
|
|
81
|
+
#auth(5) #database(4) #api(3) #frontend(2)
|
|
82
|
+
|
|
83
|
+
FEATURES
|
|
84
|
+
โ FTS5 Full-Text Search
|
|
85
|
+
โ AES-256-GCM Encryption
|
|
86
|
+
โ PII/Secret Detection
|
|
87
|
+
โ Smart Compression
|
|
88
|
+
โ Auto-Capture Hooks
|
|
70
89
|
```
|
|
71
90
|
|
|
72
|
-
##
|
|
91
|
+
## Commands
|
|
73
92
|
|
|
74
|
-
|
|
93
|
+
| Command | Description |
|
|
94
|
+
|---------|-------------|
|
|
95
|
+
| `kratos save <text>` | Save a memory (`--tags`, `--importance 1-5`, `--paths`, `--compress`) |
|
|
96
|
+
| `kratos search <query>` | Full-text search (`--limit`, `--tags`, `--debug`) |
|
|
97
|
+
| `kratos ask <question>` | Natural language query |
|
|
98
|
+
| `kratos recent` | Recent memories (`--limit`) |
|
|
99
|
+
| `kratos get <id>` | Full memory details |
|
|
100
|
+
| `kratos forget <id>` | Delete a memory |
|
|
101
|
+
| `kratos status` | System dashboard |
|
|
102
|
+
| `kratos switch <path>` | Switch project |
|
|
103
|
+
| `kratos scan <text>` | Detect PII/secrets (`--redact`) |
|
|
104
|
+
| `kratos migrate` | Verify existing data for CLI use |
|
|
105
|
+
| `kratos hooks install` | Install auto-capture hooks for Claude Code |
|
|
106
|
+
| `kratos hooks uninstall` | Remove hooks |
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
<summary><b>Claude Desktop</b></summary>
|
|
108
|
+
## Plugin Mode
|
|
78
109
|
|
|
79
|
-
|
|
80
|
-
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
81
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
82
|
-
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
110
|
+
Kratos works as a **Claude Code plugin** for fully automatic memory capture. No manual commands needed โ everything happens in the background.
|
|
83
111
|
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
"mcpServers": {
|
|
87
|
-
"kratos": {
|
|
88
|
-
"command": "npx",
|
|
89
|
-
"args": ["--yes", "kratos-mcp@latest"]
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
```
|
|
112
|
+
### Install as Plugin
|
|
94
113
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
"mcpServers": {
|
|
99
|
-
"kratos": {
|
|
100
|
-
"command": "kratos-mcp",
|
|
101
|
-
"args": []
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
114
|
+
```bash
|
|
115
|
+
claude --plugin-dir ./plugin
|
|
105
116
|
```
|
|
106
|
-
</details>
|
|
107
117
|
|
|
108
|
-
|
|
109
|
-
<summary><b>Claude Code (Anthropic's VSCode Extension)</b></summary>
|
|
118
|
+
### What Happens Automatically
|
|
110
119
|
|
|
111
|
-
|
|
120
|
+
| Event | Action |
|
|
121
|
+
|-------|--------|
|
|
122
|
+
| **Session starts** | Loads recent memories into Claude's context |
|
|
123
|
+
| **You edit a file** | Captures what changed, saves as memory |
|
|
124
|
+
| **You run a command** | Captures the command and result |
|
|
125
|
+
| **Session ends** | Claude summarizes the session (using the host LLM โ free, no API key) and saves it |
|
|
112
126
|
|
|
113
|
-
|
|
114
|
-
claude mcp add kratos -- npx --yes kratos-mcp@latest
|
|
115
|
-
```
|
|
127
|
+
The plugin uses Claude Code's built-in `type: "prompt"` hook โ Claude itself compresses your session memories. No external AI, no Ollama, no API keys, no network calls.
|
|
116
128
|
|
|
117
|
-
|
|
129
|
+
### Plugin Structure
|
|
118
130
|
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
#
|
|
124
|
-
|
|
131
|
+
```
|
|
132
|
+
plugin/
|
|
133
|
+
.claude-plugin/plugin.json # Manifest
|
|
134
|
+
hooks/hooks.json # Lifecycle hooks (PostToolUse, Stop, etc.)
|
|
135
|
+
skills/kratos-memory/SKILL.md # Teaches Claude how to use kratos
|
|
136
|
+
scripts/ # Hook handlers
|
|
137
|
+
.mcp.json # MCP server (backward compat)
|
|
125
138
|
```
|
|
126
139
|
|
|
127
|
-
|
|
128
|
-
</details>
|
|
140
|
+
## Security
|
|
129
141
|
|
|
130
|
-
|
|
131
|
-
<summary><b>Cursor</b></summary>
|
|
142
|
+
Kratos was built with security as a core feature, not an afterthought.
|
|
132
143
|
|
|
133
|
-
|
|
144
|
+
| Feature | Detail |
|
|
145
|
+
|---------|--------|
|
|
146
|
+
| **AES-256-GCM Encryption** | Memories encrypted at rest with per-project keys |
|
|
147
|
+
| **PII Detection** | Auto-detects SSN, credit cards, emails, phone numbers, IPs, DOB |
|
|
148
|
+
| **Secret Detection** | Catches API keys, AWS keys, GitHub tokens, JWTs, private keys, passwords |
|
|
149
|
+
| **Project Isolation** | Each project has its own SQLite database โ zero cross-contamination |
|
|
150
|
+
| **Zero Network Calls** | Nothing leaves your machine. Ever. No telemetry, no analytics, no cloud. |
|
|
151
|
+
| **Key Rotation** | Rotate encryption keys without data loss |
|
|
134
152
|
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
"kratos": {
|
|
139
|
-
"command": "npx",
|
|
140
|
-
"args": ["--yes", "kratos-mcp@latest"]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
</details>
|
|
153
|
+
```bash
|
|
154
|
+
# Scan text before saving
|
|
155
|
+
kratos scan "My API key is sk-1234abcd..." --redact
|
|
146
156
|
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
# Output:
|
|
158
|
+
# โ Secrets detected!
|
|
159
|
+
# โ API Key (secret, confidence: 0.9)
|
|
160
|
+
# Redacted: My API key is sk-[REDACTED_SECRET]...
|
|
161
|
+
```
|
|
149
162
|
|
|
150
|
-
|
|
163
|
+
## How It Works
|
|
151
164
|
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
165
|
+
```
|
|
166
|
+
You code with Claude
|
|
167
|
+
โ
|
|
168
|
+
PostToolUse hook fires (auto)
|
|
169
|
+
โ
|
|
170
|
+
Observation captured + compressed
|
|
171
|
+
โ
|
|
172
|
+
Saved to per-project SQLite + FTS5
|
|
173
|
+
โ
|
|
174
|
+
Next session starts
|
|
175
|
+
โ
|
|
176
|
+
SessionStart hook loads recent context
|
|
177
|
+
โ
|
|
178
|
+
Claude knows what happened last time
|
|
157
179
|
```
|
|
158
180
|
|
|
159
|
-
**
|
|
160
|
-
|
|
161
|
-
Check your tool's documentation for specific MCP server configuration location.
|
|
181
|
+
**Performance:**
|
|
162
182
|
|
|
163
|
-
|
|
183
|
+
| Metric | Value |
|
|
184
|
+
|--------|-------|
|
|
185
|
+
| Memory retrieval | < 10ms |
|
|
186
|
+
| Project switch | < 100ms |
|
|
187
|
+
| Storage per project | ~2MB |
|
|
188
|
+
| Search engine | SQLite FTS5 (porter tokenizer) |
|
|
164
189
|
|
|
165
|
-
|
|
190
|
+
## Data Storage
|
|
166
191
|
|
|
167
|
-
```typescript
|
|
168
|
-
// Your AI now remembers:
|
|
169
|
-
// โ Your authentication patterns
|
|
170
|
-
// โ Your API structure
|
|
171
|
-
// โ Your component architecture
|
|
172
|
-
// โ Your coding standards
|
|
173
|
-
// โ Every decision you've made
|
|
174
192
|
```
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<td><code>memory_save</code></td>
|
|
189
|
-
<td>Store important project knowledge with tags, paths, and importance levels</td>
|
|
190
|
-
</tr>
|
|
191
|
-
<tr>
|
|
192
|
-
<td><code>memory_search</code></td>
|
|
193
|
-
<td>Smart semantic search with debug mode and path matching</td>
|
|
194
|
-
</tr>
|
|
195
|
-
<tr>
|
|
196
|
-
<td><code>memory_ask</code></td>
|
|
197
|
-
<td>Natural language queries about your memories</td>
|
|
198
|
-
</tr>
|
|
199
|
-
<tr>
|
|
200
|
-
<td><code>memory_get_recent</code></td>
|
|
201
|
-
<td>Get recently created memories with filtering</td>
|
|
202
|
-
</tr>
|
|
203
|
-
<tr>
|
|
204
|
-
<td><code>memory_get</code></td>
|
|
205
|
-
<td>Retrieve a specific memory by ID</td>
|
|
206
|
-
</tr>
|
|
207
|
-
<tr>
|
|
208
|
-
<td><code>memory_get_multiple</code></td>
|
|
209
|
-
<td>Bulk retrieve multiple memories</td>
|
|
210
|
-
</tr>
|
|
211
|
-
<tr>
|
|
212
|
-
<td><code>memory_forget</code></td>
|
|
213
|
-
<td>Delete a memory by ID</td>
|
|
214
|
-
</tr>
|
|
215
|
-
</table>
|
|
216
|
-
|
|
217
|
-
### ๐ Security (1 tool)
|
|
218
|
-
|
|
219
|
-
<table>
|
|
220
|
-
<tr>
|
|
221
|
-
<th>Tool</th>
|
|
222
|
-
<th>Description</th>
|
|
223
|
-
</tr>
|
|
224
|
-
<tr>
|
|
225
|
-
<td><code>security_scan</code></td>
|
|
226
|
-
<td>Scan text for PII and secrets before saving</td>
|
|
227
|
-
</tr>
|
|
228
|
-
</table>
|
|
229
|
-
|
|
230
|
-
### ๐ Project Management (3 tools)
|
|
231
|
-
|
|
232
|
-
<table>
|
|
233
|
-
<tr>
|
|
234
|
-
<th>Tool</th>
|
|
235
|
-
<th>Description</th>
|
|
236
|
-
</tr>
|
|
237
|
-
<tr>
|
|
238
|
-
<td><code>project_switch</code></td>
|
|
239
|
-
<td>Switch between different projects</td>
|
|
240
|
-
</tr>
|
|
241
|
-
<tr>
|
|
242
|
-
<td><code>project_current</code></td>
|
|
243
|
-
<td>Get current active project info</td>
|
|
244
|
-
</tr>
|
|
245
|
-
<tr>
|
|
246
|
-
<td><code>change_storage_path</code></td>
|
|
247
|
-
<td>Dynamically change storage location with automatic data migration</td>
|
|
248
|
-
</tr>
|
|
249
|
-
</table>
|
|
250
|
-
|
|
251
|
-
### โ๏ธ System (1 tool)
|
|
252
|
-
|
|
253
|
-
<table>
|
|
254
|
-
<tr>
|
|
255
|
-
<th>Tool</th>
|
|
256
|
-
<th>Description</th>
|
|
257
|
-
</tr>
|
|
258
|
-
<tr>
|
|
259
|
-
<td><code>system_status</code></td>
|
|
260
|
-
<td>Get system status and memory statistics</td>
|
|
261
|
-
</tr>
|
|
262
|
-
</table>
|
|
263
|
-
|
|
264
|
-
## ๐ How It Works
|
|
265
|
-
|
|
266
|
-
```mermaid
|
|
267
|
-
graph LR
|
|
268
|
-
A[Your Code] --> B[Kratos MCP]
|
|
269
|
-
B --> C{Project Detection}
|
|
270
|
-
C --> D[SQLite Database]
|
|
271
|
-
D --> E[Memory Storage]
|
|
272
|
-
E --> F[AI Tool]
|
|
273
|
-
F --> G[Perfect Context]
|
|
193
|
+
~/.kratos/
|
|
194
|
+
โโโ projects/
|
|
195
|
+
โ โโโ proj_abc123/
|
|
196
|
+
โ โ โโโ databases/
|
|
197
|
+
โ โ โ โโโ memories.db # SQLite + FTS5
|
|
198
|
+
โ โ โโโ sessions/
|
|
199
|
+
โ โ โ โโโ current.json # Active session buffer
|
|
200
|
+
โ โ โโโ project.json # Project metadata
|
|
201
|
+
โ โโโ proj_def456/
|
|
202
|
+
โ โโโ ...
|
|
203
|
+
โโโ .keys/
|
|
204
|
+
โ โโโ proj_abc123.key # AES-256 encryption key
|
|
205
|
+
โโโ projects.json # Project registry
|
|
274
206
|
```
|
|
275
207
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
- **SQLite + FTS5**: Lightning-fast full-text search
|
|
279
|
-
- **Smart Scoring**: Path matching + recency + importance
|
|
280
|
-
- **Auto-detection**: Git, package.json, or directory-based
|
|
281
|
-
- **Secure**: All data stays local, no external calls
|
|
282
|
-
- **Lean**: Only 4 core components, minimal memory footprint
|
|
283
|
-
|
|
284
|
-
## ๐ Performance
|
|
285
|
-
|
|
286
|
-
<table>
|
|
287
|
-
<tr>
|
|
288
|
-
<th>Metric</th>
|
|
289
|
-
<th>Value</th>
|
|
290
|
-
</tr>
|
|
291
|
-
<tr>
|
|
292
|
-
<td>Context Overhead</td>
|
|
293
|
-
<td>64% smaller than v3</td>
|
|
294
|
-
</tr>
|
|
295
|
-
<tr>
|
|
296
|
-
<td>Memory Retrieval</td>
|
|
297
|
-
<td>< 10ms</td>
|
|
298
|
-
</tr>
|
|
299
|
-
<tr>
|
|
300
|
-
<td>Project Switch</td>
|
|
301
|
-
<td>< 100ms</td>
|
|
302
|
-
</tr>
|
|
303
|
-
<tr>
|
|
304
|
-
<td>Storage Overhead</td>
|
|
305
|
-
<td>~2MB per project</td>
|
|
306
|
-
</tr>
|
|
307
|
-
</table>
|
|
308
|
-
|
|
309
|
-
## ๐๏ธ Memory Structure
|
|
208
|
+
Each project is completely isolated. Different database, different encryption key, different everything.
|
|
310
209
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
โ โโโ project-id-2/
|
|
317
|
-
โ โโโ memories.db
|
|
318
|
-
โโโ global/
|
|
319
|
-
โโโ global.db # Shared knowledge (optional)
|
|
320
|
-
```
|
|
210
|
+
## MCP Support (Deprecated)
|
|
211
|
+
|
|
212
|
+
> **Note:** MCP support is deprecated and will be removed in a future version. The CLI and plugin are the recommended interfaces going forward. MCP consumed too much context per tool call.
|
|
213
|
+
|
|
214
|
+
If you still need MCP mode:
|
|
321
215
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
## ๐ก Example Usage
|
|
325
|
-
|
|
326
|
-
```typescript
|
|
327
|
-
// Save a memory
|
|
328
|
-
await memory_save({
|
|
329
|
-
summary: "JWT auth implementation",
|
|
330
|
-
text: "We use httpOnly cookies with refresh tokens...",
|
|
331
|
-
tags: ["auth", "security"],
|
|
332
|
-
paths: ["src/middleware/auth.ts"],
|
|
333
|
-
importance: 5
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
// Search memories
|
|
337
|
-
await memory_search({
|
|
338
|
-
q: "authentication",
|
|
339
|
-
k: 5,
|
|
340
|
-
debug: true // Get search insights
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
// Ask natural language questions
|
|
344
|
-
await memory_ask({
|
|
345
|
-
question: "How does our auth system work?",
|
|
346
|
-
limit: 10
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
// Change storage location
|
|
350
|
-
await change_storage_path({
|
|
351
|
-
newPath: "/opt/kratos",
|
|
352
|
-
migrate: true,
|
|
353
|
-
backup: true
|
|
354
|
-
});
|
|
216
|
+
```bash
|
|
217
|
+
kratos mcp
|
|
355
218
|
```
|
|
356
219
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
// AI Response: "Your auth uses JWT with refresh tokens
|
|
368
|
-
// stored in httpOnly cookies. The middleware validates
|
|
369
|
-
// tokens on protected routes at /api/middleware/auth.ts:42..."
|
|
220
|
+
Or in your MCP client config:
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"mcpServers": {
|
|
224
|
+
"kratos": {
|
|
225
|
+
"command": "npx",
|
|
226
|
+
"args": ["kratos-mcp"]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
370
230
|
```
|
|
371
231
|
|
|
372
|
-
|
|
232
|
+
Existing MCP users: run `kratos migrate` to verify your data works with the CLI. No data copy needed โ same database format.
|
|
373
233
|
|
|
374
|
-
|
|
234
|
+
## Contributing
|
|
375
235
|
|
|
376
236
|
```bash
|
|
377
|
-
# Clone the repo
|
|
378
237
|
git clone https://github.com/ceorkm/kratos-mcp.git
|
|
379
|
-
|
|
380
|
-
# Install dependencies
|
|
238
|
+
cd kratos-mcp
|
|
381
239
|
npm install
|
|
382
|
-
|
|
383
|
-
# Build
|
|
384
240
|
npm run build
|
|
385
|
-
|
|
386
|
-
# Run in development
|
|
387
|
-
npm run dev
|
|
241
|
+
npm run cli # Run CLI in dev mode
|
|
388
242
|
```
|
|
389
243
|
|
|
390
|
-
##
|
|
391
|
-
|
|
392
|
-
MIT ยฉ 2025 Kratos MCP Contributors
|
|
393
|
-
|
|
394
|
-
## ๐ Acknowledgments
|
|
395
|
-
|
|
396
|
-
Built on the [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic.
|
|
244
|
+
## License
|
|
397
245
|
|
|
398
|
-
|
|
246
|
+
MIT
|
|
399
247
|
|
|
400
248
|
---
|
|
401
249
|
|
|
402
250
|
<div align="center">
|
|
403
251
|
|
|
404
|
-
**Built for developers who
|
|
252
|
+
**Built for developers who are tired of repeating themselves.**
|
|
405
253
|
|
|
406
|
-
[Report Bug](https://github.com/ceorkm/kratos-mcp/issues)
|
|
254
|
+
[Report Bug](https://github.com/ceorkm/kratos-mcp/issues) ยท [Request Feature](https://github.com/ceorkm/kratos-mcp/issues)
|
|
407
255
|
|
|
408
256
|
</div>
|
package/bin/kratos-mcp
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// Kratos Memory โ CLI + MCP Server
|
|
4
|
+
// Mode detection:
|
|
5
|
+
// - CLI mode: when called with subcommands (save, search, etc.)
|
|
6
|
+
// - MCP mode: when stdin is piped (no TTY) with no args, or via `kratos mcp`
|
|
7
|
+
// This preserves backward compatibility with existing MCP configurations.
|
|
5
8
|
|
|
6
9
|
import { fileURLToPath } from 'url';
|
|
7
10
|
import { dirname, join } from 'path';
|
|
@@ -10,20 +13,19 @@ import { spawn } from 'child_process';
|
|
|
10
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
14
|
const __dirname = dirname(__filename);
|
|
12
15
|
|
|
13
|
-
//
|
|
14
|
-
const
|
|
16
|
+
// Route to the CLI entry point (which handles both CLI and MCP mode detection)
|
|
17
|
+
const cliPath = join(__dirname, '..', 'dist', 'cli', 'index.js');
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
const child = spawn(process.execPath, [indexPath], {
|
|
19
|
+
const child = spawn(process.execPath, [cliPath, ...process.argv.slice(2)], {
|
|
18
20
|
stdio: 'inherit',
|
|
19
|
-
env: { ...process.env
|
|
21
|
+
env: { ...process.env }
|
|
20
22
|
});
|
|
21
23
|
|
|
22
24
|
child.on('error', (err) => {
|
|
23
|
-
console.error('Failed to start Kratos
|
|
25
|
+
console.error('Failed to start Kratos:', err);
|
|
24
26
|
process.exit(1);
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
child.on('exit', (code) => {
|
|
28
30
|
process.exit(code || 0);
|
|
29
|
-
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CLIContext } from './core.js';
|
|
2
|
+
export declare class CaptureHandler {
|
|
3
|
+
private ctx;
|
|
4
|
+
private bufferPath;
|
|
5
|
+
private compressor;
|
|
6
|
+
constructor(ctx: CLIContext);
|
|
7
|
+
handlePostToolUse(data: any): Promise<void>;
|
|
8
|
+
handleSessionEnd(_data: any): Promise<void>;
|
|
9
|
+
private appendToBuffer;
|
|
10
|
+
private loadBuffer;
|
|
11
|
+
private clearBuffer;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=capture-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-handler.d.ts","sourceRoot":"","sources":["../../src/cli/capture-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAqB5C,qBAAa,cAAc;IACzB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAsB;gBAE5B,GAAG,EAAE,UAAU;IAMrB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAgD3C,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YA4BnC,cAAc;YAgBd,UAAU;YAWV,WAAW;CAO1B"}
|