Mattermost MCP Server
You can interact with a Mattermost workspace through MCP tools for channels, messages, users, and monitoring.
List public, private, and DM channels with pagination.
Retrieve channel message history with date and cursor filtering.
Post new messages to channels.
Reply to specific message threads.
Add emoji reactions to messages.
Get all replies in a thread.
List users and get detailed user profiles.
Trigger topic monitoring manually.
Authenticate via personal access token or browser sign-in (no token required).
Provides tools for interacting with Mattermost workspaces, including channel management, posting messages, replying to threads, adding reactions, retrieving channel history and thread replies, user management, and topic monitoring.
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 Server Get the latest 20 messages from the town-square channel."
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 Server
MCP Server for the Mattermost API, enabling Claude and other MCP clients to interact with Mattermost workspaces.
Quick Start
Using npx (recommended)
npx @conarti/mattermost-mcp --helpUsing environment variables
MATTERMOST_URL=https://your-mattermost.com/api/v4 \
MATTERMOST_TOKEN=your-token \
MATTERMOST_TEAM_ID=your-team-id \
npx @conarti/mattermost-mcpUsing CLI arguments
npx @conarti/mattermost-mcp \
--url https://your-mattermost.com/api/v4 \
--token your-token \
--team-id your-team-idRelated MCP server: Mattermost MCP Server
Installation
Option 1: npx (no installation needed)
npx @conarti/mattermost-mcpOption 2: Global installation
npm install -g @conarti/mattermost-mcp
mattermost-mcp --helpOption 3: Clone and build
git clone https://github.com/conarti/mattermost-mcp.git
cd mattermost-mcp
npm install
npm run build
npm startBrowser sign-in (no token)
MATTERMOST_TOKEN is optional. Without a token the server signs in to Mattermost through a visible Chromium window and keeps the session token for you. With MATTERMOST_TOKEN set, the server works as before (static mode): no browser window, no Chromium download, and ~/.config/mattermost-mcp is not created.
First sign-in
Configure the server with
MATTERMOST_URLandMATTERMOST_TEAM_IDonly, without a token (see Claude Code Integration and opencode below).Call any Mattermost tool. The server opens a Chromium window with the Mattermost login page.
Sign in the way you usually do (password, SSO, MFA). You have up to 5 minutes.
The window closes by itself as soon as the session is valid, and the tool call returns its result.
While the call waits, the server sends progress notifications every 10 seconds, so clients that show MCP progress display the current step. The window opens only from a tool call: never at server startup and never from background monitoring.
Chromium is downloaded automatically
No manual installation is needed.
On the first sign-in the server downloads Chromium and ffmpeg for Playwright 1.63.0 (about 183 MiB on macOS arm64) into
~/.config/mattermost-mcp/browsers. The client shows the progress asDownloading Chromium for Mattermost sign-in: 40% of 182.1 MiB, and for the small ffmpeg archive that follows asDownloading Chromium for Mattermost sign-in: FFmpeg 50% of 1 MiB.The first call takes longer: the download is limited to 10 minutes, and the 5 minutes for sign-in start after the download has finished.
After an update of this package to a version with another Playwright version, the matching Chromium build is downloaded the same way.
Behind a proxy or with a download mirror, set
HTTPS_PROXY,HTTP_PROXY,NO_PROXY,PLAYWRIGHT_DOWNLOAD_HOSTorPLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUTin theenvof the MCP server entry.The shared Playwright cache (
~/Library/Caches/ms-playwrighton macOS) is not used: Playwright installations in other projects remove builds that no project references.If the download fails, the error contains the reason and a manual command as a fallback, see Browser sign-in problems.
On Linux without the system libraries for Chromium, a one-time
install-depscommand is needed, see Browser sign-in problems.Keep this package up to date: each release pins a Playwright version, and newer versions bring Chromium builds with security fixes.
Keep
PLAYWRIGHT_DOWNLOAD_HOSTonhttps://and do not disable TLS certificate checks for the download (for example withNODE_TLS_REJECT_UNAUTHORIZED=0): the downloaded Chromium later holds your Mattermost session.
What is stored where
Everything lives in ~/.config/mattermost-mcp/ (permissions 0700):
browsers/: Chromium builds for the sign-in window.profile/: the Chromium profile with the Mattermost session. It is as sensitive as the token because cookies in it are not encrypted. Exclude it from dotfiles sync and backups.token: the session token (permissions 0600), bound to the server address.login.lockandlogin.lock.break: short-lived lock files that let several server processes share one sign-in window.tmp/: temporary files of the Chromium download, removed after the installation.
The server refuses to use the directory if ~/.config or your home directory belongs to another user or is writable by group or others without the sticky bit, see [STATE_DIRECTORY_UNSAFE] in Browser sign-in problems.
Security of the sign-in window
The Chromium window runs with the Chromium sandbox enabled, because it renders Mattermost content written by other users. Set
MATTERMOST_MCP_DISABLE_CHROMIUM_SANDBOX=1in theenvof the MCP server entry only if the sandbox is unavailable on your system ([BROWSER_SANDBOX_UNAVAILABLE]). The server then logs a warning each time it opens the window.Use an
https://address inMATTERMOST_URL. Withhttp://and a host other thanlocalhost,127.0.0.1or[::1], the server logs a warning at startup: the password typed into the sign-in window and the session token are sent without encryption.
Resetting the session
Remove only the session (the next tool call opens the sign-in window again):
rm -rf ~/.config/mattermost-mcp/profile ~/.config/mattermost-mcp/tokenRemove everything, including Chromium (it is downloaded again on the next sign-in):
rm -rf ~/.config/mattermost-mcpBoth commands are safe while the sign-in window is open.
Several clients
Claude Code, opencode and other clients on the same machine share one token file and one sign-in window. If several clients need sign-in at the same time, only one window opens, and all waiting calls continue after you sign in.
Background topic monitoring never opens the window. When the server starts without a saved session:
If
monitoring.userIdormonitoring.notificationChannelIdis not set, the monitor cannot look them up, and its schedule does not start. Callmattermost_run_monitoring: it signs in if needed, starts the schedule and runs monitoring once. Signing in through another tool does not start the schedule, so callmattermost_run_monitoringafterwards or restart the server.If both are set, the schedule starts right away, and runs before the first sign-in are skipped with
[AUTHENTICATION_REQUIRED]in the logs.
opencode
Example of an opencode entry without a token:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mattermost": {
"type": "local",
"command": ["npx", "-y", "@conarti/mattermost-mcp@latest"],
"environment": {
"MATTERMOST_URL": "https://your-mattermost.com/api/v4",
"MATTERMOST_TEAM_ID": "your-team-id"
},
"timeout": 360000
}
},
"experimental": {
"mcp_timeout": 360000
}
}Client timeouts
The first tool call can take several minutes: the Chromium download and then up to 5 minutes of sign-in. Progress notifications every 10 seconds keep the call alive in clients that pass a progressToken and reset their timeout on progress.
opencode: set
mcp.mattermost.timeoutandexperimental.mcp_timeoutto360000(6 minutes) as in the example above. Some opencode versions apply a hard request timeout that progress notifications do not extend.A client that does not pass a
progressTokencan cancel the first call during the Chromium download. The download then stops and starts from the beginning on the next call. Raise the client timeout, or run the manual installation command from Browser sign-in problems once.
Limitations
One Mattermost server per operating system user. A token file of another server is ignored. The addresses are normalized before the comparison, so
/api/v4, a trailing slash and the letter case of the host do not matter.If clients with different
MATTERMOST_URLvalues sign in at the same time, the waiting call getsLOGIN_NOT_COMPLETED, and the window for the second server opens only when you call the tool again. Its token replaces the token of the first server, and the first server opens the window again on its next call.Do not enable
DEBUG=pw:*for the server: Playwright debug output prints cookies.Windows is not supported.
Configuration
The server supports multiple configuration methods with the following priority (highest to lowest):
CLI arguments (
--url,--token,--team-id)Environment variables (
MATTERMOST_URL,MATTERMOST_TOKEN,MATTERMOST_TEAM_ID)config.local.json (for local overrides, gitignored)
config.json (default configuration)
CLI Arguments
Argument | Description |
| Mattermost API URL (e.g., https://mattermost.example.com/api/v4) |
| Mattermost personal access token |
| Mattermost team ID |
| Run topic monitoring immediately on startup |
| Exit after running monitoring (use with --run-monitoring) |
| Show help message |
Environment Variables
Variable | Description |
| Mattermost API URL |
| Mattermost personal access token (optional: without it the server uses browser sign-in) |
| Mattermost team ID |
| Proxy for the automatic Chromium download in browser sign-in |
| Mirror and connection timeout for the automatic Chromium download |
Configuration File
Create config.local.json (gitignored) or use config.json:
{
"mattermostUrl": "https://your-mattermost-instance.com/api/v4",
"token": "your-personal-access-token",
"teamId": "your-team-id",
"monitoring": {
"enabled": false,
"schedule": "*/15 * * * *",
"channels": ["town-square", "off-topic"],
"topics": ["tv series", "champions league"],
"messageLimit": 50
}
}Claude Code Integration
Add to your Claude Code MCP settings (~/.claude/claude_desktop_config.json or via claude mcp add):
{
"mcpServers": {
"mattermost": {
"command": "npx",
"args": ["-y", "@conarti/mattermost-mcp@latest"],
"env": {
"MATTERMOST_URL": "https://your-mattermost.com/api/v4",
"MATTERMOST_TOKEN": "your-token",
"MATTERMOST_TEAM_ID": "your-team-id"
}
}
}
}Or using a config file:
{
"mcpServers": {
"mattermost": {
"command": "node",
"args": ["/path/to/mattermost-mcp/build/index.js"]
}
}
}Or without a token, with browser sign-in:
{
"mcpServers": {
"mattermost": {
"command": "npx",
"args": ["-y", "@conarti/mattermost-mcp@latest"],
"env": {
"MATTERMOST_URL": "https://your-mattermost.com/api/v4",
"MATTERMOST_TEAM_ID": "your-team-id"
}
}
}
}The first tool call opens the sign-in window and, on the first sign-in, downloads Chromium.
Features
Channel Tools
Tool | Description |
| List channels in the workspace (public, private, and DMs) |
| Get messages from a channel with filtering options |
mattermost_list_channels Options
limit(default: 100): Maximum number of channels to returnpage(default: 0): Page number for paginationinclude_private(default: false): If true, returns all channels including private channels and direct messages (DMs)
mattermost_get_channel_history Options
channel_id(required): The ID of the channellimit: Number of messages to retrieve. If not specified or 0, returns ALL messagespage(default: 0): Page number for pagination (only used when limit > 0)since_date: ISO 8601 date to get messages after (e.g., "2025-01-15")before_date: ISO 8601 date to get messages before. Use withsince_datefor date rangesbefore_post_id: Get messages before this post ID (cursor pagination)after_post_id: Get messages after this post ID (cursor pagination)
Examples:
// Get ALL messages from a channel
{ "channel_id": "abc123" }
// Get last 50 messages
{ "channel_id": "abc123", "limit": 50 }
// Get all messages from December 18, 2025
{ "channel_id": "abc123", "since_date": "2025-12-18", "before_date": "2025-12-19" }
// Get messages from a specific date onwards
{ "channel_id": "abc123", "since_date": "2025-12-15" }Message Tools
Tool | Description |
| Post a new message to a channel |
| Reply to a specific message thread |
| Add an emoji reaction to a message |
| Get all replies in a thread |
| Get a single message by ID (text, author, channel, creation and edit time, thread root, attachments) |
| Replace the text of an existing message and return |
Posts with attachments in mattermost_get_channel_history and mattermost_get_thread_replies (including root_post) include file_ids and files (id, name, extension, size, mime_type, and width/height for images). Posts without attachments have neither field.
mattermost_edit_post takes post_id and message. Mattermost marks an edited post as "Edited" for everyone in the channel. Only the post author or a user with permission to edit others' posts can edit it: a 403 returns the server text with that hint, and other errors (for example 400 when the edit time limit has passed) return the server text as is. Both tools reject a post_id that is not a 26-character Mattermost id before sending any request.
File Tools
Tool | Description |
| Get metadata of an attached file (name, extension, size, MIME type, image size, post ID) |
| Download an attached file to the local disk and return its absolute path and metadata |
mattermost_download_file Options
file_id(required): The ID of the file, fromfile_idsorfilesof a postoutput_path: Where to save the fileNot set: the system temporary directory, as
mattermost-mcp/{file_id}_{name}An existing directory, or a path ending with
/or\: the file is saved inside it with its original name, missing directories are createdAny other path: the file path, missing parent directories are created
A leading
~expands to your home directory (~useris not expanded), relative paths are resolved from the server working directoryAn existing file at the target path is overwritten
inline(default: false): Also return the image as MCP image content. Onlyimage/png,image/jpeg,image/gifandimage/webpup to 1 MB are returned inline; otherwise the response hasinline_skipped_reason
Examples:
Save to the temporary directory:
{ "file_id": "abcdefghijklmnopqrstuvwxyz" }Save into
~/Downloadsand show a small image inline:{ "file_id": "abcdefghijklmnopqrstuvwxyz", "output_path": "~/Downloads/", "inline": true }
User Tools
Tool | Description |
| Get a list of users in the workspace |
| Get detailed profile information for a user |
Monitoring Tools
Tool | Description |
| Trigger topic monitoring immediately |
Topic Monitoring
The server includes a topic monitoring system that can:
Monitor specified channels for messages containing topics of interest
Run on a configurable schedule (using cron syntax)
Send notifications when relevant topics are discussed
Configuration
{
"monitoring": {
"enabled": true,
"schedule": "*/15 * * * *",
"channels": ["general", "random"],
"topics": ["important", "urgent"],
"messageLimit": 50,
"notificationChannelId": "optional-channel-id",
"userId": "optional-user-id"
}
}Running Monitoring Manually
# Run monitoring and continue server
mattermost-mcp --run-monitoring
# Run monitoring and exit (useful for cron jobs)
mattermost-mcp --run-monitoring --exit-after-monitoringGetting Your Credentials
Mattermost URL
Your Mattermost API URL is typically: https://your-mattermost-domain.com/api/v4
Personal Access Token
Go to Account Settings > Security > Personal Access Tokens
Click Create Token
Give it a description and create
Copy the token (it won't be shown again)
Team ID
Go to your team in Mattermost
Open browser developer tools (F12)
Go to Network tab
Refresh the page
Look for API calls containing
teams/— the ID is in the URL
Or use the Mattermost API:
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-mattermost.com/api/v4/teamsTroubleshooting
Missing Configuration Error
Missing required configuration:
- mattermostUrl (--url or MATTERMOST_URL)
- teamId (--team-id or MATTERMOST_TEAM_ID)Make sure you've provided the Mattermost URL and team ID via CLI arguments, environment variables, or config file. The token is not required: without it the server uses browser sign-in.
Permission Errors
Verify that:
The Mattermost user has the necessary permissions: the owner of the personal access token, or the user you signed in as in the browser window
With a token, the token is correctly set
The Mattermost URL and team ID are correct
To sign in as another user in browser sign-in, reset the session and call a tool again.
Browser sign-in problems
Error messages start with a code in brackets.
[BROWSER_INSTALLATION_FAILED]: the automatic Chromium download failed. The error contains the reason, for example a proxy or network error. Fix the reason and call the tool again. As a fallback, install Chromium manually once:
PLAYWRIGHT_BROWSERS_PATH=~/.config/mattermost-mcp/browsers npx playwright@1.63.0 install chromium --no-shellWhen you run this command manually, a framed WARNING: It looks like you are running 'npx playwright install' without first installing your project's dependencies is expected and can be ignored.
If the error mentions an active __dirlock, another Chromium installation is still running, for example started by another client: wait for it and call the tool again. If no installation is running, the file stayed after a crash, and you can remove it with the command from the error text.
[BROWSER_SYSTEM_DEPENDENCIES_MISSING] (Linux): Chromium was downloaded but cannot start without system libraries. Install them once:
sudo npx playwright@1.63.0 install-deps chromium[BROWSER_SANDBOX_UNAVAILABLE] (Linux): Chromium cannot start its sandbox, for example because unprivileged user namespaces are disabled or the server runs in a container without them. Enable the sandbox for your user if you can. Only if that is not possible, set MATTERMOST_MCP_DISABLE_CHROMIUM_SANDBOX=1 in the env of the MCP server entry and call the tool again.
[LOGIN_WINDOW_CLOSED], [LOGIN_TIMEOUT], [LOGIN_NOT_COMPLETED]: the window was closed, sign-in took longer than 5 minutes, or sign-in in another client ended without a session. Call the tool again to open the window.
[LOGIN_PROFILE_BUSY]: another Chromium window uses the sign-in profile. Close the other Mattermost sign-in window and call the tool again.
[AUTHENTICATION_REQUIRED] in monitoring logs: background monitoring does not open the sign-in window. Call any Mattermost tool to sign in.
[STATE_DIRECTORY_UNSAFE]: ~/.config/mattermost-mcp or one of its subdirectories is a symbolic link, is not a directory or belongs to another user, or ~/.config or your home directory belongs to another user or is writable by group or others. Fix it as the error text says (for example chmod go-w ~/.config) and call the tool again.
[REQUEST_CANCELLED]: the client cancelled the call, for example by its timeout, while the sign-in window was open. The request was not sent, so nothing was posted twice. Sign-in continues in the window, call the tool again after signing in.
License
MIT License
Available Tools
13 toolsmattermost_add_reactionB
Add a reaction emoji to a message
Inputs: post_id (required), channel_id (required), emoji_name (required).
mattermost_download_fileA
Download a file attached to a Mattermost post to the local disk and return its absolute path and metadata. Without output_path the file is saved to the system temporary directory as mattermost-mcp/{file_id}_{name}. An existing file at the target path is overwritten. With inline=true a PNG, JPEG, GIF or WebP image up to 1 MB is also returned as image content; for other types or larger files the response explains why inline was skipped.
Inputs: file_id (required), inline, output_path.
mattermost_edit_postA
Edit the text of an existing message. Mattermost marks an edited post as "Edited" for everyone in the channel. Only the post author or a user with permission to edit others' posts can edit it.
Inputs: message (required), post_id (required).
mattermost_get_channel_historyA
Get messages from a Mattermost channel. By default returns ALL messages. Use limit parameter to restrict the number of messages.
Inputs: channel_id (required), page, limit, since_date, +3 more.
mattermost_get_file_infoA
Get metadata of a file attached to a Mattermost post: name, extension, size, MIME type, image width and height, post ID. File IDs come from file_ids and files in channel history and thread replies.
Inputs: file_id (required).
mattermost_get_postB
Get a single message by its ID, including edit time and attachments
Inputs: post_id (required).
mattermost_get_thread_repliesA
Get all replies in a message thread
Inputs: post_id (required), channel_id (required).
mattermost_get_user_profileB
Get detailed profile information for a specific user
Inputs: user_id (required).
mattermost_get_usersB
Get a list of users in the Mattermost workspace with pagination
Inputs: page, limit.
mattermost_list_channelsA
List channels in the Mattermost workspace. By default lists public team channels. Set include_private=true to get all channels including private channels and direct messages (DMs).
Inputs: page, limit, include_private.
mattermost_post_messageC
Post a new message to a Mattermost channel
Inputs: message (required), channel_id (required).
mattermost_reply_to_threadB
Reply to a specific message thread in Mattermost
Inputs: message (required), post_id (required), channel_id (required).
mattermost_run_monitoringC
Run the topic monitoring process immediately
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Tools target distinct resources and actions: channels, messages, threads, reactions, users, and files. The only odd one is mattermost_run_monitoring, which is unclear in domain and could be confused for a generic system task, but otherwise boundaries are clear.
All tools use the mattermost_ prefix and snake_case verb_noun naming (get_post, edit_post, list_channels). Minor variation exists (reply_to_thread, run_monitoring), but the pattern is highly predictable.
13 tools cover the main Mattermost interaction areas without excessive duplication. Each tool has a clear role, and the count sits comfortably in the well-scoped 3–15 range.
Core messaging lifecycle is partially covered: create, read, update (edit) exist, but no delete_post or remove_reaction, and file upload/channel management are absent. Notable gaps may force workarounds for common chat operations.
Maintenance
Related MCP Connectors
MCP server for Sendbird — chat users, channels, members, and messages from your AI client.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Hosted Slack MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- -licenseNot gradedqualityBmaintenanceMCP Server for the Slack API, enabling Claude to interact with Slack workspaces.70,822 npm91,952MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables Claude and other MCP clients to interact with Mattermost workspaces, providing channel management, messaging capabilities, and topic monitoring functionality.40 npm44MIT
- -licenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol server that enables Claude to interact with Mattermost instances, supporting post management, channel operations, user management, and reaction management.10 npm1-
- AlicenseAqualityDmaintenanceMCP server for Mattermost that enables AI assistants to read posts, search messages, send messages, and manage channels.9MIT