mattermost-mcp
A read-only Mattermost MCP server for browsing channels, posts, threads, DMs, mentions, unreads, users, teams, and file metadata.
List channels, with optional team, sidebar category, DM, and muted-channel filters.
Read recent channel posts and page through history by timestamp or post ID.
Fetch a post and all of its replies in a thread.
Search posts with Mattermost search syntax, optionally scoped by channel or category and muted status.
Retrieve direct-message history with a user.
Get mentions and unread/mention counts per channel.
Look up a user by username or search users by username, name, nickname, or email prefix.
Get your own profile, auth mode, and whether write mode is enabled.
List your teams.
Get a single post, a channel by ID or name, pinned posts, and attached file metadata without downloading content.
This schema exposes only read tools; posting, editing, reacting, and sending DMs are not available.
Provides read-only access to a Mattermost workspace, letting an agent list channels with unread counts and mute state, fetch recent channel posts, retrieve threads and DM history, get mentions and per-channel unread counts, view user profiles, and run full-text post searches optionally scoped to a channel or sidebar category.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mattermost-mcp show my unread Mattermost channels and mentions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mattermost-mcp
A Model Context Protocol server for Mattermost. It lets an AI agent (Claude, Cursor, VS Code, any MCP client) catch up on your unreads and mentions, read channels, threads and DMs, and search. If you switch write mode on, the agent can also post, reply, send DMs, edit its own messages and react.
Read-only by default. Write tools are not even registered until you set
MATTERMOST_ENABLE_WRITE=1. Even then, the agent can only edit posts written by your own account.Sees what you see. Unread counts match the client badge (muted channels are skipped, collapsed-thread counts are used) and sidebar categories work as filters. Mentions from muted channels are still shown.
Works where personal access tokens don't. Use a personal access token (PAT) or bot token if you can. If an admin has disabled PATs (common with SSO), run
mattermost-mcp-server login: sign in once in a browser window and the server picks up the session cookies itself, and picks them up again when they expire.Fast. Channel metadata is fetched once, across teams in parallel, and cached briefly. No per-channel requests.
Quick start
Create a personal access token in Mattermost: Profile → Security → Personal Access Tokens → Create Token. If that section is missing, an admin must enable System Console → Integrations → Integration Management → Enable Personal Access Tokens, or skip the token and sign in with your browser instead.
Install uv.
Add the server to your client.
Claude Code
claude mcp add mattermost \
-e MATTERMOST_URL=https://mattermost.example.com \
-e MATTERMOST_ACCESS_TOKEN=your-token \
-- uvx mattermost-mcp-serverClaude Desktop (claude_desktop_config.json), Cursor
(~/.cursor/mcp.json) and other clients that use mcpServers:
{
"mcpServers": {
"mattermost": {
"command": "uvx",
"args": ["mattermost-mcp-server"],
"env": {
"MATTERMOST_URL": "https://mattermost.example.com",
"MATTERMOST_ACCESS_TOKEN": "your-token"
}
}
}
}VS Code (.vscode/mcp.json):
{
"inputs": [
{ "type": "promptString", "id": "mm-token", "description": "Mattermost access token", "password": true }
],
"servers": {
"mattermost": {
"command": "uvx",
"args": ["mattermost-mcp-server"],
"env": {
"MATTERMOST_URL": "https://mattermost.example.com",
"MATTERMOST_ACCESS_TOKEN": "${input:mm-token}"
}
}
}
}Then try asking: "What did I miss in Mattermost today?" or "Summarize the thread about the release in #engineering."
To let the agent post, add "MATTERMOST_ENABLE_WRITE": "1" to env (see
Write mode).
Related MCP server: Mattermost MCP Server
Tools
Tool | Kind | What it does |
| read | Unread and mention counts per channel; skips muted channels by default, like the client badge |
| read | Posts that mention you, newest first; |
| read | Your channels with |
| read | Recent posts in a channel; |
| read | A root post and all its replies |
| read | Full-text search with Mattermost syntax ( |
| read | DM history with a user; |
| read | A user's profile by username |
| read | Find users by name, username or email prefix |
| read | Your profile, the auth mode, and whether write mode is on |
| read | Your teams |
| read | One post by ID |
| read | A channel by ID or by name ( |
| read | Pinned posts of a channel |
| read | Name, type and size of an attached file (content is not downloaded) |
| write | Post in a channel, or reply in a thread with |
| write | DM a user by username |
| write | Edit one of your own posts; refuses anyone else's |
| write | React with an emoji ( |
| write | Remove your reaction; no error if it was not there |
Every tool carries MCP annotations (readOnlyHint, destructiveHint,
idempotentHint), so clients can auto-approve reads and ask before writes.
Nothing can delete posts, change channels or perform admin actions.
Write mode
Write mode is off unless MATTERMOST_ENABLE_WRITE is 1, true, yes or
on. When it is off:
the five write tools are not registered, so the model never sees them;
the HTTP client refuses every request that is not a GET or one of the read-only POSTs (user lookup, user search, post search), before anything is sent.
The one server-side effect of read-only mode is the same as in any
Mattermost client: get_direct_messages with someone you have never
messaged creates the (empty) DM channel between you.
When write mode is on, update_post checks the post's author and refuses
any post that is not yours, even if your account has permission to edit
other people's posts. Posts are written as the authenticated user (or bot),
so consider a dedicated bot account for agents that post on their own.
Configuration
Variable | Default | Meaning |
| — (required) | Base URL of your server, e.g. |
| — | Personal access token or bot token; selects token auth |
| off |
|
| auto |
|
| — | Cookie auth: value of the |
| — | Cookie auth: value of the |
| — | Cookie auth: value of the |
| off |
|
|
| Seconds to wait for an automatic sign-in |
| auto | Path of the Chromium-family browser used by |
| — | Extra browser flags for |
|
| Sign-in browser profile (mode 0700) |
|
| Where |
|
| Seconds to cache channel metadata; |
|
|
|
| — | Extra text appended to the 401 error, e.g. how credentials are rotated in your setup |
|
| Keychain service name (see Credential sources) |
| off | Cookie host: ssh alias, or |
|
| Cookie host: file path, relative to |
|
| Cookie host: local cache file (mode 0600) |
|
| Cookie host: cache lifetime, seconds |
|
| Cookie host: ssh connect timeout, seconds |
Choosing the auth mode. If MATTERMOST_AUTH_MODE is unset, the first
credential source that has any credential decides. The sources are checked
in order: env, then cookie host, then the saved login session, then
keychain. MATTERMOST_ACCESS_TOKEN in
that source means token mode. MATTERMOST_TOKEN alone means cookie mode. A
lower-priority source never overrides a higher one.
Sign in with your browser
No personal access tokens on your server? Sign in once the way you always do (password, SSO, MFA), and the server uses your session:
uvx mattermost-mcp-server login --url https://mattermost.example.comA browser window opens at your server's login page and closes by itself as
soon as you are signed in. Any installed Chrome, Chromium, Edge or Brave
works; set MATTERMOST_BROWSER to use a specific one. The session cookies
are checked against the server and saved to
~/.config/mattermost-mcp/session.env (mode 0600). From then on the server
needs no credentials in its configuration at all:
claude mcp add mattermost -- uvx mattermost-mcp-serverOther ways to sign in:
mattermost-mcp-server login --password # username/email + password (+ MFA code); the password is not stored
mattermost-mcp-server login --from-firefox # reuse the session of a Firefox where you are signed in
mattermost-mcp-server status # which server, user and credential source is in use
mattermost-mcp-server logout # revoke and delete the saved session (--forget-browser: also the browser profile)When the session expires. Sessions expire after the time your admin
configured. Run login again; running servers pick the new session up on
their next call, without a restart. With MATTERMOST_AUTO_LOGIN=1 in the
server's env, the server opens the sign-in window itself when it gets a
401. The browser profile remembers your identity provider, so with SSO this
often completes without typing anything. Several running servers share one
window.
The sign-in browser uses its own profile in
~/.config/mattermost-mcp/browser-profile, separate from your everyday
browser. On macOS and Linux the server talks to it over a private pipe, not
a network port.
Cookie auth
To use session cookies directly, without login: log in to Mattermost in a
browser, open DevTools → Application → Cookies, and copy MMAUTHTOKEN,
MMCSRF and (optionally) MMUSERID into MATTERMOST_TOKEN,
MATTERMOST_CSRF and MATTERMOST_USER_ID. This is also the way to go when a
reverse proxy strips the Authorization header.
Session cookies expire. When they do, tool calls fail with a 401 error. Put
fresh cookies wherever the server reads them from, then restart it, because
env is read only once. If something rotates cookies for you, describe it in
MATTERMOST_AUTH_HELP so the agent knows what to do.
Credential sources
The server resolves each field separately. The first source that has a value wins:
Environment variables, as above.
Cookie host (off by default). A plain
KEY=VALUEfile with the same variable names, kept on another machine and read over ssh. Use this when one machine rotates the credential and others just consume it. The result is cached locally. On a 401 the server pulls the file again and retries once. ssh runs withBatchMode=yes, so a locked key fails fast instead of hanging the MCP handshake, and the reason goes to stderr. The file may only supplyMATTERMOST_URL,MATTERMOST_ACCESS_TOKEN,MATTERMOST_TOKEN,MATTERMOST_CSRFandMATTERMOST_USER_ID. Nothing else is read from it, not even the auth or write mode.Saved session from
mattermost-mcp-server login. It is used only as a whole (URL, cookies and CSRF together), only in cookie mode, and only when it belongs to the same server as anyMATTERMOST_URLyou set.OS keychain: accounts
url,access_token,token,csrfanduser_idunder the serviceMATTERMOST_KEYCHAIN_SERVICE.# macOS security add-generic-password -s mattermost-mcp -a url -w https://mattermost.example.com security add-generic-password -s mattermost-mcp -a access_token -w <personal access token> # Linux (pass) pass insert mattermost-mcp/url pass insert mattermost-mcp/access_token
Troubleshooting
Mattermost rejected the access token (401): the token was revoked or mistyped. Create a new one, or check whether your account is still allowed to use personal access tokens.Mattermost rejected the session cookies (401): the browser session expired. Runmattermost-mcp-server loginagain (or setMATTERMOST_AUTO_LOGIN=1). If you set the cookies by hand, copy fresh ones and restart the server.No Chromium-family browser found: install Chrome, Chromium, Edge or Brave, pointMATTERMOST_BROWSERat one, or uselogin --passwordorlogin --from-firefox.Write tools in cookie mode need the MMCSRF cookie: setMATTERMOST_CSRF. Mattermost requires it for any change made with cookie auth.write mode is disabled: setMATTERMOST_ENABLE_WRITE=1and restart the client.Requests time out behind a corporate proxy: the server honours
HTTPS_PROXY/ALL_PROXY, including SOCKS. If that proxy should not be used for Mattermost, setMATTERMOST_TRUST_ENV=0.Nothing happens in Claude Desktop: GUI apps do not inherit your shell
PATH. Use the full path touvx(which uvx) ascommand.
Development
git clone https://github.com/toffguy77/mattermost-mcp.git
cd mattermost-mcp
uv sync
uv run pytest
uv run ruff checkRun your local checkout from a client with
uv run --project /path/to/mattermost-mcp mattermost-mcp.
python -m mattermost_mcp works too. The tests never touch the network or
ssh: HTTP is mocked with respx. See CONTRIBUTING.md,
CHANGELOG.md and SECURITY.md.
License
MIT
Available Tools
15 toolsget_channelGet ChannelARead-onlyIdempotent
Look up a channel by ID, or by its name (the URL slug, e.g. "town-square").
Pass channel_id, or name. With name alone, searches the channels you are a member of; add team_id or team_name to look up any channel in a team.
Returns {id, name, display_name, type, team_id, header, purpose}.
Inputs: name, team_id, team_name, channel_id. Returns: object
get_channel_postsGet Channel PostsARead-onlyIdempotent
Get recent posts from a Mattermost channel, newest first.
Inputs: channel_id (required), limit, since, before. Returns: result
get_direct_messagesGet Direct MessagesARead-onlyIdempotent
Get direct message history with a specific user, newest first.
Inputs: username (required), limit, since, before. Returns: result
get_file_infoGet File InfoARead-onlyIdempotent
Get metadata of a file attached to a post (see a post's file_ids).
The file content is not downloaded.
Inputs: file_id (required). Returns: object
get_meGet MeARead-onlyIdempotent
Get the authenticated user and what this server is allowed to do.
Returns {id, username, first_name, last_name, email, status, nickname, position, auth_mode, write_enabled}. auth_mode is "token" or "cookie"; write_enabled tells whether posting/editing tools are available.
Inputs: no named parameters. Returns: object
get_mentionsGet MentionsARead-onlyIdempotent
Get posts that mention the authenticated user, newest first.
Mentions in muted channels are included by default — mute hides unread badges, not @-mentions. Pass include_muted=False to exclude them.
Inputs: limit, since, include_muted. Returns: result
get_pinned_postsGet Pinned PostsCRead-onlyIdempotent
Get the posts pinned in a channel.
Inputs: channel_id (required). Returns: result
get_postGet PostBRead-onlyIdempotent
Get a single post by ID.
Inputs: post_id (required). Returns: object
get_threadGet ThreadBRead-onlyIdempotent
Get a post and all its replies.
Inputs: post_id (required). Returns: object
get_unreadGet UnreadARead-onlyIdempotent
Get unread counts and mention badges per channel.
By default skips channels muted in the sidebar (same behavior as the client unread badge). Pass include_muted=True to see every unread.
Inputs: category, include_muted. Returns: result
get_userGet UserARead-onlyIdempotent
Get a Mattermost user's profile by username.
Inputs: username (required). Returns: object
list_channelsList ChannelsBRead-onlyIdempotent
List all Mattermost channels the authenticated user is a member of.
Inputs: team_id, category, include_dm, include_muted. Returns: result
list_teamsList TeamsARead-onlyIdempotent
List the teams the authenticated user belongs to.
Returns list of {id, name, display_name}.
Inputs: no named parameters. Returns: result
search_postsSearch PostsARead-onlyIdempotent
Full-text search across Mattermost posts, newest first.
Supports Mattermost search syntax (from:username, in:channel-name, before:/after:/on:YYYY-MM-DD, "exact phrase", -excluded). By default skips channels the user has muted in the sidebar — pass include_muted=True to widen the search.
Inputs: query (required), limit, category, channel_id, +1 more. Returns: result
search_usersSearch UsersARead-onlyIdempotent
Find users by username, full name, nickname or email prefix.
Inputs: term (required), limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a distinct resource and retrieval path: single post (get_post), thread with replies (get_thread), channel history (get_channel_posts), DMs (get_direct_messages), mentions (get_mentions), and search (search_posts) are all clearly differentiated. Channel, user, and team lookups are similarly well-separated, leaving an agent little room for misselection.
Consistent snake_case with predictable verb_noun patterns: get_*, list_*, and search_* throughout. The only quirk, get_me, is an idiomatic convenience that still reads as a getter and doesn't break the pattern.
Fifteen tools is a natural fit for a chat workspace, spanning channels, users, teams, posts, search, and files. Every tool has a clear place and none look like filler.
Read coverage is thorough (posts, threads, channels, users, teams, files, search), but the surface is entirely read-only: there is no send_post, edit_post, delete_post, or channel-management operation. This is a notable gap for a messaging client, and get_me's write_enabled flag implies posting/editing tools are expected to exist.
Maintenance
Related MCP Connectors
Let AI agents use any website you're logged in to. Sessions stay encrypted on your machine.
Catch up on Slack without reading it. Unreads, threads, search. Browser-session or hosted OAuth.
Web search, data extraction and controlled browser automation for AI assistants via OAuth.
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceThis server enables interaction with Mattermost workspaces to manage channels, messages, threads, and user profiles via the Mattermost REST API. It provides a comprehensive suite of tools for reading channel history, posting messages, and managing reactions within a trusted environment.-
- FlicenseNot gradedqualityNot gradedmaintenanceEnables interaction with Mattermost workspaces to manage channels, messages, threads, reactions, and user profiles via the REST API. This server allows AI models to perform both read and write operations, such as posting messages and retrieving channel history, within a trusted environment.-
- AlicenseAqualityAmaintenanceLets AI assistants read, search, and post messages in Mattermost channels, manage threads, reactions, files, and users with 38 tools.391,535 PyPI54MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Mattermost workspaces for messaging, channel management, user operations, and file handling via the Model Context Protocol.MIT