@j0hanz/todokit-mcp 2.0.0 → 2.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 CHANGED
@@ -1,277 +1,110 @@
1
- # todokit-mcp
1
+ # Todokit-MCP
2
2
 
3
- <img src="docs/logo.png" alt="Todokit MCP Server Logo" width="150">
3
+ <img src="assets/logo.svg" alt="Todokit MCP Server Logo" width="200">
4
4
 
5
- An MCP server for Todokit, a task management and productivity tool with JSON storage.
6
-
7
- [![npm version](https://img.shields.io/npm/v/@j0hanz/todokit-mcp.svg)](https://www.npmjs.com/package/@j0hanz/todokit-mcp)
8
- [![License](https://img.shields.io/npm/l/@j0hanz/todokit-mcp)](LICENSE)
9
- [![Node.js](https://img.shields.io/node/v/@j0hanz/todokit-mcp)](package.json)
10
-
11
- ## One-Click Install
5
+ ![npm version](https://img.shields.io/npm/v/@j0hanz/todokit-mcp) ![License](https://img.shields.io/npm/l/@j0hanz/todokit-mcp) ![Node](https://img.shields.io/node/v/@j0hanz/todokit-mcp)
12
6
 
13
- [![Install with NPX in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=todokit&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ftodokit-mcp%40latest%22%5D%7D)[![Install with NPX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=todokit&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ftodokit-mcp%40latest%22%5D%7D&quality=insiders)
7
+ [![Install with NPX in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=todokit&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ftodokit-mcp%40latest%22%5D%7D) [![Install with NPX in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=todokit&inputs=%5B%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40j0hanz%2Ftodokit-mcp%40latest%22%5D%7D&quality=insiders)
14
8
 
15
9
  [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=todokit&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovdG9kb2tpdC1tY3BAbGF0ZXN0Il19)
16
10
 
17
- ## Features
18
-
19
- - Task management: add, update, complete, and delete todos.
20
- - Batch operations: add multiple todos at once.
21
- - Safe listing: status-based filtering with a default of pending-only and truncation to keep responses small.
22
- - JSON persistence with queued writes and atomic file writes.
23
- - Optional diagnostics events (tool calls/results, storage, lifecycle) via Node diagnostics channels.
24
-
25
- ## Quick Start
26
-
27
- ```bash
28
- npx -y @j0hanz/todokit-mcp@latest
29
- ```
30
-
31
- The server runs over stdio (no HTTP endpoint) and registers MCP tools on startup.
32
-
33
- ## Installation
11
+ An MCP server for Todokit, a task management and productivity tool with JSON storage.
34
12
 
35
- ### NPX (recommended)
13
+ ## Overview
36
14
 
37
- ```bash
38
- npx -y @j0hanz/todokit-mcp@latest
39
- ```
15
+ Todokit MCP provides a lightweight, local task management system that integrates directly with your AI coding assistant. It uses a simple JSON file for persistence, allowing you to create, track, and complete tasks without leaving your editor. The server automatically handles file safety, locking, and atomic writes.
40
16
 
41
- ### Global install
17
+ ## Key Features
42
18
 
43
- ```bash
44
- npm install -g @j0hanz/todokit-mcp
45
- ```
19
+ - **Local Persistence**: Stores tasks in a human-readable `todos.json` file in your working directory.
20
+ - **Task Management**: Create, update, complete, and delete tasks with priorities and categories.
21
+ - **Batch Operations**: Add multiple tasks efficiently in a single operation.
22
+ - **Filtering**: List tasks by status (pending/completed) to keep context manageable.
23
+ - **Safety Controls**: Validates file paths to prevent traversal outside the working directory (unless configured).
24
+ - **Diagnostics**: emitting events for tool calls, storage operations, and lifecycle events.
46
25
 
47
- Then run:
26
+ ## Tech Stack
48
27
 
49
- ```bash
50
- todokit-mcp
51
- ```
28
+ - **Runtime**: Node.js >=22.19.8
29
+ - **Language**: TypeScript 5.9
30
+ - **SDK**: Model Context Protocol SDK (`@modelcontextprotocol/sdk`)
31
+ - **Libraries**: Zod (validation)
52
32
 
53
- ### From source
33
+ ## Repository Structure
54
34
 
55
- ```bash
56
- git clone https://github.com/j0hanz/todokit-mcp-server.git
57
- cd todokit-mcp-server
58
- npm install
59
- npm run build
60
- npm start
35
+ ```text
36
+ c:\todokit-mcp
37
+ ├── dist/ # Compiled output
38
+ ├── scripts/ # Build and task scripts
39
+ ├── src/
40
+ │ ├── index.ts # Server entrypoint & startup
41
+ │ ├── schema.ts # Zod schemas for tools & types
42
+ │ ├── storage.ts # JSON file persistence layer
43
+ │ └── tools.ts # Tool registration & handlers
44
+ ├── package.json
45
+ └── README.md
61
46
  ```
62
47
 
63
- ## Configuration
64
-
65
- ### Storage path
48
+ ## Requirements
66
49
 
67
- By default, todos are stored in `todos.json` in the current working directory. To control where data is written, set the `TODOKIT_TODO_FILE` environment variable to an absolute or relative path ending with `.json`. Relative paths resolve from the current working directory. The directory is created as needed; if the file does not exist, the server starts with an empty list.
50
+ - Node.js >=22.19.8
68
51
 
69
- When all todos are completed, the server removes the storage file so it does not linger on disk.
52
+ ## Quickstart
70
53
 
71
- Examples:
54
+ ### NPX (Recommended)
72
55
 
73
56
  ```bash
74
- # macOS/Linux
75
- TODOKIT_TODO_FILE=/path/to/todos.json npx -y @j0hanz/todokit-mcp@latest
76
- ```
77
-
78
- ```powershell
79
- # Windows PowerShell
80
- $env:TODOKIT_TODO_FILE = 'C:\path\to\todos.json'
81
57
  npx -y @j0hanz/todokit-mcp@latest
82
58
  ```
83
59
 
84
- ### JSON formatting
85
-
86
- By default, todos are written as pretty-printed JSON (2-space indentation). To write compact JSON instead, set `TODOKIT_JSON_PRETTY` to `0` or `false`.
87
-
88
- ```bash
89
- TODOKIT_JSON_PRETTY=0 npx -y @j0hanz/todokit-mcp@latest
90
- ```
91
-
92
- ### CLI options
93
-
94
- The server accepts a few CLI flags (use `--` to forward args when running via `npx`).
95
-
96
- ```bash
97
- npx -y @j0hanz/todokit-mcp@latest -- --todo-file ./todos.json --diagnostics --log-level debug
98
- ```
99
-
100
- | Flag | Alias | Description |
101
- | :-------------- | :---- | :------------------------------------------------------------------------- |
102
- | `--todo-file` | `-f` | Override the todo storage path (same as `TODOKIT_TODO_FILE`). |
103
- | `--diagnostics` | `-d` | Enable diagnostics output (JSON lines) to stderr. |
104
- | `--log-level` | `-l` | Diagnostics log level: `error`, `warn`, `info`, `debug` (default: `info`). |
105
-
106
- The log level is only used when diagnostics output is enabled.
107
-
108
- ### Diagnostics
109
-
110
- Diagnostics events are always published on Node's `diagnostics_channel` and can be subscribed to programmatically. When `--diagnostics` is set, the server attaches default subscribers and prints JSON events to **stderr** (stdout stays reserved for MCP traffic).
111
-
112
- Channels:
113
-
114
- - `todokit:tool` — tool call + tool result events
115
- - `todokit:storage` — read/write/close events
116
- - `todokit:lifecycle` — shutdown events
117
-
118
- ## Tools
119
-
120
- All tools return a JSON payload in both `content` (stringified) and `structuredContent`.
121
- Inputs are validated with strict Zod schemas, so unknown fields are rejected.
122
-
123
- Success payload:
124
-
125
- ```json
126
- {
127
- "ok": true,
128
- "result": {}
129
- }
130
- ```
131
-
132
- Error payload:
133
-
134
- ```json
135
- {
136
- "ok": false,
137
- "error": { "code": "E_CODE", "message": "Details" }
138
- }
139
- ```
140
-
141
- The `result` shape is tool-specific.
142
-
143
- ### add_todo
144
-
145
- Create a new todo item.
146
-
147
- | Parameter | Type | Required | Description |
148
- | :---------- | :----- | :------- | :-------------------------------------------------------------------- |
149
- | description | string | Yes | Description of the todo (1-2000 chars) |
150
- | priority | string | Yes | Priority: `low`, `medium`, `high` |
151
- | category | string | Yes | Category: `work`, `bug`, `testing`, `docs` |
152
- | dueAt | string | No | Optional due date/time as an ISO 8601 timestamp with offset (RFC3339) |
153
-
154
- Result fields:
155
-
156
- - `item` (todo)
157
- - `summary`
158
- - `nextActions`
159
-
160
- ### add_todos
161
-
162
- Add multiple todo items in one call.
163
-
164
- Parameters:
165
-
166
- - `items` (array, required): Array of todo objects (1-50 items). Each item supports `description`, `priority`, `category`, `dueAt`.
167
-
168
- Result fields:
169
-
170
- - `items` (todos)
171
- - `summary`
172
- - `nextActions`
173
-
174
- ### list_todos
175
-
176
- List todos with an optional status filter.
177
-
178
- | Parameter | Type | Required | Default | Description |
179
- | :-------- | :----- | :------- | :------ | :---------------------------------------- |
180
- | status | string | No | pending | Filter by status: pending, completed, all |
181
-
182
- Notes:
183
-
184
- - Results may be truncated for safety (currently returns up to 50 items). Use `status: "pending"` (default) or `status: "completed"` to narrow the response.
185
-
186
- Result fields:
187
-
188
- - `items` (todos)
189
- - `summary`
190
- - `counts` (`total`, `pending`, `completed`) — global counts across all todos
191
- - `filteredCounts` (`total`, `pending`, `completed`) — counts within the requested status filter
192
- - `status` (the effective status filter)
193
- - `returned`, `truncated`, `remaining`, `hint`
194
-
195
- ### update_todo
196
-
197
- Update fields on a todo item.
198
-
199
- | Parameter | Type | Required | Description |
200
- | :---------- | :----- | :------- | :--------------------------------------------- |
201
- | id | string | Yes | The ID of the todo to update |
202
- | description | string | No | New description (1-2000 chars) |
203
- | priority | string | No | New priority: `low`, `medium`, `high` |
204
- | category | string | No | New category: `work`, `bug`, `testing`, `docs` |
205
- | dueAt | string | No | Replace due date/time (ISO 8601 with offset) |
206
-
207
- Notes:
208
-
209
- - If no updatable fields are provided, the tool returns an error.
210
-
211
- Result fields:
212
-
213
- - `item` (todo)
214
- - `summary`
215
- - `nextActions`
216
-
217
- ### complete_todo
218
-
219
- Mark a todo as completed.
220
-
221
- | Parameter | Type | Required | Description |
222
- | :-------- | :----- | :------- | :----------------- |
223
- | id | string | Yes | The ID of the todo |
224
-
225
- Result fields:
226
-
227
- - `item` (todo)
228
- - `summary`
229
- - `nextActions`
60
+ ## Configuration
230
61
 
231
- ### delete_todo
62
+ The server can be configured via CLI arguments or environment variables.
232
63
 
233
- Delete a todo item by ID.
64
+ ### CLI Arguments
234
65
 
235
- | Parameter | Type | Required | Description |
236
- | :-------- | :----- | :------- | :--------------------------- |
237
- | id | string | Yes | The ID of the todo to delete |
66
+ | Flag | Short | Description |
67
+ | --------------- | ----- | ------------------------------------------------------------------ |
68
+ | `--todo-file` | `-f` | Path to the todo JSON file. |
69
+ | `--diagnostics` | `-d` | Enable diagnostic logging to stderr. |
70
+ | `--log-level` | `-l` | Set log level (`error`, `warn`, `info`, `debug`). Default: `info`. |
238
71
 
239
- Result fields:
72
+ ### Environment Variables
240
73
 
241
- - `deletedIds` (array)
242
- - `summary`
243
- - `nextActions`
74
+ | Variable | Description | Default |
75
+ | ----------------------------- | --------------------------------------------------------------- | --------------------- |
76
+ | `TODOKIT_TODO_FILE` | Absolute or relative path to the todo storage file. | `todos.json` (in CWD) |
77
+ | `TODOKIT_JSON_PRETTY` | Set to `true` or `1` to indent JSON files with 2 spaces. | `false` (compact) |
78
+ | `TODOKIT_TOOL_TIMEOUT_MS` | Timeout for tool execution in milliseconds. | `60000` |
79
+ | `TODOKIT_LOCK_TIMEOUT_MS` | Timeout for acquiring file lock. | `5000` |
80
+ | `TODOKIT_MAX_TODO_FILE_BYTES` | Maximum allowed size of the todo file. | `5242880` (5MB) |
81
+ | `TODOKIT_ALLOW_OUTSIDE_CWD` | Allow storage file to be outside the current working directory. | `false` |
244
82
 
245
- ## Data Model
83
+ ## MCP Surface
246
84
 
247
- A todo item has the following shape:
85
+ ### Tools
248
86
 
249
- ```json
250
- {
251
- "id": "string",
252
- "description": "string",
253
- "completed": false,
254
- "priority": "low|medium|high",
255
- "category": "work|bug|testing|docs",
256
- "dueAt": "ISO timestamp with offset?",
257
- "createdAt": "ISO timestamp with offset",
258
- "updatedAt": "ISO timestamp with offset?",
259
- "completedAt": "ISO timestamp with offset?"
260
- }
261
- ```
87
+ | Tool | Description | Parameters | Results |
88
+ | --------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
89
+ | `add_todo` | Create a new task. | `description` (str, req), `priority` (enum, req), `category` (enum, req), `dueAt` (iso-date, opt) | Returns the created item and summary. |
90
+ | `add_todos` | Create multiple tasks in batch. | `items` (array of todos, req, max 50) | Returns count and IDs of created items. |
91
+ | `list_todos` | List tasks with optional filtering. | `status` (pending/completed/all, opt, def: pending) | Returns list of items, counts, and status summary. |
92
+ | `update_todo` | Update an existing task. | `id` (str, req), `description`, `priority`, `category`, `dueAt` (all opt) | Returns updated item. |
93
+ | `complete_todo` | Mark a task as completed. | `id` (str, req) | Returns updated item. |
94
+ | `delete_todo` | Permanently remove a task. | `id` (str, req) | Returns summary of deletion. |
262
95
 
263
- Notes:
96
+ ### Resources
264
97
 
265
- - `createdAt`, `updatedAt`, and `completedAt` are ISO 8601 timestamps with offset (e.g., `2025-02-28T10:30:00Z`).
266
- - `dueAt` uses the same ISO 8601 timestamp format with an explicit offset.
267
- - When tools report an ambiguous match (error code `E_AMBIGUOUS`), prefer using an exact `id` from the provided candidates.
98
+ | URI Template | Type | Description |
99
+ | ------------------------- | --------------- | ----------------------------------------------------------------- |
100
+ | `internal://instructions` | `text/markdown` | Returns usage instructions and context about the Todokit manager. |
268
101
 
269
- ## Client Configuration
102
+ ## Client Configuration Examples
270
103
 
271
104
  <details>
272
105
  <summary><b>VS Code</b></summary>
273
106
 
274
- Add this to your `mcpServers` configuration in `settings.json`:
107
+ Add to your `settings.json` (Code) or `mcpServers` configuration:
275
108
 
276
109
  ```json
277
110
  {
@@ -287,7 +120,7 @@ Add this to your `mcpServers` configuration in `settings.json`:
287
120
  <details>
288
121
  <summary><b>Claude Desktop</b></summary>
289
122
 
290
- Add this to your `claude_desktop_config.json`:
123
+ Add to `claude_desktop_config.json`:
291
124
 
292
125
  ```json
293
126
  {
@@ -305,7 +138,7 @@ Add this to your `claude_desktop_config.json`:
305
138
  <details>
306
139
  <summary><b>Cursor</b></summary>
307
140
 
308
- 1. Go to **Cursor Settings** > **Features** > **MCP**
141
+ 1. Open **Cursor Settings** > **Features** > **MCP**
309
142
  2. Click **+ Add New MCP Server**
310
143
  3. Name: `todokit`
311
144
  4. Type: `command`
@@ -313,54 +146,35 @@ Add this to your `claude_desktop_config.json`:
313
146
 
314
147
  </details>
315
148
 
316
- ## Development
149
+ ## Security
317
150
 
318
- ### Prerequisites
151
+ - **Path Traversal**: By default, the server enforces that the `todos.json` file must reside within the current working directory. You must explicitly opt-in via `TODOKIT_ALLOW_OUTSIDE_CWD` to store files elsewhere.
152
+ - **File Limits**: The server enforces a maximum file size (default 5MB) to prevent disk exhaustion.
319
153
 
320
- - Node.js >= 20.0.0
154
+ ## Development Workflow
321
155
 
322
- ### Scripts
156
+ 1. **Install Dependencies**
323
157
 
324
- | Command | Description |
325
- | :-------------------- | :---------------------------------------------------- |
326
- | npm run build | Compile TypeScript to JavaScript |
327
- | npm run dev | Run server in watch mode for development |
328
- | npm start | Run the built server |
329
- | npm run test | Run unit tests (node --test + tsx) |
330
- | npm run test:coverage | Run unit tests with coverage |
331
- | npm run lint | Run ESLint |
332
- | npm run format | Format with Prettier |
333
- | npm run format:check | Check formatting with Prettier |
334
- | npm run type-check | Run TypeScript type checking |
335
- | npm run dup-check | Run duplicate code checks (jscpd) |
336
- | npm run clean | Remove the dist/ build output |
337
- | npm run inspector | Launch the MCP inspector (pass server cmd after `--`) |
158
+ ```bash
159
+ npm install
160
+ ```
338
161
 
339
- ### Manual verification
162
+ 2. **Common Scripts**
340
163
 
341
- ```bash
342
- npm run build
343
- npm run inspector -- node dist/index.js
344
- ```
345
-
346
- ### Project structure
347
-
348
- ```text
349
- src/
350
- index.ts # MCP server entrypoint (stdio)
351
- tools.ts # Tool registrations and handlers
352
- schema.ts # Zod input/output schemas
353
- storage.ts # JSON persistence and CRUD
354
- responses.ts # Tool response builders
355
- diagnostics.ts # Node diagnostics channels
356
- tests/ # Unit tests
357
- docs/ # Assets (logo)
358
- ```
164
+ | Script | Description |
165
+ | ------------------- | ----------------------------------------- |
166
+ | `npm run build` | Builds the project to `dist/`. |
167
+ | `npm run dev` | Watches for changes and recompiles. |
168
+ | `npm run test` | Runs the test suite via Node test runner. |
169
+ | `npm run lint` | Lints code with ESLint. |
170
+ | `npm run format` | Formats code with Prettier. |
171
+ | `npm run inspector` | Launches the MCP inspector for debugging. |
359
172
 
360
- ## Contributing
173
+ ## Troubleshooting
361
174
 
362
- Contributions are welcome. Please run `npm run format`, `npm run lint`, `npm run type-check`, `npm run build`, `npm test`, `npm run test:coverage`, and `npm run dup-check` before opening a PR.
175
+ - **Server Error: Server not initialized**: This typically happens if tools are called before the server has fully started. Ensure the client waits for initialization.
176
+ - **Storage Error: path outside CWD**: You are trying to use a file outside the workspace. Move the file or set `TODOKIT_ALLOW_OUTSIDE_CWD=1`.
363
177
 
364
178
  ## License
365
179
 
366
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
180
+ MIT