kratos-mcp 1.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/LICENSE +21 -0
- package/README.md +351 -0
- package/dist/host-middleware-v2.d.ts +3 -0
- package/dist/host-middleware-v2.d.ts.map +1 -0
- package/dist/host-middleware-v2.js +471 -0
- package/dist/host-middleware-v2.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +939 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-server/concept-store-enhanced.d.ts +88 -0
- package/dist/memory-server/concept-store-enhanced.d.ts.map +1 -0
- package/dist/memory-server/concept-store-enhanced.js +392 -0
- package/dist/memory-server/concept-store-enhanced.js.map +1 -0
- package/dist/memory-server/concept-store.d.ts +58 -0
- package/dist/memory-server/concept-store.d.ts.map +1 -0
- package/dist/memory-server/concept-store.js +329 -0
- package/dist/memory-server/concept-store.js.map +1 -0
- package/dist/memory-server/context-broker.d.ts +63 -0
- package/dist/memory-server/context-broker.d.ts.map +1 -0
- package/dist/memory-server/context-broker.js +340 -0
- package/dist/memory-server/context-broker.js.map +1 -0
- package/dist/memory-server/database.d.ts +61 -0
- package/dist/memory-server/database.d.ts.map +1 -0
- package/dist/memory-server/database.js +309 -0
- package/dist/memory-server/database.js.map +1 -0
- package/dist/modules/prd/index.d.ts +47 -0
- package/dist/modules/prd/index.d.ts.map +1 -0
- package/dist/modules/prd/index.js +220 -0
- package/dist/modules/prd/index.js.map +1 -0
- package/dist/modules/prompt/index.d.ts +47 -0
- package/dist/modules/prompt/index.d.ts.map +1 -0
- package/dist/modules/prompt/index.js +313 -0
- package/dist/modules/prompt/index.js.map +1 -0
- package/dist/project-manager.d.ts +69 -0
- package/dist/project-manager.d.ts.map +1 -0
- package/dist/project-manager.js +207 -0
- package/dist/project-manager.js.map +1 -0
- package/dist/security/data-retention.d.ts +104 -0
- package/dist/security/data-retention.d.ts.map +1 -0
- package/dist/security/data-retention.js +444 -0
- package/dist/security/data-retention.js.map +1 -0
- package/dist/security/encryption.d.ts +48 -0
- package/dist/security/encryption.d.ts.map +1 -0
- package/dist/security/encryption.js +131 -0
- package/dist/security/encryption.js.map +1 -0
- package/dist/security/pii-detector.d.ts +61 -0
- package/dist/security/pii-detector.d.ts.map +1 -0
- package/dist/security/pii-detector.js +220 -0
- package/dist/security/pii-detector.js.map +1 -0
- package/dist/tools/ci-hooks.d.ts +48 -0
- package/dist/tools/ci-hooks.d.ts.map +1 -0
- package/dist/tools/ci-hooks.js +452 -0
- package/dist/tools/ci-hooks.js.map +1 -0
- package/dist/tools/migrate-to-sqlite.d.ts +32 -0
- package/dist/tools/migrate-to-sqlite.d.ts.map +1 -0
- package/dist/tools/migrate-to-sqlite.js +341 -0
- package/dist/tools/migrate-to-sqlite.js.map +1 -0
- package/dist/types/index.d.ts +151 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +33 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-logger.d.ts +14 -0
- package/dist/utils/mcp-logger.d.ts.map +1 -0
- package/dist/utils/mcp-logger.js +40 -0
- package/dist/utils/mcp-logger.js.map +1 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Kratos Protocol Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🏛️ Kratos MCP
|
|
4
|
+
|
|
5
|
+
### Memory System for AI Coding Tools
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/kratos-mcp)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://modelcontextprotocol.io)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
|
|
12
|
+
**Never explain your codebase again. Let AI remember everything.**
|
|
13
|
+
|
|
14
|
+
[Installation](#-installation) • [Quick Start](#-quick-start) • [Features](#-features) • [Documentation](#-documentation) • [Contributing](#-contributing)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🎯 Why Kratos?
|
|
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 the **Four Pillars Framework**—a battle-tested system that gives AI perfect memory of your project.
|
|
25
|
+
|
|
26
|
+
<div align="center">
|
|
27
|
+
<img src="https://via.placeholder.com/800x400/1a1a1a/ffffff?text=Kratos+MCP+Architecture" alt="Kratos Architecture" width="100%" />
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## ✨ Features
|
|
31
|
+
|
|
32
|
+
<table>
|
|
33
|
+
<tr>
|
|
34
|
+
<td width="50%">
|
|
35
|
+
|
|
36
|
+
### 🔒 **100% Project Isolation**
|
|
37
|
+
Each project gets its own SQLite database. No cross-contamination. Ever.
|
|
38
|
+
|
|
39
|
+
</td>
|
|
40
|
+
<td width="50%">
|
|
41
|
+
|
|
42
|
+
### 🎯 **95.8% Context Accuracy**
|
|
43
|
+
Smart retrieval engine that knows exactly what memories matter for your current task.
|
|
44
|
+
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td width="50%">
|
|
49
|
+
|
|
50
|
+
### ⚡ **Zero Configuration**
|
|
51
|
+
Auto-detects projects via git, package.json, or directory structure. Just install and code.
|
|
52
|
+
|
|
53
|
+
</td>
|
|
54
|
+
<td width="50%">
|
|
55
|
+
|
|
56
|
+
### 🌍 **Universal Protocol**
|
|
57
|
+
Works with Claude, Cursor, Windsurf, Continue—any MCP-compatible tool.
|
|
58
|
+
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
|
|
63
|
+
## 🚀 Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Install globally
|
|
67
|
+
npm install -g kratos-mcp
|
|
68
|
+
|
|
69
|
+
# Or run directly with npx (no installation required)
|
|
70
|
+
npx kratos-mcp
|
|
71
|
+
|
|
72
|
+
# Or install as a dependency
|
|
73
|
+
npm install kratos-mcp
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 🎬 Quick Start
|
|
77
|
+
|
|
78
|
+
### 1️⃣ Configure Your AI Tool
|
|
79
|
+
|
|
80
|
+
<details>
|
|
81
|
+
<summary><b>Claude Desktop</b></summary>
|
|
82
|
+
|
|
83
|
+
Add to `~/.config/claude/claude_desktop_config.json`:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"kratos": {
|
|
89
|
+
"command": "npx",
|
|
90
|
+
"args": ["kratos-mcp"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
</details>
|
|
96
|
+
|
|
97
|
+
<details>
|
|
98
|
+
<summary><b>Cursor</b></summary>
|
|
99
|
+
|
|
100
|
+
Add to `.cursor/mcp_config.json`:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"kratos": {
|
|
106
|
+
"command": "npx",
|
|
107
|
+
"args": ["kratos-mcp"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
<details>
|
|
115
|
+
<summary><b>Other MCP Tools</b></summary>
|
|
116
|
+
|
|
117
|
+
Kratos works with any tool supporting the Model Context Protocol. Check your tool's documentation for MCP server configuration.
|
|
118
|
+
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
### 2️⃣ Start Using Kratos
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Your AI now remembers:
|
|
125
|
+
// ✓ Your authentication patterns
|
|
126
|
+
// ✓ Your API structure
|
|
127
|
+
// ✓ Your component architecture
|
|
128
|
+
// ✓ Your coding standards
|
|
129
|
+
// ✓ Every decision you've made
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 🏛️ The Four Pillars Framework
|
|
133
|
+
|
|
134
|
+
Based on real-world experience building 30+ production apps with AI, Kratos implements the Four Pillars of effective AI development:
|
|
135
|
+
|
|
136
|
+
### 📋 **Pillar 1: PRD (Product Requirements)**
|
|
137
|
+
> "What Matters"
|
|
138
|
+
|
|
139
|
+
Define not just *what* to build, but *how* AI should build it:
|
|
140
|
+
- Complete page paths and user flows
|
|
141
|
+
- API endpoints and data structures
|
|
142
|
+
- Edge cases and integration points
|
|
143
|
+
- UI/UX references and patterns
|
|
144
|
+
|
|
145
|
+
### 🎯 **Pillar 2: Prompt Templates**
|
|
146
|
+
> "What to Do"
|
|
147
|
+
|
|
148
|
+
Reusable task templates that work perfectly with your codebase:
|
|
149
|
+
- Role & stack definition
|
|
150
|
+
- Clear scope constraints
|
|
151
|
+
- File context specifications
|
|
152
|
+
- Verification steps
|
|
153
|
+
|
|
154
|
+
### 🧠 **Pillar 3: Context Retrieval**
|
|
155
|
+
> "What to Inject"
|
|
156
|
+
|
|
157
|
+
Smart injection of relevant memories based on your current task:
|
|
158
|
+
- Automatic pattern matching
|
|
159
|
+
- Path-based relevance scoring
|
|
160
|
+
- Recency weighting
|
|
161
|
+
- Semantic clustering
|
|
162
|
+
|
|
163
|
+
### 💾 **Pillar 4: Memory Storage**
|
|
164
|
+
> "What to Save"
|
|
165
|
+
|
|
166
|
+
Permanent knowledge base that grows with your project:
|
|
167
|
+
- Architecture decisions
|
|
168
|
+
- Bug fixes and solutions
|
|
169
|
+
- Feature implementations
|
|
170
|
+
- Performance optimizations
|
|
171
|
+
|
|
172
|
+
## 🛠️ Core Tools
|
|
173
|
+
|
|
174
|
+
<table>
|
|
175
|
+
<tr>
|
|
176
|
+
<th>Tool</th>
|
|
177
|
+
<th>Description</th>
|
|
178
|
+
<th>Example</th>
|
|
179
|
+
</tr>
|
|
180
|
+
<tr>
|
|
181
|
+
<td><code>memory_save</code></td>
|
|
182
|
+
<td>Store important project knowledge</td>
|
|
183
|
+
<td>
|
|
184
|
+
|
|
185
|
+
```javascript
|
|
186
|
+
// Save authentication pattern
|
|
187
|
+
memory_save({
|
|
188
|
+
title: "JWT Auth Flow",
|
|
189
|
+
content: "Tokens in httpOnly cookies...",
|
|
190
|
+
tags: ["auth", "security"]
|
|
191
|
+
})
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
</td>
|
|
195
|
+
</tr>
|
|
196
|
+
<tr>
|
|
197
|
+
<td><code>memory_search</code></td>
|
|
198
|
+
<td>Retrieve relevant memories</td>
|
|
199
|
+
<td>
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
// Get auth-related memories
|
|
203
|
+
memory_search({
|
|
204
|
+
query: "authentication",
|
|
205
|
+
k: 5
|
|
206
|
+
})
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
</td>
|
|
210
|
+
</tr>
|
|
211
|
+
<tr>
|
|
212
|
+
<td><code>prd_save</code></td>
|
|
213
|
+
<td>Define project requirements</td>
|
|
214
|
+
<td>
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
// Save PRD section
|
|
218
|
+
prd_save({
|
|
219
|
+
section: "api_structure",
|
|
220
|
+
content: "RESTful endpoints..."
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
</td>
|
|
225
|
+
</tr>
|
|
226
|
+
<tr>
|
|
227
|
+
<td><code>prompt_save</code></td>
|
|
228
|
+
<td>Create reusable prompts</td>
|
|
229
|
+
<td>
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
// Save component template
|
|
233
|
+
prompt_save({
|
|
234
|
+
name: "create_component",
|
|
235
|
+
template: "Create React component..."
|
|
236
|
+
})
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
</td>
|
|
240
|
+
</tr>
|
|
241
|
+
</table>
|
|
242
|
+
|
|
243
|
+
## 📊 How It Works
|
|
244
|
+
|
|
245
|
+
```mermaid
|
|
246
|
+
graph LR
|
|
247
|
+
A[Your Code] --> B[Kratos MCP]
|
|
248
|
+
B --> C{Project Detection}
|
|
249
|
+
C --> D[Project Database]
|
|
250
|
+
D --> E[Memory Storage]
|
|
251
|
+
D --> F[Context Broker]
|
|
252
|
+
F --> G[AI Tool]
|
|
253
|
+
G --> H[Perfect Context]
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## 🔬 Under the Hood
|
|
257
|
+
|
|
258
|
+
- **SQLite + FTS5**: Lightning-fast full-text search
|
|
259
|
+
- **Smart Scoring**: Path matching + recency + importance
|
|
260
|
+
- **Auto-detection**: Git, package.json, or directory-based
|
|
261
|
+
- **Secure**: All data stays local, no external calls
|
|
262
|
+
|
|
263
|
+
## 📈 Performance
|
|
264
|
+
|
|
265
|
+
<table>
|
|
266
|
+
<tr>
|
|
267
|
+
<th>Metric</th>
|
|
268
|
+
<th>Value</th>
|
|
269
|
+
</tr>
|
|
270
|
+
<tr>
|
|
271
|
+
<td>Context Accuracy</td>
|
|
272
|
+
<td>95.8%</td>
|
|
273
|
+
</tr>
|
|
274
|
+
<tr>
|
|
275
|
+
<td>Memory Retrieval</td>
|
|
276
|
+
<td>< 10ms</td>
|
|
277
|
+
</tr>
|
|
278
|
+
<tr>
|
|
279
|
+
<td>Project Switch</td>
|
|
280
|
+
<td>< 100ms</td>
|
|
281
|
+
</tr>
|
|
282
|
+
<tr>
|
|
283
|
+
<td>Storage Overhead</td>
|
|
284
|
+
<td>~2MB per project</td>
|
|
285
|
+
</tr>
|
|
286
|
+
</table>
|
|
287
|
+
|
|
288
|
+
## 🗂️ Memory Structure
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
.kratos/
|
|
292
|
+
├── projects/
|
|
293
|
+
│ ├── project-id-1/
|
|
294
|
+
│ │ ├── memories.db # SQLite database
|
|
295
|
+
│ │ ├── prd.yml # Product requirements
|
|
296
|
+
│ │ └── prompts/ # Reusable templates
|
|
297
|
+
│ └── project-id-2/
|
|
298
|
+
│ └── ...
|
|
299
|
+
└── config.yml # Global configuration
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🎮 Live Demo
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
// User: "Explain the auth system"
|
|
306
|
+
//
|
|
307
|
+
// Kratos automatically retrieves:
|
|
308
|
+
// ✓ JWT implementation from 2 weeks ago
|
|
309
|
+
// ✓ Middleware configuration from last month
|
|
310
|
+
// ✓ User model structure from initial setup
|
|
311
|
+
// ✓ Security decisions from PRD
|
|
312
|
+
//
|
|
313
|
+
// AI Response: "Your auth uses JWT with refresh tokens
|
|
314
|
+
// stored in httpOnly cookies. The middleware validates
|
|
315
|
+
// tokens on protected routes at /api/middleware/auth.ts:42..."
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## 🤝 Contributing
|
|
319
|
+
|
|
320
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Clone the repo
|
|
324
|
+
git clone https://github.com/yourusername/kratos-mcp.git
|
|
325
|
+
|
|
326
|
+
# Install dependencies
|
|
327
|
+
npm install
|
|
328
|
+
|
|
329
|
+
# Run in development
|
|
330
|
+
npm run dev
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## 📄 License
|
|
334
|
+
|
|
335
|
+
MIT © 2024 Kratos MCP Contributors
|
|
336
|
+
|
|
337
|
+
## 🙏 Acknowledgments
|
|
338
|
+
|
|
339
|
+
Built on the [Model Context Protocol](https://modelcontextprotocol.io) by Anthropic.
|
|
340
|
+
|
|
341
|
+
Inspired by the Four Pillars Framework and real-world experience building production apps with AI.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
<div align="center">
|
|
346
|
+
|
|
347
|
+
**Built for developers who value their time.**
|
|
348
|
+
|
|
349
|
+
[Report Bug](https://github.com/yourusername/kratos-mcp/issues) • [Request Feature](https://github.com/yourusername/kratos-mcp/issues) • [Documentation](https://docs.kratos-mcp.dev)
|
|
350
|
+
|
|
351
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-middleware-v2.d.ts","sourceRoot":"","sources":["../src/host-middleware-v2.ts"],"names":[],"mappings":""}
|