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.
- Go 1.26.1+
- macOS (uses WebKit webview for OAuth)
- A Microsoft Teams account
git clone https://github.com/kamrul1157024/teams-cli.git
cd teams-cli
make installThis builds the binary and copies it to /usr/local/bin/teams-cli.
To install to a custom location:
make install INSTALL_DIR=~/binteams-cli uses native OAuth via a webview window. Run once to authenticate:
teams-cli authThis 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 tableTo force re-authentication:
teams-cli auth --force# 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# 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 user@company.com "Hello!"
# Pipe from stdin
echo "Build passed" | teams-cli messages send <chat-id>
# Search messages
teams-cli messages search "deploy" --format table# List your teams
teams-cli teams list --format table
# List channels in a team
teams-cli channels list <team-id> --format table# Look up a user
teams-cli users search user@company.com --format tableAll 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 textteams-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.
If teams-cli is published as a Claude Code plugin:
claude plugin add kamrul1157024/teams-cliThis installs the skill and makes /teams available in Claude Code.
make skill-installOr manually:
mkdir -p ~/.claude/skills/teams
cp skills/teams/SKILL.md ~/.claude/skills/teams/SKILL.mdIn 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.
- 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
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.
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 targetsteams-cli/
├── main.go # Entry point
├── cmd/ # Cobra CLI commands
│ ├── root.go # Global flags (--format, --pretty, --quiet)
│ ├── auth.go # teams-cli auth
│ ├── status.go # teams-cli status
│ ├── me.go # teams-cli me
│ ├── chats.go # teams-cli chats list
│ ├── messages.go # teams-cli messages list/send/search
│ ├── teams.go # teams-cli teams list
│ ├── channels.go # teams-cli channels list
│ └── users.go # teams-cli users search
├── auth/ # Authentication
│ ├── oauth.go # Webview OAuth flow (3 tokens)
│ ├── tokens.go # Token storage and JWT decoding
│ └── refresh.go # Token refresh via authz endpoint
├── api/ # Teams API client
│ ├── client.go # HTTP client with retry and auth headers
│ ├── conversations.go # Chats, teams, channels
│ ├── messages.go # Read/send/search messages
│ └── users.go # User lookup
└── output/ # Output formatters
├── json.go
├── table.go
└── text.go
MIT