@cocaxcode/logbook-mcp 0.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 ADDED
@@ -0,0 +1,485 @@
1
+ <p align="center">
2
+ <h1 align="center">@cocaxcode/logbook-mcp</h1>
3
+ <p align="center">
4
+ <strong>Your developer logbook, always one sentence away.</strong><br/>
5
+ Notes &middot; TODOs &middot; Code TODOs &middot; Full-text search &middot; Zero config
6
+ </p>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@cocaxcode/logbook-mcp"><img src="https://img.shields.io/npm/v/@cocaxcode/logbook-mcp.svg?style=flat-square&color=cb3837" alt="npm version" /></a>
11
+ <a href="https://www.npmjs.com/package/@cocaxcode/logbook-mcp"><img src="https://img.shields.io/npm/dm/@cocaxcode/logbook-mcp.svg?style=flat-square" alt="npm downloads" /></a>
12
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License" /></a>
13
+ <img src="https://img.shields.io/badge/node-%3E%3D20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node" />
14
+ <img src="https://img.shields.io/badge/tools-9-blueviolet?style=flat-square" alt="9 tools" />
15
+ <img src="https://img.shields.io/badge/tests-56-brightgreen?style=flat-square" alt="56 tests" />
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="#the-problem">The Problem</a> &middot;
20
+ <a href="#installation">Installation</a> &middot;
21
+ <a href="#just-talk-to-it">Usage</a> &middot;
22
+ <a href="#features">Features</a> &middot;
23
+ <a href="#tool-reference">Tool Reference</a> &middot;
24
+ <a href="#storage">Storage</a> &middot;
25
+ <a href="#contributing">Contributing</a>
26
+ </p>
27
+
28
+ ---
29
+
30
+ ## The Problem
31
+
32
+ You make decisions every day. Why JWT over sessions? Why Redis over Memcached? Why that specific database schema?
33
+
34
+ **Nobody writes it down.** Three months later, you ask yourself _"why did we do this?"_ — and the answer is gone.
35
+
36
+ Your TODOs live in 5 different places: Jira, sticky notes, code comments, your head, and that Slack message you'll never find again.
37
+
38
+ **logbook-mcp** is a developer logbook that lives inside your AI assistant. Notes, TODOs, and code TODOs — all queryable with natural language, without ever leaving your workflow.
39
+
40
+ ### Why logbook-mcp?
41
+
42
+ - **Zero context switching** — don't leave Claude/Cursor to open another app
43
+ - **Zero config** — auto-detects your project, creates the DB on first use
44
+ - **Zero AI costs** — returns raw data, your AI client does the formatting
45
+ - **Captures what git doesn't** — decisions, ideas, blockers, and context
46
+ - **Code TODOs included** — scans your source for `TODO/FIXME/HACK/BUG` automatically
47
+ - **Full-text search** — FTS5 powered, finds anything instantly
48
+
49
+ ---
50
+
51
+ ## Installation
52
+
53
+ ### Claude Code (recommended)
54
+
55
+ ```bash
56
+ claude mcp add logbook-mcp -- npx @cocaxcode/logbook-mcp --mcp
57
+ ```
58
+
59
+ ### Claude Desktop
60
+
61
+ Add to your `claude_desktop_config.json`:
62
+
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "logbook-mcp": {
67
+ "command": "npx",
68
+ "args": ["@cocaxcode/logbook-mcp", "--mcp"]
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ <details>
75
+ <summary>Config file locations</summary>
76
+
77
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
78
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
79
+ - **Linux**: `~/.config/Claude/claude_desktop_config.json`
80
+ </details>
81
+
82
+ ### Cursor
83
+
84
+ Add to `.cursor/mcp.json` in your project:
85
+
86
+ ```json
87
+ {
88
+ "mcpServers": {
89
+ "logbook-mcp": {
90
+ "command": "npx",
91
+ "args": ["@cocaxcode/logbook-mcp", "--mcp"]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ### Windsurf
98
+
99
+ Add to `.windsurf/mcp.json`:
100
+
101
+ ```json
102
+ {
103
+ "mcpServers": {
104
+ "logbook-mcp": {
105
+ "command": "npx",
106
+ "args": ["@cocaxcode/logbook-mcp", "--mcp"]
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ ### VS Code
113
+
114
+ Add to `.vscode/mcp.json`:
115
+
116
+ ```json
117
+ {
118
+ "servers": {
119
+ "logbook-mcp": {
120
+ "command": "npx",
121
+ "args": ["@cocaxcode/logbook-mcp", "--mcp"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### Codex CLI
128
+
129
+ ```bash
130
+ codex mcp add logbook-mcp -- npx @cocaxcode/logbook-mcp --mcp
131
+ ```
132
+
133
+ ### Gemini CLI
134
+
135
+ Add to `.gemini/settings.json`:
136
+
137
+ ```json
138
+ {
139
+ "mcpServers": {
140
+ "logbook-mcp": {
141
+ "command": "npx",
142
+ "args": ["@cocaxcode/logbook-mcp", "--mcp"]
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Just Talk to It
151
+
152
+ No commands to memorize. Just tell your AI what you need:
153
+
154
+ ### Notes — capture decisions and context
155
+
156
+ | You say | What happens |
157
+ |---------|-------------|
158
+ | *"I decided to use JWT instead of sessions for scalability"* | `logbook_note` saves it as a **decision** in the current project |
159
+ | *"Note: Redis doesn't support nested JSON queries natively"* | `logbook_note` saves it as a **learning** for future reference |
160
+ | *"The CI pipeline is failing due to a timeout in integration tests"* | `logbook_note` captures the **blocker** so standup reports include it |
161
+
162
+ ### TODOs — your checklist, always at hand
163
+
164
+ | You say | What happens |
165
+ |---------|-------------|
166
+ | *"TODO: implement email validation for registration"* | `logbook_todo_add` creates a TODO, AI infers topic **feature** |
167
+ | *"Add these TODOs: fix token refresh. update dependencies. add rate limiting"* | `logbook_todo_add` creates **3 TODOs** at once, each with its inferred topic |
168
+ | *"Mark 5 and 8 as done"* | `logbook_todo_done` marks both TODOs as completed |
169
+ | *"What's pending?"* | `logbook_todo_list` shows all TODOs grouped by topic, including code TODOs |
170
+
171
+ ### Search and history
172
+
173
+ | You say | What happens |
174
+ |---------|-------------|
175
+ | *"What did I do yesterday?"* | `logbook_log` returns notes + completed TODOs from yesterday |
176
+ | *"Search everything about auth"* | `logbook_search` finds notes and TODOs matching "auth" via FTS5 |
177
+ | *"Show me all decisions this month"* | `logbook_log` filters by topic **decision** and date range |
178
+ | *"What's pending across all projects?"* | `logbook_todo_list` with global scope shows everything |
179
+
180
+ ---
181
+
182
+ ## Features
183
+
184
+ ### Smart project detection
185
+
186
+ logbook-mcp auto-detects which git project you're in. No setup, no config files:
187
+
188
+ ```
189
+ Working in ~/projects/my-api/
190
+ → Notes and TODOs automatically linked to "my-api"
191
+
192
+ Working in ~/projects/my-frontend/
193
+ → Separate context, same database
194
+
195
+ Ask for "all projects"
196
+ → Global view across everything
197
+ ```
198
+
199
+ ### Notes with topics
200
+
201
+ 6 built-in topics that cover every scenario:
202
+
203
+ | Topic | What it captures | From commits |
204
+ |-------|-----------------|--------------|
205
+ | **feature** | New functionality | `feat:` |
206
+ | **fix** | Bug fixes | `fix:` |
207
+ | **chore** | Maintenance, refactoring, CI/CD | `refactor:` `docs:` `ci:` `build:` `test:` |
208
+ | **idea** | Future proposals, explorations | — |
209
+ | **decision** | Architecture choices with reasoning | — |
210
+ | **blocker** | Things blocking your progress | — |
211
+
212
+ Need more? Create custom topics:
213
+
214
+ ```
215
+ "Create a topic called 'security' for security-related items"
216
+ → logbook_topics(action: 'add', name: 'security')
217
+ ```
218
+
219
+ ### TODOs as checklist
220
+
221
+ Manual TODOs with priority levels (`low`, `normal`, `high`, `urgent`):
222
+
223
+ ```
224
+ feature (3)
225
+ ☐ #12 Implement email validation
226
+ ☐ #15 [HIGH] Dynamic permissions endpoint
227
+ ☑ #9 Google OAuth login (completed Mar 17)
228
+
229
+ fix (1)
230
+ ☐ #8 [URGENT] Token doesn't refresh
231
+
232
+ blocker (1)
233
+ ☐ #20 Resolve CI timeout
234
+ ```
235
+
236
+ ### Code TODOs
237
+
238
+ Your `TODO`, `FIXME`, `HACK`, and `BUG` comments in source code appear alongside manual TODOs:
239
+
240
+ ```
241
+ feature (2)
242
+ ☐ #12 [manual] Implement email validation
243
+ 📄 [code] TODO: add OAuth support — src/auth/service.ts:45
244
+
245
+ fix (2)
246
+ ☐ #8 [manual] Token doesn't refresh
247
+ 📄 [code] FIXME: handle null case — src/users/controller.ts:78
248
+ 📄 [code] BUG: race condition — src/chat/gateway.ts:112
249
+
250
+ chore (1)
251
+ 📄 [code] HACK: proxy workaround — src/middleware/cors.ts:23
252
+ ```
253
+
254
+ Code TODOs are scanned live via `git grep` — they disappear when you fix them.
255
+
256
+ ### Full-text search (FTS5)
257
+
258
+ Search across all notes and TODOs instantly:
259
+
260
+ ```
261
+ "Search auth"
262
+ → Finds notes about JWT decisions, TODOs about auth endpoints,
263
+ and anything mentioning "auth" across all projects
264
+ ```
265
+
266
+ ### Batch operations
267
+
268
+ Create, complete, or delete multiple items at once:
269
+
270
+ ```
271
+ "Add: validate email. fix token. update deps" → 3 TODOs created
272
+ "Mark 5, 8, and 12 as done" → 3 TODOs completed
273
+ "Delete TODOs 3 and 7" → 2 TODOs removed
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Tool Reference
279
+
280
+ | Category | Tools | Count |
281
+ |----------|-------|:-----:|
282
+ | **Activity** | `logbook_log` `logbook_search` | 2 |
283
+ | **Notes** | `logbook_note` | 1 |
284
+ | **TODOs** | `logbook_todo_add` `logbook_todo_list` `logbook_todo_done` `logbook_todo_edit` `logbook_todo_rm` | 5 |
285
+ | **Config** | `logbook_topics` | 1 |
286
+ | **Total** | | **9** |
287
+
288
+ <details>
289
+ <summary><strong>logbook_log</strong> — Activity for a period</summary>
290
+
291
+ Shows notes and completed TODOs for a time range.
292
+
293
+ | Param | Type | Default | Description |
294
+ |-------|------|---------|-------------|
295
+ | `period` | `today` `yesterday` `week` `month` | `today` | Quick date filter |
296
+ | `from` | `YYYY-MM-DD` | — | Custom start date (overrides period) |
297
+ | `to` | `YYYY-MM-DD` | — | Custom end date |
298
+ | `type` | `all` `notes` `todos` | `all` | Filter by entry type |
299
+ | `topic` | string | — | Filter by topic name |
300
+ | `scope` | `project` `global` | `project` | Current project or all |
301
+ </details>
302
+
303
+ <details>
304
+ <summary><strong>logbook_note</strong> — Add a note</summary>
305
+
306
+ | Param | Type | Required | Description |
307
+ |-------|------|----------|-------------|
308
+ | `content` | string | Yes | Note content |
309
+ | `topic` | string | No | Topic name (AI can infer it) |
310
+ </details>
311
+
312
+ <details>
313
+ <summary><strong>logbook_todo_add</strong> — Create TODOs</summary>
314
+
315
+ | Param | Type | Description |
316
+ |-------|------|-------------|
317
+ | `content` | string | Single TODO content |
318
+ | `topic` | string | Topic for single TODO |
319
+ | `priority` | `low` `normal` `high` `urgent` | Priority (default: normal) |
320
+ | `items` | array | Multiple TODOs: `[{content, topic?, priority?}]` |
321
+ </details>
322
+
323
+ <details>
324
+ <summary><strong>logbook_todo_list</strong> — List TODOs</summary>
325
+
326
+ | Param | Type | Default | Description |
327
+ |-------|------|---------|-------------|
328
+ | `status` | `pending` `done` `all` | `pending` | Filter by status |
329
+ | `topic` | string | — | Filter by topic |
330
+ | `priority` | `low` `normal` `high` `urgent` | — | Filter by priority |
331
+ | `source` | `all` `manual` `code` | `all` | Manual DB or code comments |
332
+ | `scope` | `project` `global` | `project` | Current project or all |
333
+ | `from` / `to` | `YYYY-MM-DD` | — | Date range filter |
334
+ </details>
335
+
336
+ <details>
337
+ <summary><strong>logbook_todo_done</strong> — Mark as done/undo</summary>
338
+
339
+ | Param | Type | Description |
340
+ |-------|------|-------------|
341
+ | `ids` | number or number[] | ID(s) to mark |
342
+ | `undo` | boolean | If true, sets back to pending (default: false) |
343
+ </details>
344
+
345
+ <details>
346
+ <summary><strong>logbook_todo_edit</strong> — Edit a TODO</summary>
347
+
348
+ | Param | Type | Description |
349
+ |-------|------|-------------|
350
+ | `id` | number | TODO ID to edit |
351
+ | `content` | string | New content |
352
+ | `topic` | string | New topic |
353
+ | `priority` | `low` `normal` `high` `urgent` | New priority |
354
+ </details>
355
+
356
+ <details>
357
+ <summary><strong>logbook_todo_rm</strong> — Delete TODOs</summary>
358
+
359
+ | Param | Type | Description |
360
+ |-------|------|-------------|
361
+ | `ids` | number or number[] | ID(s) to delete |
362
+ </details>
363
+
364
+ <details>
365
+ <summary><strong>logbook_search</strong> — Full-text search</summary>
366
+
367
+ | Param | Type | Default | Description |
368
+ |-------|------|---------|-------------|
369
+ | `query` | string | — | Search text (required) |
370
+ | `type` | `all` `notes` `todos` | `all` | Search scope |
371
+ | `topic` | string | — | Filter by topic |
372
+ | `scope` | `project` `global` | `project` | Project or global |
373
+ | `limit` | number | 20 | Max results |
374
+ </details>
375
+
376
+ <details>
377
+ <summary><strong>logbook_topics</strong> — Manage topics</summary>
378
+
379
+ | Param | Type | Default | Description |
380
+ |-------|------|---------|-------------|
381
+ | `action` | `list` `add` | `list` | List or create topics |
382
+ | `name` | string | — | New topic name (for add) |
383
+ | `description` | string | — | Topic description (for add) |
384
+ </details>
385
+
386
+ ---
387
+
388
+ ## Storage
389
+
390
+ All data lives in a single SQLite database:
391
+
392
+ ```
393
+ ~/.logbook/
394
+ └── logbook.db # All projects, notes, TODOs in one file
395
+ ```
396
+
397
+ - **WAL mode** for concurrent reads
398
+ - **FTS5** virtual tables for instant full-text search
399
+ - **Triggers** keep search indexes in sync automatically
400
+ - **Foreign keys** with `ON DELETE SET NULL` — delete a project, notes remain
401
+
402
+ Add to your global `.gitignore`:
403
+ ```
404
+ .logbook/
405
+ ```
406
+
407
+ ---
408
+
409
+ ## How It Improves Your Productivity
410
+
411
+ ### Morning standup in 10 seconds
412
+
413
+ Instead of trying to remember what you did yesterday:
414
+
415
+ ```
416
+ "What did I do yesterday?"
417
+ → Complete summary: notes, decisions, completed TODOs
418
+ ```
419
+
420
+ ### Never lose a decision again
421
+
422
+ ```
423
+ "Why did we choose JWT?"
424
+ → Search finds your note: "Decided JWT over sessions for horizontal scalability"
425
+ ```
426
+
427
+ ### One place for all TODOs
428
+
429
+ No more scattered checklists. Manual TODOs + code TODOs + priorities, all in one view:
430
+
431
+ ```
432
+ "What's pending?"
433
+ → Grouped by topic, with priority flags, across code and manual items
434
+ ```
435
+
436
+ ### Context that survives across sessions
437
+
438
+ Your AI assistant forgets everything between sessions. Your logbook doesn't:
439
+
440
+ ```
441
+ "Search everything about the auth migration"
442
+ → All notes, decisions, and TODOs related to auth — from any date
443
+ ```
444
+
445
+ ---
446
+
447
+ ## Architecture
448
+
449
+ ```
450
+ src/
451
+ ├── index.ts # Entry: --mcp → server, else CLI
452
+ ├── server.ts # createServer() factory, registers 9 tools
453
+ ├── cli.ts # CLI (help, version)
454
+ ├── types.ts # Shared interfaces
455
+ ├── db/
456
+ │ ├── connection.ts # getDb() singleton → ~/.logbook/logbook.db
457
+ │ ├── schema.ts # Tables + FTS5 + triggers + topic seed
458
+ │ └── queries.ts # Typed query functions
459
+ ├── git/
460
+ │ ├── detect-repo.ts # Auto-detect project via git rev-parse
461
+ │ └── code-todos.ts # Scan TODO/FIXME/HACK/BUG via git grep
462
+ └── tools/ # 9 MCP tools (one file each)
463
+ ```
464
+
465
+ **Stack:** TypeScript &middot; MCP SDK 1.27 &middot; better-sqlite3 &middot; Zod &middot; Vitest &middot; tsup
466
+
467
+ ---
468
+
469
+ ## Contributing
470
+
471
+ ```bash
472
+ git clone https://github.com/cocaxcode/logbook-mcp.git
473
+ cd logbook-mcp
474
+ npm install
475
+ npm test # 56 tests
476
+ npm run build # Build with tsup
477
+ npm run typecheck # TypeScript check
478
+ npm run inspector # Test with MCP Inspector
479
+ ```
480
+
481
+ ---
482
+
483
+ ## License
484
+
485
+ MIT &copy; [cocaxcode](https://github.com/cocaxcode)
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli.ts
4
+ var VERSION = true ? "0.1.0" : "0.0.0";
5
+ async function runCli(argv) {
6
+ if (argv.includes("--version") || argv.includes("-v")) {
7
+ console.log(`logbook-mcp v${VERSION}`);
8
+ return;
9
+ }
10
+ console.log(`logbook-mcp v${VERSION}`);
11
+ console.log("");
12
+ console.log("Uso:");
13
+ console.log(" logbook-mcp --mcp Iniciar como MCP server (stdio)");
14
+ console.log(" logbook-mcp -v Mostrar version");
15
+ console.log("");
16
+ console.log("Para usar con Claude Code, a\xF1ade a tu configuracion MCP:");
17
+ console.log(' "logbook-mcp": {');
18
+ console.log(' "command": "npx",');
19
+ console.log(' "args": ["@cocaxcode/logbook-mcp", "--mcp"]');
20
+ console.log(" }");
21
+ }
22
+ export {
23
+ runCli
24
+ };
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ async function main() {
5
+ const argv = process.argv.slice(2);
6
+ const hasMcpFlag = argv.includes("--mcp");
7
+ if (hasMcpFlag) {
8
+ const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
9
+ const { createServer } = await import("./server-5ZT2YKCQ.js");
10
+ const server = createServer();
11
+ const transport = new StdioServerTransport();
12
+ await server.connect(transport);
13
+ console.error("logbook-mcp server running on stdio");
14
+ } else {
15
+ const { runCli } = await import("./cli-TYBWWQAH.js");
16
+ await runCli(argv);
17
+ }
18
+ }
19
+ main().catch((err) => {
20
+ console.error(`Fatal: ${err.message}`);
21
+ process.exit(1);
22
+ });