{"slug": "teamscache-read-local-microsoft-teams-messages-via-cli-or-mcp", "title": "TeamsCache – Read Local Microsoft Teams Messages via CLI or MCP", "summary": "A tool called teamscache, published by developer stn1slv, reads the local message cache of the new Microsoft Teams (v2) desktop client and outputs chats, messages and @-mentions as JSON, and can run as a read-only MCP server for AI assistants. The tool avoids Microsoft Graph, OAuth, Azure app registration and the network entirely, reading only what the signed-in Teams client already stores on disk, which the author says helps users such as guests in another company's tenant who often cannot obtain Graph permissions like Chat.Read without admin consent. It installs via Homebrew (brew install stn1slv/tap/teamscache), Go 1.27 or later, or make build, requires a new Teams client signed in at least once, and auto-discovers the cache on macOS and Windows but only best-effort on Linux.", "body_md": "`teamscache` reads the message cache of the new Microsoft Teams (v2) desktop client on your computer. It prints chats, messages and @-mentions as JSON, and it can also run as a read-only MCP server for AI assistants.\n\nIt does not use Microsoft Graph, OAuth, an Azure app registration or the network. It reads only what the signed-in Teams client already keeps on your disk.\n\nTo read Teams messages through Microsoft Graph, you need permissions such as `Chat.Read`, and many tenants allow them only after admin consent. As a guest in another company's tenant, you often cannot get that consent. The desktop client still keeps your recent conversations on your disk, and `teamscache` reads them from there.\n\nWith Homebrew on macOS or Linux:\n\n```\nbrew install stn1slv/tap/teamscache\n```\n\nBinaries for macOS, Linux and Windows are on the [releases page](https://github.com/stn1slv/teamscache/releases).\n\nWith Go 1.27 or later:\n\n```\ngo install github.com/stn1slv/teamscache/cmd/teamscache@latest\n```\n\nOr build from source with `make build`; the binary is written to `bin/teamscache`.\n\nYou need a new Teams client that has been signed in at least once. Auto-discovery of the cache works on macOS and Windows. On Linux it is best effort.\n\n1. \nRead all cached messages in one chat (oldest first): \n\n```\nteamscache conversations --limit 0       # find the conversation \"id\"\nteamscache read \"19:abc@thread.v2\" --limit 0\n```\n\n2. \nFilter by account or WebView2 profile when you have multiple tenants or profiles: \n\n```\nteamscache accounts                      # get \"<tenantId>:<userId>\"\nteamscache overview --account \"<tenantId>:<userId>\"\n\nteamscache profiles                      # get profile folder name\nteamscache overview --profile \"Default\"\n```\n\n3. \nSave JSON output to a file (JSON goes to stdout, summary goes to stderr): \n\n```\nteamscache read \"19:abc@thread.v2\" --limit 0 > chat.json\n```\n\n`teamscache` reads only messages stored in the local Teams desktop cache, not older history that Teams has not cached on disk. `read` returns messages oldest first; `recent`, `search`, `mentions`, and `overview` return newest first.\n\n```\nteamscache accounts                      # tenant and user contexts in the cache\nteamscache profiles                      # discovered WebView2 cache profiles\nteamscache overview --days 7             # recent activity grouped by conversation\nteamscache recent --days 7               # messages of the last 7 days, newest first\nteamscache mentions --unread             # @-mentions of you that are not read yet\nteamscache search \"quarterly budget\"     # text in message content or sender name, newest first\nteamscache conversations                 # chats and channels (id, title, type, last message)\nteamscache read \"19:abc@thread.v2\"       # last 50 messages of one conversation, oldest first\nteamscache dump                          # accounts, conversations, messages and mentions in one JSON object\n```\n\nAll commands print JSON to stdout and a short summary to stderr, for example `# 12 result(s), 0 record(s) skipped, 0 damaged section(s)`. Skipped records could not be decoded. Damaged sections are unreadable file sections or missing referenced blob files, and are counted separately.\n\n| Command | Flags and defaults | \n|---|---|\n| `conversations` | `--limit 50` | \n| `search QUERY` | `--limit 50` ,`--days 0` | \n| `read CONVERSATION_ID` | `--limit 50` | \n| `recent` | `--limit 200` ,`--days 7` | \n| `mentions` | `--limit 100` ,`--days 0` ,`--unread` (`false` ) | \n| `overview` | `--days 7` | \n| `dump` | `--days 0` | \n| `mcp` | `--cache-ttl 180s` (Go duration, such as`180s` or`3m` ) | \n\nIn those command flags, `--limit N` sets the maximum number of results (`0` means no limit). `--days N` keeps only items from the last N days (`0` means all dates, and `--limit` still applies). `--unread` keeps only unread @-mentions.\n\nGlobal flags:\n\n| Flag | Meaning | \n|---|---|\n| `--account <tenantId>:<userId>` | Only one account. The keys come from `teamscache accounts` . With`mcp` , every tool serves only this account. | \n| `--leveldb PATH` | Read this cache folder instead of the auto-discovered one. Cannot be combined with `--profile` . | \n| `--profile NAME` | Choose a discovered WebView2 profile by folder name (see `teamscache profiles` ). Cannot be combined with`--leveldb` . | \n| `--max-content N` | Characters of message content in CLI `mentions` ,`overview` ,`dump` , and all MCP results (`0` means no limit, default`600` ). CLI`conversations` ,`read` ,`recent` , and`search` print full content. | \n| `-v` ,`--verbose` | Log details, such as skipped records, to stderr. | \n\nEnvironment variables:\n\n| Variable | Meaning | \n|---|---|\n| `TEAMSCACHE_LEVELDB` | Default for `--leveldb` (cannot be set with`TEAMSCACHE_PROFILE` ). | \n| `TEAMSCACHE_PROFILE` | Default for `--profile` (cannot be set with`TEAMSCACHE_LEVELDB` ). | \n| `TEAMSCACHE_MAX_CONTENT` | Default for `--max-content` . | \n| `TEAMSCACHE_CACHE_TTL` | Integer number of seconds the MCP server reuses a parsed cache (default `180` ). | \n\nThe cache has no general read or unread marker. The read state of @-mentions is the only read state it keeps, so `mentions --unread` is the reliable way to find what needs your attention.\n\n`teamscache mcp` runs a read-only MCP server on stdin and stdout. Example configuration for Claude Desktop or Claude Code:\n\n```\n{\n  \"mcpServers\": {\n    \"teams\": { \"command\": \"teamscache\", \"args\": [\"mcp\"] }\n  }\n}\n```\n\nPass `--max-content 0` for full message content in MCP tool results, or `--account <tenantId>:<userId>` to serve only one account:\n\n```\n{\n  \"mcpServers\": {\n    \"teams\": {\n      \"command\": \"teamscache\",\n      \"args\": [\"mcp\", \"--max-content\", \"0\", \"--account\", \"<tenantId>:<userId>\"]\n    }\n  }\n}\n```\n\n| Tool | Purpose | Key arguments and defaults | \n|---|---|---|\n| `overview` | Who messaged you: recent activity grouped by conversation. A good first call. | `days` (`7` ),`limit` (`100` ),`account` | \n| `recent_messages` | Messages of the last N days, newest first. | `days` (`7` ),`limit` (`200` ),`account` | \n| `mentions` | @-mentions of you, with content and read state. | `days` (`0` ),`unread_only` (`false` ),`limit` (`100` ),`account` | \n| `unread_messages` | Your unread @-mentions. | `days` (`30` ),`limit` (`100` ),`account` | \n| `search_messages` | Text search in content and sender names. | `query` (required),`days` (`0` ),`limit` (`50` ),`account` | \n| `list_conversations` | Chats and channels with their titles and IDs. | `limit` (`100` ),`account` | \n| `read_conversation` | Last messages of one conversation, oldest first. Pass `limit: 0` for all cached messages. | `conversation_id` (required),`limit` (`50` ),`account` | \n| `list_accounts` | Accounts in the cache; use `key` as the`account` filter. | none | \n\nThe server parses the cache on the first tool call and keeps the result in memory. It parses again when the TTL ends or when Teams writes new data.\n\nEvery tool response keeps its rows in `result` and includes `skipped_records`, `damaged_sections`, and `partial`. When `partial` is true, some cache data could not be read, so an empty result does not confirm that no matching messages exist.\n\nThe new Teams client (`com.microsoft.teams2` on macOS, the `MSTeams` package on Windows) is an Edge WebView2 app. It stores recent conversations in an IndexedDB database, which Chromium keeps in LevelDB with values in the V8 serialization format. `teamscache`:\n\n1. finds the LevelDB folder, or uses `--leveldb` ,\n2. copies its data files and referenced blob files to a temporary folder, because the running client locks the files, and removes the copy when it is done,\n3. reads the LevelDB files directly (tables and logs, including Snappy-compressed blocks), without a LevelDB engine,\n4. decodes the IndexedDB keys and the Blink and V8 values,\n5. maps the Teams schema: messages in `replychains` and its numbered copies such as`replychains-2` , chats in`conversations` , mentions in`mentions-metadata-items` , one database set per tenant and user.\n\nLevelDB can keep older versions of a record until it compacts its files. `teamscache` uses only the newest version of each record, so an edited message shows its current text and the read state of a mention is the current one.\n\nThe LevelDB, IndexedDB and V8 decoding is a Go port of parts of [ccl_chromium_reader](https://github.com/cclgroupltd/ccl_chromium_reader). See [THIRD_PARTY_NOTICES.md](https://github.com/stn1slv/teamscache/blob/main/THIRD_PARTY_NOTICES.md).\n\nThe tool is read-only and makes no network calls. The temporary copy of the cache is created with owner-only permissions and removed after each run. Output can contain message content from all tenants in the cache, so treat it as confidential.\n\n```\nmake setup    # download dependencies\nmake test     # unit tests with the race detector\nmake lint     # golangci-lint and gofumpt\nmake format   # format the code\nmake build    # build bin/teamscache\nmake upgrade-deps # update dependencies and pinned Go tools\n```\n\nTests use synthetic data only. The test fixtures and their generators are in `testdata` folders:\n\n- `internal/v8/testdata` : values written by Node.js`v8.serialize` (`gen.mjs` ) and the result of`ccl_chromium_reader` for the same bytes (`golden.py` ).\n- `internal/indexeddb/testdata` : a synthetic IndexedDB written by`gen/main.go` , and the records`ccl_chromium_reader` reads from it (`gen/golden.py` ).\n- `internal/teams/testdata/gen` : a synthetic Teams cache with edge cases, for manual end-to-end checks.\n\nMIT. See [LICENSE](https://github.com/stn1slv/teamscache/blob/main/LICENSE) and [THIRD_PARTY_NOTICES.md](https://github.com/stn1slv/teamscache/blob/main/THIRD_PARTY_NOTICES.md).", "url": "https://wpnews.pro/news/teamscache-read-local-microsoft-teams-messages-via-cli-or-mcp", "canonical_source": "https://github.com/stn1slv/teamscache", "published_at": "2026-11-22 09:29:24+00:00", "updated_at": "2026-11-22 09:41:52.849048+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "agent-protocols"], "entities": ["teamscache", "Microsoft Teams", "Microsoft Graph", "stn1slv", "Homebrew", "Go", "MCP"], "also_reported_by": [], "takeaway": "teamscache exposes local Teams v2 cache data as JSON and as a read-only MCP server without Graph, OAuth or network access, with --limit 0 meaning no limit and the mcp command caching for 180s by default.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/teamscache-read-local-microsoft-teams-messages-via-cli-or-mcp", "markdown": "https://wpnews.pro/news/teamscache-read-local-microsoft-teams-messages-via-cli-or-mcp.md", "text": "https://wpnews.pro/news/teamscache-read-local-microsoft-teams-messages-via-cli-or-mcp.txt", "jsonld": "https://wpnews.pro/news/teamscache-read-local-microsoft-teams-messages-via-cli-or-mcp.jsonld"}}