@nihalcastelino/project-brain-mcp 1.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.
@@ -0,0 +1,397 @@
1
+ # Testing Guide - Project Brain MCP (Free Tier)
2
+
3
+ **Before publishing to npm, test everything thoroughly.**
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - Node.js 16+ installed
10
+ - npm or yarn
11
+ - Claude Desktop (optional, for MCP testing)
12
+
13
+ ---
14
+
15
+ ## Step 1: Install Dependencies
16
+
17
+ ```bash
18
+ cd project-brain-mcp
19
+ npm install
20
+ ```
21
+
22
+ **Expected output:**
23
+ - `better-sqlite3` installed
24
+ - `@modelcontextprotocol/sdk` installed
25
+ - No errors
26
+
27
+ ---
28
+
29
+ ## Step 2: Build TypeScript
30
+
31
+ ```bash
32
+ npm run build
33
+ ```
34
+
35
+ **Expected output:**
36
+ - `dist/` directory created
37
+ - `dist/server.js` exists
38
+ - `dist/tools/index.js` exists
39
+ - `dist/storage/sqlite-local.js` exists
40
+ - No TypeScript errors
41
+
42
+ ---
43
+
44
+ ## Step 3: Test Server Startup
45
+
46
+ ```bash
47
+ npm run dev
48
+ ```
49
+
50
+ **Expected output (stderr):**
51
+ ```
52
+ Project Brain MCP Server (Free Tier) started
53
+ Storage: Local SQLite (offline mode)
54
+
55
+ 🚀 Upgrade to Team Edition for:
56
+ ✨ Multi-agent collaboration
57
+ ✨ AI code review
58
+ ✨ Real-time dashboard
59
+ ✨ Unlimited tasks
60
+
61
+ Try free for 14 days → https://project-brain.io/upgrade
62
+ ```
63
+
64
+ **Keep this running in a terminal for next steps.**
65
+
66
+ ---
67
+
68
+ ## Step 4: Test with MCP Client
69
+
70
+ ### Option A: Claude Desktop
71
+
72
+ 1. Update Claude Desktop config:
73
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
74
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
75
+
76
+ 2. Add MCP server:
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "project-brain": {
81
+ "command": "node",
82
+ "args": ["/absolute/path/to/project-brain-mcp/dist/server.js"]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ 3. Restart Claude Desktop
89
+
90
+ 4. In Claude, try:
91
+ ```
92
+ Use pb_ping to test connection
93
+ ```
94
+
95
+ **Expected:** JSON response with `ok: true`, `tier: "free"`, `storage: "local"`
96
+
97
+ ### Option B: Manual Testing
98
+
99
+ Use the MCP Inspector or write a simple test script.
100
+
101
+ ---
102
+
103
+ ## Step 5: Test Core Features
104
+
105
+ ### Test Project Creation
106
+
107
+ ```
108
+ Use pb_create_project with name="Test Project" and description="My test"
109
+ ```
110
+
111
+ **Expected:** Project created with ID
112
+
113
+ ### Test Task Creation
114
+
115
+ ```
116
+ Use pb_create_task with projectId="..." and title="Test Task"
117
+ ```
118
+
119
+ **Expected:** Task created successfully
120
+
121
+ ### Test Task Listing
122
+
123
+ ```
124
+ Use pb_list_tasks with projectId="..."
125
+ ```
126
+
127
+ **Expected:** Array with 1 task
128
+
129
+ ### Test 100 Task Limit
130
+
131
+ Create 100 tasks, then try to create the 101st:
132
+
133
+ ```javascript
134
+ // In a loop
135
+ for (let i = 1; i <= 100; i++) {
136
+ pb_create_task(projectId="...", title=`Task ${i}`)
137
+ }
138
+
139
+ // This should fail
140
+ pb_create_task(projectId="...", title="Task 101")
141
+ ```
142
+
143
+ **Expected:**
144
+ - First 100 tasks created successfully
145
+ - 101st task fails with error message:
146
+ ```
147
+ FREE TIER LIMIT: Maximum 100 tasks per project reached.
148
+
149
+ 🚀 Upgrade to Team Edition for unlimited tasks:
150
+ ✨ Unlimited tasks and projects
151
+ ✨ Multi-agent collaboration
152
+ ✨ AI code review
153
+ ✨ Real-time dashboard
154
+
155
+ Try free for 14 days → https://project-brain.io/upgrade
156
+ ```
157
+
158
+ ### Test Conversation Logging
159
+
160
+ ```
161
+ 1. pb_create_conversation with projectId="...", title="Test Conversation"
162
+ 2. pb_log_message with conversationId="...", role="user", content="Hello"
163
+ 3. pb_log_message with conversationId="...", role="assistant", content="Hi there!"
164
+ 4. pb_get_messages with conversationId="..."
165
+ ```
166
+
167
+ **Expected:** 2 messages returned
168
+
169
+ ### Test Export
170
+
171
+ ```
172
+ pb_export_project with projectId="...", format="markdown"
173
+ ```
174
+
175
+ **Expected:** Markdown-formatted project with all tasks
176
+
177
+ ---
178
+
179
+ ## Step 6: Test Offline Mode
180
+
181
+ 1. Disconnect from internet
182
+ 2. Restart server
183
+ 3. Try creating project, task, conversation
184
+
185
+ **Expected:** Everything works (no network calls)
186
+
187
+ ---
188
+
189
+ ## Step 7: Test Database Persistence
190
+
191
+ 1. Stop server (Ctrl+C)
192
+ 2. Restart server
193
+ 3. List projects
194
+
195
+ **Expected:** Projects/tasks from previous session still exist
196
+
197
+ ---
198
+
199
+ ## Step 8: Check Database File
200
+
201
+ ```bash
202
+ # macOS/Linux
203
+ ls -lh ~/.project-brain/project-brain.db
204
+
205
+ # Windows
206
+ dir %USERPROFILE%\.project-brain\project-brain.db
207
+ ```
208
+
209
+ **Expected:** SQLite database file exists
210
+
211
+ ---
212
+
213
+ ## Step 9: Test Error Handling
214
+
215
+ ### Invalid Project ID
216
+
217
+ ```
218
+ pb_get_project with projectId="invalid-id"
219
+ ```
220
+
221
+ **Expected:** `{ project: null }`
222
+
223
+ ### Invalid Task ID
224
+
225
+ ```
226
+ pb_get_task with taskId="invalid-id"
227
+ ```
228
+
229
+ **Expected:** `{ task: null }`
230
+
231
+ ### Missing Required Fields
232
+
233
+ ```
234
+ pb_create_task with title="Test" (no projectId)
235
+ ```
236
+
237
+ **Expected:** Error about missing projectId
238
+
239
+ ---
240
+
241
+ ## Step 10: Performance Test
242
+
243
+ Create 100 tasks rapidly:
244
+
245
+ ```javascript
246
+ const start = Date.now();
247
+ for (let i = 0; i < 100; i++) {
248
+ await pb_create_task(projectId="...", title=`Task ${i}`);
249
+ }
250
+ const end = Date.now();
251
+ console.log(`Created 100 tasks in ${end - start}ms`);
252
+ ```
253
+
254
+ **Expected:**
255
+ - All 100 tasks created
256
+ - Time < 5 seconds (SQLite is fast)
257
+
258
+ ---
259
+
260
+ ## Step 11: Memory Leak Test
261
+
262
+ Run server for extended period with activity:
263
+
264
+ ```bash
265
+ # Terminal 1: Start server
266
+ npm run dev
267
+
268
+ # Terminal 2: Monitor memory
269
+ # macOS/Linux
270
+ while true; do ps aux | grep node | grep -v grep; sleep 5; done
271
+
272
+ # Windows
273
+ # Use Task Manager to monitor node.exe
274
+ ```
275
+
276
+ **Expected:**
277
+ - Memory usage stable (< 100MB)
278
+ - No memory leaks over time
279
+
280
+ ---
281
+
282
+ ## Step 12: Cross-Platform Test
283
+
284
+ Test on:
285
+ - [ ] macOS
286
+ - [ ] Windows
287
+ - [ ] Linux (Ubuntu/Debian)
288
+
289
+ **Expected:** Works on all platforms
290
+
291
+ ---
292
+
293
+ ## Common Issues & Fixes
294
+
295
+ ### Issue: "better-sqlite3 not found"
296
+ **Fix:**
297
+ ```bash
298
+ npm install better-sqlite3 --save
299
+ npm run build
300
+ ```
301
+
302
+ ### Issue: "Cannot find module '@modelcontextprotocol/sdk'"
303
+ **Fix:**
304
+ ```bash
305
+ npm install @modelcontextprotocol/sdk --save
306
+ npm run build
307
+ ```
308
+
309
+ ### Issue: TypeScript errors
310
+ **Fix:**
311
+ ```bash
312
+ npm install -D typescript @types/node @types/better-sqlite3
313
+ npm run build
314
+ ```
315
+
316
+ ### Issue: Permission denied on database
317
+ **Fix:**
318
+ ```bash
319
+ chmod 755 ~/.project-brain
320
+ chmod 644 ~/.project-brain/project-brain.db
321
+ ```
322
+
323
+ ### Issue: Server won't start
324
+ **Fix:**
325
+ ```bash
326
+ # Check Node version
327
+ node --version # Should be 16+
328
+
329
+ # Check logs
330
+ npm run dev 2>&1 | tee server.log
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Success Criteria
336
+
337
+ ✅ All tests pass
338
+ ✅ No TypeScript errors
339
+ ✅ No runtime errors
340
+ ✅ Database persists data
341
+ ✅ Works offline
342
+ ✅ 100 task limit enforced
343
+ ✅ Upgrade messages display correctly
344
+ ✅ Memory usage stable
345
+ ✅ Cross-platform compatible
346
+
347
+ ---
348
+
349
+ ## Final Checklist Before Publishing
350
+
351
+ - [ ] All tests pass
352
+ - [ ] README.md accurate
353
+ - [ ] LICENSE file correct (MIT)
354
+ - [ ] package.json correct (version, license, etc.)
355
+ - [ ] .npmignore configured (don't ship source)
356
+ - [ ] TypeScript builds without errors
357
+ - [ ] No console.log() left in production code
358
+ - [ ] Upgrade CTAs in place
359
+ - [ ] No secrets in code
360
+ - [ ] No hardcoded paths (use homedir())
361
+
362
+ ---
363
+
364
+ ## Publishing to npm
365
+
366
+ Once all tests pass:
367
+
368
+ ```bash
369
+ # 1. Login to npm
370
+ npm login
371
+
372
+ # 2. Verify package.json
373
+ cat package.json # Check version, name, license
374
+
375
+ # 3. Build production
376
+ npm run build
377
+
378
+ # 4. Test package locally
379
+ npm pack
380
+ # This creates a .tgz file you can test install:
381
+ # npm install -g ./project-brain-mcp-1.0.0.tgz
382
+
383
+ # 5. Publish (dry run first)
384
+ npm publish --dry-run
385
+
386
+ # 6. Publish for real
387
+ npm publish --access public
388
+
389
+ # 7. Verify
390
+ npm info @project-brain/mcp
391
+ ```
392
+
393
+ **Package URL:** https://www.npmjs.com/package/@project-brain/mcp
394
+
395
+ ---
396
+
397
+ **Good luck with testing and launch! 🚀**
@@ -0,0 +1,48 @@
1
+ export interface AIFormatter {
2
+ formatTaskContext(context: any): string;
3
+ formatConversation(conversation: any, messages: any[]): string;
4
+ formatTask(task: any, conversations?: any[], decisions?: any[]): string;
5
+ formatProject(project: any, tasks?: any[], conversations?: any[]): string;
6
+ formatDecisions(decisions: any[]): string;
7
+ formatHeading(text: string, level: number): string;
8
+ formatMetadata(metadata: Record<string, any>): string;
9
+ }
10
+ export declare class MarkdownFormatter implements AIFormatter {
11
+ formatTaskContext(context: any): string;
12
+ formatConversation(conversation: any, messages: any[]): string;
13
+ formatTask(task: any, conversations?: any[], decisions?: any[]): string;
14
+ formatProject(project: any, tasks?: any[], conversations?: any[]): string;
15
+ formatDecisions(decisions: any[]): string;
16
+ formatHeading(text: string, level: number): string;
17
+ formatMetadata(metadata: Record<string, any>): string;
18
+ }
19
+ export declare class ChatFormatter implements AIFormatter {
20
+ formatConversation(conversation: any, messages: any[]): string;
21
+ formatTaskContext(context: any): string;
22
+ formatTask(task: any, conversations?: any[], decisions?: any[]): string;
23
+ formatProject(project: any, tasks?: any[], conversations?: any[]): string;
24
+ formatDecisions(decisions: any[]): string;
25
+ formatHeading(text: string, level: number): string;
26
+ formatMetadata(metadata: Record<string, any>): string;
27
+ }
28
+ export declare class PlainTextFormatter implements AIFormatter {
29
+ formatTaskContext(context: any): string;
30
+ formatConversation(conversation: any, messages: any[]): string;
31
+ formatTask(task: any, conversations?: any[], decisions?: any[]): string;
32
+ formatProject(project: any, tasks?: any[], conversations?: any[]): string;
33
+ formatDecisions(decisions: any[]): string;
34
+ formatHeading(text: string, level: number): string;
35
+ formatMetadata(metadata: Record<string, any>): string;
36
+ }
37
+ export declare class HandoffReadyFormatter implements AIFormatter {
38
+ private markdownFormatter;
39
+ formatTaskContext(context: any): string;
40
+ formatConversation(conversation: any, messages: any[]): string;
41
+ formatTask(task: any, conversations?: any[], decisions?: any[]): string;
42
+ formatProject(project: any, tasks?: any[], conversations?: any[]): string;
43
+ formatDecisions(decisions: any[]): string;
44
+ formatHeading(text: string, level: number): string;
45
+ formatMetadata(metadata: Record<string, any>): string;
46
+ }
47
+ export declare function createFormatter(format?: "markdown" | "chat" | "plain" | "handoff_ready"): AIFormatter;
48
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,CAAC;IACx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