@todoist/mcp 0.0.0-stage → 15.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.
Files changed (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +232 -2
  3. package/dist/filter-helpers.d.ts +53 -0
  4. package/dist/filter-helpers.d.ts.map +1 -0
  5. package/dist/http-app.d.ts +28 -0
  6. package/dist/http-app.d.ts.map +1 -0
  7. package/dist/index.d.ts +4347 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +61 -0
  10. package/dist/main-http.d.ts +3 -0
  11. package/dist/main-http.d.ts.map +1 -0
  12. package/dist/main-http.js +133 -0
  13. package/dist/main.d.ts +3 -0
  14. package/dist/main.d.ts.map +1 -0
  15. package/dist/main.js +16 -0
  16. package/dist/mcp-apps/index.html +116 -0
  17. package/dist/mcp-helpers.d.ts +62 -0
  18. package/dist/mcp-helpers.d.ts.map +1 -0
  19. package/dist/mcp-server-y4HhlBJW.js +8152 -0
  20. package/dist/mcp-server.d.ts +16 -0
  21. package/dist/mcp-server.d.ts.map +1 -0
  22. package/dist/middleware/require-trusted-host.d.ts +44 -0
  23. package/dist/middleware/require-trusted-host.d.ts.map +1 -0
  24. package/dist/middleware/require-valid-todoist-token.d.ts +39 -0
  25. package/dist/middleware/require-valid-todoist-token.d.ts.map +1 -0
  26. package/dist/prompts/productivity-analysis.d.ts +58 -0
  27. package/dist/prompts/productivity-analysis.d.ts.map +1 -0
  28. package/dist/require-valid-todoist-token-I1jh7sbd.js +63 -0
  29. package/dist/todoist-tool.d.ts +15 -0
  30. package/dist/todoist-tool.d.ts.map +1 -0
  31. package/dist/tool-execution-error.d.ts +27 -0
  32. package/dist/tool-execution-error.d.ts.map +1 -0
  33. package/dist/tool-helpers.d.ts +318 -0
  34. package/dist/tool-helpers.d.ts.map +1 -0
  35. package/dist/tool-registry.d.ts +4307 -0
  36. package/dist/tool-registry.d.ts.map +1 -0
  37. package/dist/tools/add-comments.d.ts +104 -0
  38. package/dist/tools/add-comments.d.ts.map +1 -0
  39. package/dist/tools/add-filters.d.ts +113 -0
  40. package/dist/tools/add-filters.d.ts.map +1 -0
  41. package/dist/tools/add-labels.d.ts +107 -0
  42. package/dist/tools/add-labels.d.ts.map +1 -0
  43. package/dist/tools/add-projects.d.ts +134 -0
  44. package/dist/tools/add-projects.d.ts.map +1 -0
  45. package/dist/tools/add-reminders.d.ts +174 -0
  46. package/dist/tools/add-reminders.d.ts.map +1 -0
  47. package/dist/tools/add-sections.d.ts +61 -0
  48. package/dist/tools/add-sections.d.ts.map +1 -0
  49. package/dist/tools/add-tasks.d.ts +123 -0
  50. package/dist/tools/add-tasks.d.ts.map +1 -0
  51. package/dist/tools/analyze-project-health.d.ts +45 -0
  52. package/dist/tools/analyze-project-health.d.ts.map +1 -0
  53. package/dist/tools/complete-tasks.d.ts +42 -0
  54. package/dist/tools/complete-tasks.d.ts.map +1 -0
  55. package/dist/tools/delete-object.d.ts +54 -0
  56. package/dist/tools/delete-object.d.ts.map +1 -0
  57. package/dist/tools/export-project-template.d.ts +54 -0
  58. package/dist/tools/export-project-template.d.ts.map +1 -0
  59. package/dist/tools/fetch-object.d.ts +243 -0
  60. package/dist/tools/fetch-object.d.ts.map +1 -0
  61. package/dist/tools/fetch.d.ts +41 -0
  62. package/dist/tools/fetch.d.ts.map +1 -0
  63. package/dist/tools/find-activity.d.ts +98 -0
  64. package/dist/tools/find-activity.d.ts.map +1 -0
  65. package/dist/tools/find-comments.d.ts +91 -0
  66. package/dist/tools/find-comments.d.ts.map +1 -0
  67. package/dist/tools/find-completed-tasks.d.ts +119 -0
  68. package/dist/tools/find-completed-tasks.d.ts.map +1 -0
  69. package/dist/tools/find-filters.d.ts +95 -0
  70. package/dist/tools/find-filters.d.ts.map +1 -0
  71. package/dist/tools/find-labels.d.ts +81 -0
  72. package/dist/tools/find-labels.d.ts.map +1 -0
  73. package/dist/tools/find-project-collaborators.d.ts +94 -0
  74. package/dist/tools/find-project-collaborators.d.ts.map +1 -0
  75. package/dist/tools/find-projects.d.ts +98 -0
  76. package/dist/tools/find-projects.d.ts.map +1 -0
  77. package/dist/tools/find-reminders.d.ts +99 -0
  78. package/dist/tools/find-reminders.d.ts.map +1 -0
  79. package/dist/tools/find-sections.d.ts +45 -0
  80. package/dist/tools/find-sections.d.ts.map +1 -0
  81. package/dist/tools/find-tasks-by-date.d.ts +137 -0
  82. package/dist/tools/find-tasks-by-date.d.ts.map +1 -0
  83. package/dist/tools/find-tasks.d.ts +120 -0
  84. package/dist/tools/find-tasks.d.ts.map +1 -0
  85. package/dist/tools/get-overview.d.ts +121 -0
  86. package/dist/tools/get-overview.d.ts.map +1 -0
  87. package/dist/tools/get-productivity-stats.d.ts +160 -0
  88. package/dist/tools/get-productivity-stats.d.ts.map +1 -0
  89. package/dist/tools/get-project-activity-stats.d.ts +48 -0
  90. package/dist/tools/get-project-activity-stats.d.ts.map +1 -0
  91. package/dist/tools/get-project-health.d.ts +104 -0
  92. package/dist/tools/get-project-health.d.ts.map +1 -0
  93. package/dist/tools/get-user-status.d.ts +35 -0
  94. package/dist/tools/get-user-status.d.ts.map +1 -0
  95. package/dist/tools/get-workspace-insights.d.ts +63 -0
  96. package/dist/tools/get-workspace-insights.d.ts.map +1 -0
  97. package/dist/tools/import-project-template.d.ts +148 -0
  98. package/dist/tools/import-project-template.d.ts.map +1 -0
  99. package/dist/tools/list-workspaces.d.ts +54 -0
  100. package/dist/tools/list-workspaces.d.ts.map +1 -0
  101. package/dist/tools/manage-assignments.d.ts +73 -0
  102. package/dist/tools/manage-assignments.d.ts.map +1 -0
  103. package/dist/tools/project-management.d.ts +82 -0
  104. package/dist/tools/project-management.d.ts.map +1 -0
  105. package/dist/tools/project-move.d.ts +92 -0
  106. package/dist/tools/project-move.d.ts.map +1 -0
  107. package/dist/tools/reorder-objects.d.ts +61 -0
  108. package/dist/tools/reorder-objects.d.ts.map +1 -0
  109. package/dist/tools/reschedule-tasks.d.ts +95 -0
  110. package/dist/tools/reschedule-tasks.d.ts.map +1 -0
  111. package/dist/tools/search.d.ts +43 -0
  112. package/dist/tools/search.d.ts.map +1 -0
  113. package/dist/tools/set-user-status.d.ts +51 -0
  114. package/dist/tools/set-user-status.d.ts.map +1 -0
  115. package/dist/tools/uncomplete-tasks.d.ts +42 -0
  116. package/dist/tools/uncomplete-tasks.d.ts.map +1 -0
  117. package/dist/tools/update-comments.d.ts +100 -0
  118. package/dist/tools/update-comments.d.ts.map +1 -0
  119. package/dist/tools/update-filters.d.ts +121 -0
  120. package/dist/tools/update-filters.d.ts.map +1 -0
  121. package/dist/tools/update-labels.d.ts +133 -0
  122. package/dist/tools/update-labels.d.ts.map +1 -0
  123. package/dist/tools/update-projects.d.ts +138 -0
  124. package/dist/tools/update-projects.d.ts.map +1 -0
  125. package/dist/tools/update-reminders.d.ts +176 -0
  126. package/dist/tools/update-reminders.d.ts.map +1 -0
  127. package/dist/tools/update-sections.d.ts +65 -0
  128. package/dist/tools/update-sections.d.ts.map +1 -0
  129. package/dist/tools/update-tasks.d.ts +135 -0
  130. package/dist/tools/update-tasks.d.ts.map +1 -0
  131. package/dist/tools/user-info.d.ts +57 -0
  132. package/dist/tools/user-info.d.ts.map +1 -0
  133. package/dist/tools/view-attachment.d.ts +25 -0
  134. package/dist/tools/view-attachment.d.ts.map +1 -0
  135. package/dist/usage-tracking.d.ts +36 -0
  136. package/dist/usage-tracking.d.ts.map +1 -0
  137. package/dist/utils/assignment-validator.d.ts +69 -0
  138. package/dist/utils/assignment-validator.d.ts.map +1 -0
  139. package/dist/utils/batch-failures.d.ts +25 -0
  140. package/dist/utils/batch-failures.d.ts.map +1 -0
  141. package/dist/utils/children.d.ts +68 -0
  142. package/dist/utils/children.d.ts.map +1 -0
  143. package/dist/utils/colors.d.ts +68 -0
  144. package/dist/utils/colors.d.ts.map +1 -0
  145. package/dist/utils/comment-recipients.d.ts +35 -0
  146. package/dist/utils/comment-recipients.d.ts.map +1 -0
  147. package/dist/utils/concurrency.d.ts +35 -0
  148. package/dist/utils/concurrency.d.ts.map +1 -0
  149. package/dist/utils/constants.d.ts +93 -0
  150. package/dist/utils/constants.d.ts.map +1 -0
  151. package/dist/utils/date.d.ts +18 -0
  152. package/dist/utils/date.d.ts.map +1 -0
  153. package/dist/utils/duration-parser.d.ts +39 -0
  154. package/dist/utils/duration-parser.d.ts.map +1 -0
  155. package/dist/utils/filter-description.d.ts +16 -0
  156. package/dist/utils/filter-description.d.ts.map +1 -0
  157. package/dist/utils/filter-resolver.d.ts +27 -0
  158. package/dist/utils/filter-resolver.d.ts.map +1 -0
  159. package/dist/utils/host.d.ts +6 -0
  160. package/dist/utils/host.d.ts.map +1 -0
  161. package/dist/utils/labels.d.ts +13 -0
  162. package/dist/utils/labels.d.ts.map +1 -0
  163. package/dist/utils/move-planner.d.ts +63 -0
  164. package/dist/utils/move-planner.d.ts.map +1 -0
  165. package/dist/utils/order-keys.d.ts +36 -0
  166. package/dist/utils/order-keys.d.ts.map +1 -0
  167. package/dist/utils/output-schemas.d.ts +209 -0
  168. package/dist/utils/output-schemas.d.ts.map +1 -0
  169. package/dist/utils/personal-project-limit.d.ts +31 -0
  170. package/dist/utils/personal-project-limit.d.ts.map +1 -0
  171. package/dist/utils/priorities.d.ts +14 -0
  172. package/dist/utils/priorities.d.ts.map +1 -0
  173. package/dist/utils/reminder-recipients.d.ts +21 -0
  174. package/dist/utils/reminder-recipients.d.ts.map +1 -0
  175. package/dist/utils/reminder-schemas.d.ts +41 -0
  176. package/dist/utils/reminder-schemas.d.ts.map +1 -0
  177. package/dist/utils/response-builders.d.ts +103 -0
  178. package/dist/utils/response-builders.d.ts.map +1 -0
  179. package/dist/utils/retry.d.ts +39 -0
  180. package/dist/utils/retry.d.ts.map +1 -0
  181. package/dist/utils/schema-helpers.d.ts +10 -0
  182. package/dist/utils/schema-helpers.d.ts.map +1 -0
  183. package/dist/utils/sync-commands.d.ts +21 -0
  184. package/dist/utils/sync-commands.d.ts.map +1 -0
  185. package/dist/utils/test-helpers.d.ts +118 -0
  186. package/dist/utils/test-helpers.d.ts.map +1 -0
  187. package/dist/utils/tool-names.d.ts +60 -0
  188. package/dist/utils/tool-names.d.ts.map +1 -0
  189. package/dist/utils/user-resolver.d.ts +92 -0
  190. package/dist/utils/user-resolver.d.ts.map +1 -0
  191. package/dist/utils/user-status.d.ts +32 -0
  192. package/dist/utils/user-status.d.ts.map +1 -0
  193. package/dist/utils/validate-todoist-token.d.ts +17 -0
  194. package/dist/utils/validate-todoist-token.d.ts.map +1 -0
  195. package/dist/utils/workspace-resolver.d.ts +31 -0
  196. package/dist/utils/workspace-resolver.d.ts.map +1 -0
  197. package/package.json +116 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Doist
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 CHANGED
@@ -1,3 +1,233 @@
1
- # Temporary Holding Version
1
+ # Todoist MCP Server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Library for connecting AI agents to Todoist. Includes tools that can be integrated into LLMs,
4
+ enabling them to access and modify a Todoist account on the user's behalf.
5
+
6
+ These tools can be used both through an MCP server, or imported directly in other projects to
7
+ integrate them to your own AI conversational interfaces.
8
+
9
+ ## Using tools
10
+
11
+ ### 1. Add this repository as a dependency
12
+
13
+ ```sh
14
+ npm install @todoist/mcp
15
+ ```
16
+
17
+ This package was previously published as `@doist/todoist-mcp`.
18
+
19
+ ### 2. Import the tools and plug them to an AI
20
+
21
+ Here's an example using [Vercel's AI SDK](https://ai-sdk.dev/docs/ai-sdk-core/generating-text#streamtext).
22
+
23
+ ```js
24
+ import { findTasksByDate, addTasks } from '@todoist/mcp'
25
+ import { TodoistApi } from '@doist/todoist-sdk'
26
+ import { streamText } from 'ai'
27
+
28
+ // Create Todoist API client
29
+ const client = new TodoistApi(process.env.TODOIST_API_KEY)
30
+
31
+ // Helper to wrap tools with the client
32
+ function wrapTool(tool, todoistClient) {
33
+ return {
34
+ ...tool,
35
+ execute(args) {
36
+ return tool.execute(args, todoistClient)
37
+ },
38
+ }
39
+ }
40
+
41
+ const result = streamText({
42
+ model: yourModel,
43
+ system: 'You are a helpful Todoist assistant',
44
+ tools: {
45
+ findTasksByDate: wrapTool(findTasksByDate, client),
46
+ addTasks: wrapTool(addTasks, client),
47
+ },
48
+ })
49
+ ```
50
+
51
+ ## Using as an MCP server
52
+
53
+ ### Quick Start
54
+
55
+ You can run the MCP server directly with npx:
56
+
57
+ ```bash
58
+ npx -p @todoist/mcp todoist-mcp
59
+ ```
60
+
61
+ ### Setup Guide
62
+
63
+ The Todoist MCP server is available as a streamable HTTP service for easy integration with various AI clients:
64
+
65
+ **Primary URL (Streamable HTTP):** `https://ai.todoist.net/mcp`
66
+
67
+ #### Claude Desktop
68
+
69
+ 1. Open Settings → Connectors → Add custom connector
70
+ 2. Enter `https://ai.todoist.net/mcp` and complete OAuth authentication
71
+
72
+ #### Cursor
73
+
74
+ Create a configuration file:
75
+
76
+ - **Global:** `~/.cursor/mcp.json`
77
+ - **Project-specific:** `.cursor/mcp.json`
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "todoist": {
83
+ "command": "npx",
84
+ "args": ["-y", "mcp-remote", "https://ai.todoist.net/mcp"]
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ Then enable the server in Cursor settings if prompted.
91
+
92
+ #### Claude Code (CLI)
93
+
94
+ The fastest setup is the official Todoist plugin, which wires up the MCP server for you:
95
+
96
+ ```bash
97
+ /plugin marketplace add todoist/todoist-mcp
98
+ /plugin install todoist@doist
99
+ ```
100
+
101
+ OAuth runs in your browser the first time you use a Todoist tool. See [Anthropic's plugin docs](https://code.claude.com/docs/en/plugins-reference) for more.
102
+
103
+ If you'd rather configure the MCP server manually, run:
104
+
105
+ ```bash
106
+ claude mcp add --transport http todoist https://ai.todoist.net/mcp
107
+ ```
108
+
109
+ Then launch `claude`, execute `/mcp`, and select the `todoist` MCP server to authenticate.
110
+
111
+ #### Gemini CLI
112
+
113
+ Install the official Todoist extension with [Gemini CLI](https://geminicli.com/docs/get-started/installation/) 0.67.0 or later:
114
+
115
+ ```bash
116
+ gemini extensions install https://github.com/todoist/todoist-mcp
117
+ ```
118
+
119
+ Start or restart Gemini CLI, then run `/mcp auth todoist` and sign in with your Todoist account. Todoist hosts the server; no API key or local server is needed.
120
+
121
+ The assistant can read and change your Todoist tasks and projects. Revoke access at any time in Todoist under Settings → Integrations.
122
+
123
+ #### Visual Studio Code
124
+
125
+ 1. Open Command Palette → MCP: Add Server
126
+ 2. Select HTTP transport and use:
127
+
128
+ ```json
129
+ {
130
+ "servers": {
131
+ "todoist": {
132
+ "type": "http",
133
+ "url": "https://ai.todoist.net/mcp"
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ #### Other MCP Clients
140
+
141
+ ```bash
142
+ npx -y mcp-remote https://ai.todoist.net/mcp
143
+ ```
144
+
145
+ For more details on setting up and using the MCP server, including creating custom servers, see [docs/mcp-server.md](docs/mcp-server.md).
146
+
147
+ ## Features
148
+
149
+ A key feature of this project is that tools can be reused, and are not written specifically for use in an MCP server. They can be hooked up as tools to other conversational AI interfaces (e.g. Vercel's AI SDK).
150
+
151
+ This project is in its early stages. Expect more and/or better tools soon.
152
+
153
+ Nevertheless, our goal is to provide a small set of tools that enable complete workflows, rather than just atomic actions, striking a balance between flexibility and efficiency for LLMs.
154
+
155
+ For our design philosophy, guidelines, and development patterns, see [docs/tool-design.md](docs/tool-design.md).
156
+
157
+ ### Available Tools
158
+
159
+ For a complete list of available tools, see the [src/tools](src/tools) directory.
160
+
161
+ #### OpenAI MCP Compatibility
162
+
163
+ This server includes `search` and `fetch` tools that follow the [OpenAI MCP specification](https://platform.openai.com/docs/mcp), enabling seamless integration with OpenAI's MCP protocol. These tools return JSON-encoded results optimized for OpenAI's requirements while maintaining compatibility with the broader MCP ecosystem.
164
+
165
+ ## Dependencies
166
+
167
+ - MCP server using the official [@modelcontextprotocol/server](https://github.com/modelcontextprotocol/typescript-sdk)
168
+ - Todoist Typescript API client [@doist/todoist-sdk](https://github.com/Doist/todoist-sdk)
169
+
170
+ ## MCP Server Setup
171
+
172
+ See [docs/mcp-server.md](docs/mcp-server.md) for full instructions on setting up the MCP server.
173
+
174
+ ## Local Development Setup
175
+
176
+ See [docs/dev-setup.md](docs/dev-setup.md) for full setup instructions and [CONTRIBUTING.md](CONTRIBUTING.md) for contributor workflows and quality checks.
177
+
178
+ ### MCP Apps
179
+
180
+ This project includes support for **MCP Apps** – interactive UI widgets rendered inline in AI chat interfaces. Widgets provide rich visual representations of tool outputs (e.g., task lists) instead of plain text.
181
+
182
+ See [docs/mcp-apps.md](docs/mcp-apps.md) for the widget architecture, build pipeline, and development workflow.
183
+
184
+ ### Quick Start
185
+
186
+ After cloning and setting up the repository:
187
+
188
+ - `npm start` - Build and run the MCP inspector for testing
189
+ - `npm run dev` - Development mode with auto-rebuild and restart
190
+ - `npm run tool:list` - List available tools for direct execution
191
+ - `npm run tool -- <tool-name> '<json-args>'` - Run a tool directly without MCP
192
+
193
+ When using `npm run tool`, include `--` before tool arguments so npm forwards them to `scripts/run-tool.ts`.
194
+
195
+ Example check before write operations:
196
+ `npm run tool -- user-info '{}'`
197
+ This confirms which Todoist account the current `TODOIST_API_KEY` is connected to.
198
+
199
+ `run-tool` uses `TODOIST_API_KEY` from your `.env` file (created from `.env.example` by `npm run setup`). Use a test account or a temporary project when running write operations to avoid modifying real data.
200
+
201
+ ## Contributing
202
+
203
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for:
204
+
205
+ - Development workflow
206
+ - Running tools directly with `scripts/run-tool.ts`
207
+ - Testing and quality checks
208
+ - Commit conventions
209
+
210
+ ## Releasing
211
+
212
+ This project uses [release-please](https://github.com/googleapis/release-please) to automate version management and package publishing.
213
+
214
+ ### How it works
215
+
216
+ 1. Make your changes using [Conventional Commits](https://www.conventionalcommits.org/):
217
+ - `feat:` for new features (minor version bump)
218
+ - `fix:` for bug fixes (patch version bump)
219
+ - `feat!:` or `fix!:` for breaking changes (major version bump)
220
+ - `docs:` for documentation changes
221
+ - `chore:` for maintenance tasks
222
+ - `ci:` for CI changes
223
+
224
+ 2. When commits are pushed to `main`:
225
+ - Release-please automatically creates/updates a release PR
226
+ - The PR includes version bump and changelog updates
227
+ - Review the PR and merge when ready
228
+
229
+ 3. After merging the release PR:
230
+ - A new GitHub release is automatically created
231
+ - A new tag is created
232
+ - The `publish` workflow is triggered
233
+ - The package is published to npm
@@ -0,0 +1,53 @@
1
+ import { TodoistApi } from '@doist/todoist-sdk';
2
+ export declare const RESPONSIBLE_USER_FILTERING: readonly ["assigned", "unassignedOrMe", "all"];
3
+ export type ResponsibleUserFiltering = (typeof RESPONSIBLE_USER_FILTERING)[number];
4
+ /**
5
+ * Resolves a responsible user name/email to user ID and email.
6
+ * @param client - Todoist API client
7
+ * @param responsibleUser - User identifier (can be user ID, name, or email)
8
+ * @returns Object with userId and email, or undefined if not provided
9
+ * @throws Error if user cannot be found
10
+ */
11
+ export declare function resolveResponsibleUser(client: TodoistApi, responsibleUser: string | undefined): Promise<{
12
+ userId: string;
13
+ email: string;
14
+ } | undefined>;
15
+ /**
16
+ * Appends a filter component to a query string with proper ' & ' separator.
17
+ * @param query - The existing query string
18
+ * @param filterComponent - The filter component to append
19
+ * @returns The updated query string
20
+ */
21
+ export declare function appendToQuery(query: string, filterComponent: string): string;
22
+ /**
23
+ * Builds a query filter string for responsible user filtering that can be appended to a Todoist filter query.
24
+ * @param resolvedAssigneeId - The resolved assignee ID (if provided)
25
+ * @param assigneeEmail - The assignee email (if provided)
26
+ * @param currentUserId - The current authenticated user's ID
27
+ * @param responsibleUserFiltering - The filtering mode ('assigned', 'unassignedOrMe', 'all')
28
+ * @returns Query filter string (e.g., "assigned to: email@example.com" or "!assigned to: others")
29
+ */
30
+ export declare function buildResponsibleUserQueryFilter({ resolvedAssigneeId, assigneeEmail, currentUserId, responsibleUserFiltering, }: {
31
+ resolvedAssigneeId: string | undefined;
32
+ assigneeEmail: string | undefined;
33
+ currentUserId?: string;
34
+ responsibleUserFiltering?: ResponsibleUserFiltering;
35
+ }): string;
36
+ /**
37
+ * Filters tasks based on responsible user logic:
38
+ * - If resolvedAssigneeId is another user: returns only tasks assigned to that user
39
+ * - Otherwise: returns only unassigned tasks or tasks assigned to current user
40
+ * @param tasks - Array of tasks to filter (must have responsibleUid property)
41
+ * @param resolvedAssigneeId - The resolved assignee ID to filter by (optional)
42
+ * @param currentUserId - The current authenticated user's ID
43
+ * @returns Filtered array of tasks
44
+ */
45
+ export declare function filterTasksByResponsibleUser<T extends {
46
+ responsibleUid?: string;
47
+ }>({ tasks, resolvedAssigneeId, currentUserId, responsibleUserFiltering, }: {
48
+ tasks: T[];
49
+ resolvedAssigneeId: string | undefined;
50
+ currentUserId: string;
51
+ responsibleUserFiltering?: ResponsibleUserFiltering;
52
+ }): T[];
53
+ //# sourceMappingURL=filter-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-helpers.d.ts","sourceRoot":"","sources":["../src/filter-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAGpD,eAAO,MAAM,0BAA0B,gDAAiD,CAAA;AACxF,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAElF;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CACxC,MAAM,EAAE,UAAU,EAClB,eAAe,EAAE,MAAM,GAAG,SAAS,GACpC,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CAaxD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAQ5E;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,EAC5C,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,wBAA2C,GAC9C,EAAE;IACC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACtD,GAAG,MAAM,CAmBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EAChF,KAAK,EACL,kBAAkB,EAClB,aAAa,EACb,wBAA2C,GAC9C,EAAE;IACC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACtD,GAAG,CAAC,EAAE,CAgBN"}
@@ -0,0 +1,28 @@
1
+ import { Express } from 'express';
2
+ type CreateHttpAppOptions = {
3
+ todoistApiKey: string;
4
+ baseUrl?: string;
5
+ /** Hostnames trusted in the Host/Origin headers (DNS-rebinding protection). */
6
+ allowedHosts: string[];
7
+ };
8
+ type HttpApp = {
9
+ app: Express;
10
+ /**
11
+ * Ends the open `subscriptions/listen` streams and aborts in-flight MCP
12
+ * exchanges. Call it before closing the HTTP server, otherwise
13
+ * `server.close()` waits for those streams to end on their own.
14
+ */
15
+ close: () => Promise<void>;
16
+ };
17
+ /**
18
+ * Build the Express app for the MCP HTTP server.
19
+ *
20
+ * The DNS-rebinding guard (`requireTrustedHost`) is scoped to the sensitive
21
+ * `/mcp` routes and runs ahead of body parsing and token auth there. `/health`
22
+ * is intentionally unguarded so deployment health probes — which send the
23
+ * target's private IP in the Host header — keep working; it exposes no account
24
+ * data.
25
+ */
26
+ declare function createHttpApp({ todoistApiKey, baseUrl, allowedHosts }: CreateHttpAppOptions): HttpApp;
27
+ export { createHttpApp, type CreateHttpAppOptions, type HttpApp };
28
+ //# sourceMappingURL=http-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-app.d.ts","sourceRoot":"","sources":["../src/http-app.ts"],"names":[],"mappings":"AAEA,OAAgB,EAAE,KAAK,OAAO,EAA+B,MAAM,SAAS,CAAA;AAK5E,KAAK,oBAAoB,GAAG;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,YAAY,EAAE,MAAM,EAAE,CAAA;CACzB,CAAA;AAED,KAAK,OAAO,GAAG;IACX,GAAG,EAAE,OAAO,CAAA;IACZ;;;;OAIG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;AACH,iBAAS,aAAa,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAoD9F;AAED,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,OAAO,EAAE,CAAA"}