teams-cli
A Unix-style CLI for Microsoft Teams. Read, send, and search messages from your terminal. Scriptable, pipe-friendly, and integrates with Claude Code as a skill.
Prerequisites
- Go 1.26.1+
- macOS (uses WebKit webview for OAuth)
- A Microsoft Teams account
Install
git clone https://github.com/kamrul1157024/teams-cli.git
cd teams-cli
make install
This builds the binary and copies it to /usr/local/bin/teams-cli.
To install to a custom location:
make install INSTALL_DIR=~/bin
Authentication
teams-cli uses native OAuth via a webview window. Run once to authenticate:
teams-cli auth
This opens a browser-like window, you log in with your Microsoft account, and it acquires 3 tokens (Teams, Skype, ChatSvcAgg). Tokens are saved to ~/.config/teams-cli/ and last ~1 hour.
To check token status:
teams-cli status --format table
To force re-authentication:
teams-cli auth --force
Usage
Chats
# List all chats
teams-cli chats list --format table
# List unread chats
teams-cli chats list --unread --format table
# List 1:1 chats only
teams-cli chats list --type "1:1" --format table
Messages
# Read last 20 messages from a chat
teams-cli messages list <chat-id> -n 20 --format table
# Send a message
teams-cli messages send <chat-id> "Hello!"
# Send by email (resolves to 1:1 chat)
teams-cli messages send --to [email protected] "Hello!"
# Pipe from stdin
echo "Build passed" | teams-cli messages send <chat-id>
# Search messages
teams-cli messages search "deploy" --format table
Teams & Channels
# List your teams
teams-cli teams list --format table
# List channels in a team
teams-cli channels list <team-id> --format table
Users
# Look up a user
teams-cli users search [email protected] --format table
Output Formats
All commands support --format json|table|text. Default is json. Add --pretty for formatted JSON.
# JSON (default, good for piping)
teams-cli chats list --format json | jq '.[] | .title'
# Table (human-readable)
teams-cli chats list --format table
# Text (minimal, one ID per line)
teams-cli chats list --format text
Claude Code Skill
teams-cli includes a Claude Code skill that turns Claude into an interactive Teams assistant. It can check your messages, draft replies matching your communication style, and manage contact relationship profiles.
Install from Marketplace
If teams-cli is published as a Claude Code plugin:
claude plugin add kamrul1157024/teams-cli
This installs the skill and makes /teams available in Claude Code.
Install Manually
make skill-install
Or manually:
mkdir -p ~/.claude/skills/teams
cp skills/teams/SKILL.md ~/.claude/skills/teams/SKILL.md
Using the Skill
In any Claude Code session, type:
/teams
Claude will:
- Check your auth tokens are valid
- If first time, build your communication persona by analyzing your chat history
- Ask what you want to do — check unreads, send messages, search, etc.
What the Skill Does
- Check unread messages — summarizes what's new across all chats
- Send messages — drafts replies matching your tone, always confirms before sending
- Search — finds messages across conversations
- Persona management — learns your communication style from chat history
- Contact profiles — tracks your relationship and tone with each contact
- Safety rules — never sends without approval, avoids sensitive topics, respects cultural differences
Persona & Context System
The skill stores communication context at ~/.teams-agent/:
~/.teams-agent/
├── persona.md # Your communication style
├── safety-rules.md # Hard safety constraints
├── config.yaml # Settings
├── contacts/ # Per-person relationship profiles
├── groups/ # Group chat dynamics
└── patterns/ # Response templates by topic
This is built automatically the first time you use /teams. It analyzes your chat history to extract your actual phrases, tone, and relationship dynamics — so replies sound like you, not a bot.
Development
make build # Build binary to bin/
make install # Build and install to /usr/local/bin
make test # Run tests
make fmt # Format code
make tidy # Tidy dependencies
make clean # Remove build artifacts
make help # Show all targets
Architecture