This document outlines the steps necessary to run this MCP server and connect to an MCP host application, such as Claude Desktop or Cursor.
The easiest way to use this MCP server is with npx:
npx @doist/todoist-aiYou'll need to set your Todoist API key as an environment variable TODOIST_API_KEY.
Start by cloning this repository and setting it up locally, if you haven't done so yet.
git clone https://github.com/Doist/todoist-ai
npm run setupTo test the server locally before connecting it to an MCP client, you can use:
npm startThis will build the project and run the MCP inspector for manual testing.
For convenience, we also include a function that initializes an MCP Server with all the tools available:
import { getMcpServer } from "@doist/todoist-ai";
async function main() {
const server = getMcpServer({ todoistApiKey: process.env.TODOIST_API_KEY });
const transport = new StdioServerTransport();
await server.connect(transport);
}Then, proceed depending on the MCP protocol transport you'll use.
Add this section to your mcp.json config in Claude, Cursor, etc.:
{
"mcpServers": {
"todoist-ai": {
"type": "stdio",
"command": "npx",
"args": ["@doist/todoist-ai"],
"env": {
"TODOIST_API_KEY": "your-todoist-token-here"
}
}
}
}Add this todoist-ai-tools section to your mcp.json config in Cursor, Claude, Raycast, etc.
{
"mcpServers": {
"todoist-ai-tools": {
"type": "stdio",
"command": "node",
"args": ["/Users/<your_user_name>/code/todoist-ai-tools/dist/main.js"],
"env": {
"TODOIST_API_KEY": "your-todoist-token-here"
}
}
}
}Update the configuration above as follows
- Replace
TODOIST_API_KEYwith your Todoist API token. - Replace the path in the
argsarray with the correct path to where you cloned the repository
Note
You may also need to change the command, passing the full path to your node binary, depending one how you installed node.
You can run the MCP server as an HTTP service with configurable session timeouts. This is useful as an alternative to the hosted service at ai.todoist.net/mcp, especially if you experience frequent session disconnections (#239).
# Default: 30 minute session timeout
TODOIST_API_KEY=your-key npx -p @doist/todoist-ai todoist-ai-http
# Custom timeout: 1 hour (3600000ms)
TODOIST_API_KEY=your-key SESSION_TIMEOUT_MS=3600000 npx -p @doist/todoist-ai todoist-ai-http
# Custom port
TODOIST_API_KEY=your-key PORT=8080 npx -p @doist/todoist-ai todoist-ai-httpAfter cloning the repository:
# Install dependencies and build
npm install && npm run build
# Run the HTTP server
TODOIST_API_KEY=your-key npm run start:http
# Or directly with node
TODOIST_API_KEY=your-key node dist/main-http.js| Variable | Default | Description |
|---|---|---|
TODOIST_API_KEY |
(required) | Your Todoist API key |
PORT |
3000 |
HTTP server port |
SESSION_TIMEOUT_MS |
1800000 |
Session timeout in milliseconds (30 min default) |
TODOIST_BASE_URL |
(optional) | Custom Todoist API base URL |
PORT=8080 npm run dev:httpThis will expose the service at http://localhost:8080/mcp with hot-reload.
MCP host applications can connect via the mcp-remote bridge:
{
"mcpServers": {
"todoist-mcp-http": {
"type": "stdio",
"command": "npx",
"args": ["mcp-remote", "http://localhost:3000/mcp"]
}
}
}The HTTP server exposes a health check endpoint at /health that returns:
- Server status
- Number of active sessions
- Configured session timeout
curl http://localhost:3000/healthNote
You may also need to change the command, passing the full path to your npx binary, depending on how you installed node.
- The task list widget is bundled and inlined at Vite build time via a custom plugin (
virtual:todoist-ai-widgets). - The plugin uses
BUILD_TIMESTAMP(fromprocess.env.BUILD_TIMESTAMPor auto-generated) to cache-bust the widget URI (e.g.,task-list-<timestamp>.html). - The final HTML is embedded in the JS bundle; the runtime MCP server does not read from
dist/to find widget files. npm run buildis sufficient