Skip to content

Conversation

@BayramAnnakov
Copy link
Contributor

Summary

Add support for storing Telegram API credentials in macOS Keychain instead of plain text .env files.

Changes

  • Add get_credential_from_keychain() function to read from macOS Keychain
  • Add get_credential() wrapper that tries Keychain first, falls back to environment variables
  • Update credential loading to use the new functions
  • Full backward compatibility: existing .env setups continue to work

Usage

Store credentials in Keychain:

security add-generic-password -a "api_id" -s "telegram-mcp" -w "YOUR_API_ID" -U
security add-generic-password -a "api_hash" -s "telegram-mcp" -w "YOUR_API_HASH" -U
security add-generic-password -a "session_string" -s "telegram-mcp" -w "YOUR_SESSION_STRING" -U

Benefits

  • Credentials never stored in plain text on disk
  • Protected by macOS security (Touch ID, password)
  • Not accidentally committed to git
  • No changes required for existing users (falls back to .env)

Platform Support

  • macOS: Full Keychain support
  • Linux/Windows: Falls back to environment variables (no change in behavior)

🤖 Generated with Claude Code

Credentials can now be stored in macOS Keychain instead of plain text .env files:
- security add-generic-password -a "api_id" -s "telegram-mcp" -w "YOUR_API_ID" -U
- security add-generic-password -a "api_hash" -s "telegram-mcp" -w "YOUR_API_HASH" -U
- security add-generic-password -a "session_string" -s "telegram-mcp" -w "YOUR_SESSION_STRING" -U

The code tries Keychain first, then falls back to environment variables,
maintaining full backward compatibility.

Benefits:
- Credentials never stored in plain text on disk
- Protected by macOS security (Touch ID, password)
- Not accidentally committed to git

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@iqdoctor
Copy link
Contributor

pls fix black

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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