Skip to content

Conversation

batteryshark
Copy link

This pull request introduces secure credential storage for the Todoist AI MCP server by enabling users to store their Todoist API key in the system keychain, rather than relying solely on environment variables. It adds a new setup script, updates documentation to recommend the keychain approach, and modifies the server startup logic to prefer keychain credentials when available. The most important changes are grouped below:

Secure Credential Storage Implementation

  • Added a new keychain.ts utility module that provides functions to store, retrieve, check, and clear the Todoist API key using the system keychain via the @napi-rs/keyring library. (src/utils/keychain.ts)
  • Introduced a new setup script (setup-keychain.ts/setup-keychain.js) that securely prompts for the API key (with hidden input), stores it in the keychain, and handles overwrite confirmation. Both TypeScript and JavaScript entry points are provided for compatibility. (src/setup-keychain.ts, scripts/setup-keychain.js) [1] [2]
  • Updated package.json to register the new todoist-ai-setup-keychain CLI command and ensure the script is executable after build. Also, added the @napi-rs/keyring dependency. (package.json) [1] [2] [3]

Server Startup Logic

  • Modified the server's startup logic to check for the API key in the environment variable first, then fall back to the keychain if not set, and throw a descriptive error if neither is available. (src/main.ts)

Documentation Updates

  • Updated all relevant documentation files (README.md, docs/dev-setup.md, docs/mcp-server.md) to recommend the keychain method for storing credentials, provide setup instructions, and clarify configuration for both environment variable and keychain usage. (README.md, docs/dev-setup.md, docs/mcp-server.md) [1] [2] [3] [4] [5] [6]

These changes make credential management more secure and user-friendly, while maintaining backward compatibility with environment variable configuration.Added keyring support to store Todoist API key in the user keychain as an alternative to using environment variables.

Pull Request

Closes #...

Short description

PR Checklist

Feel free to leave unchecked or remove the lines that are not applicable.

  • Updated docs (README, etc.)

Added keyring support to store Todoist API key in the user keychain as an alternative to using environment variables.
@gnapse
Copy link
Collaborator

gnapse commented Sep 30, 2025

Hey @batteryshark, thanks for this! Really appreciate the focus on credential security and the solid implementation.

However, I'm leaning towards keeping the environment variables approach for now.

Our main focus is actually the hosted MCP server at https://ai.todoist.net/mcp which uses OAuth (no local credentials needed). That's where we see things heading. The local server auth config via env variables is mainly for dev/testing and edge cases. And environment variables are simple and widely understood by developers.

For the core package, we want to keep things simple and as dependency-free as possible to minimize maintenance overhead. We do not see this new capability (and the few additional dependencies it brings in) as something we'd like to maintain going forward.

Alternative idea: What about creating a wrapper package that adds your keychain functionality around our existing server? Something like @your-org/todoist-ai-secure that internally uses @doist/todoist-ai but handles the credential storage your way.

This would let you solve the security problem for users who want it, while keeping our core focused on the hosted OAuth solution. We'd be happy to link to it in our docs and collaborate on compatibility.

Thoughts on that approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants