Service online

Bring Mattermost into your coding agent.

Use Codex, Claude Code, or Cursor to search conversations, read channels, and collaborate in Mattermost. Every request runs with your own Mattermost identity and permissions.

Connect with Mattermost OAuth

OAuth is enabled. Your MCP client opens Mattermost for login and consent; you do not need to create, copy, or store a personal access token.

Codex

Add the server once, then start the browser-based login:

codex mcp add mattermost --url https://mattermost-mcp.abaqus.cl/mcp
codex mcp login mattermost

Other OAuth-capable clients

Add the endpoint below without an Authorization header. The client discovers the OAuth endpoints automatically and opens Mattermost when login is required.

https://mattermost-mcp.abaqus.cl/mcp
The MCP and Mattermost credentials stay separate.

The MCP stores Mattermost OAuth credentials encrypted on the server and gives your client a short-lived token that works only with this MCP.

Connect in three steps

OAuth is recommended when your client supports it. PAT authentication remains available as a migration fallback; if you use it, your Mattermost personal access token stays in your operating system's credential store and is sent to this MCP only over HTTPS.

1

Create your PAT

In Mattermost, open your profile picture → Profile (or User Settings in older versions) → Security → Personal Access Tokens → Create Token. Name it for this MCP and copy it when shown.

Open the Mattermost PAT instructions ↗
2

Store it securely

Use the recommended operating-system setup below, or another trusted secret-management method that keeps the PAT out of configuration files and shell history.

See the recommended security options ↓
You are responsible for protecting your PAT.

Keep its value out of MCP configuration, source control, shell profiles, shell history, tickets, and chat. Limit it to the intended client and revoke it immediately if it is exposed. The credential stores and launcher functions below are recommendations; another secure method is equally valid.

Store your token safely

The credential-store and launcher examples below are recommended, not required. Use them if they fit your workflow, or use another approach you trust. Whatever method you choose, keep the PAT out of configuration files and shell history, make MATTERMOST_PAT available only to the intended client, and revoke the token if it is exposed.

Ubuntu Linux · GNOME Keyring

Install secret-tool, then store the PAT in the logged-in user's Secret Service collection.

sudo apt install libsecret-tools
secret-tool store \
  --label='Mattermost MCP PAT' \
  service mattermost-mcp \
  account "$USER"

Recommended launcher: add this function once to ~/.bashrc or ~/.zshrc. It keeps the usual client commands while loading the PAT automatically:

_mattermost_mcp_launch() {
  local client="$1"
  shift
  local token
  token="$(secret-tool lookup service mattermost-mcp account "$USER")"
  if [ -z "$token" ]; then
    echo 'Mattermost MCP PAT was not found.' >&2
    return 1
  fi
  MATTERMOST_PAT="$token" command "$client" "$@"
}

codex()  { _mattermost_mcp_launch codex "$@"; }
claude() { _mattermost_mcp_launch claude "$@"; }
cursor() { _mattermost_mcp_launch cursor "$@"; }

If you choose this launcher, reload the profile once, then type codex, claude, or cursor normally:

source ~/.bashrc  # Use source ~/.zshrc if you use zsh.
macOS · Login Keychain

Store the PAT in your login Keychain. Because -w has no value after it, macOS asks for the token interactively and it never enters your shell history:

security add-generic-password -a "$USER" -s mattermost-mcp -w

Recommended launcher: add this function once to ~/.zshrc. It contains no secret and keeps the usual client commands while loading the PAT automatically:

_mattermost_mcp_launch() {
  local client="$1"
  shift
  local token
  token="$(security find-generic-password \
    -a "$USER" -s mattermost-mcp -w)" || return 1
  MATTERMOST_PAT="$token" command "$client" "$@"
}

codex()  { _mattermost_mcp_launch codex "$@"; }
claude() { _mattermost_mcp_launch claude "$@"; }
cursor() { _mattermost_mcp_launch cursor "$@"; }

If you choose this launcher, reload the profile once, then type codex, claude, or cursor normally:

source ~/.zshrc

Do not add a PAT value or export MATTERMOST_PAT=... to ~/.zshrc. Fully quit an already-running GUI client before starting it through the launcher.

Windows · PowerShell SecretStore

Install Microsoft's SecretManagement modules for your user, register the vault once, and let Set-Secret prompt securely.

Install-Module Microsoft.PowerShell.SecretManagement `
  -Repository PSGallery -Scope CurrentUser
Install-Module Microsoft.PowerShell.SecretStore `
  -Repository PSGallery -Scope CurrentUser
Register-SecretVault -Name MattermostMcp `
  -ModuleName Microsoft.PowerShell.SecretStore
Set-Secret -Name MattermostPat -Vault MattermostMcp

Recommended launcher: add these functions once to your PowerShell profile (notepad $PROFILE). They contain no secret and keep the usual client commands:

function Invoke-MattermostMcpClient {
  param(
    [Parameter(Mandatory = $true)][string] $Name,
    [object[]] $ClientArgs
  )

  $client = Get-Command $Name -CommandType Application,ExternalScript |
    Select-Object -First 1
  if (-not $client) { throw "Client '$Name' was not found." }

  $env:MATTERMOST_PAT = Get-Secret -Name MattermostPat -Vault MattermostMcp -AsPlainText
  try { & $client.Source @ClientArgs }
  finally {
    Remove-Item Env:MATTERMOST_PAT -ErrorAction SilentlyContinue
  }
}

function codex  { Invoke-MattermostMcpClient -Name 'codex'  -ClientArgs $args }
function claude { Invoke-MattermostMcpClient -Name 'claude' -ClientArgs $args }
function cursor { Invoke-MattermostMcpClient -Name 'cursor' -ClientArgs $args }

If you choose this launcher, reload the profile once, then type codex, claude, or cursor normally:

. $PROFILE

Configure your client

Choose any one of the clients below. Each configuration references MATTERMOST_PAT by name and must never contain the PAT value. Supply that variable with the recommended launcher above or another secure method appropriate for your environment.

Codex

Add this to ~/.codex/config.toml:

[mcp_servers.mattermost]
url = "https://mattermost-mcp.abaqus.cl/mcp"
bearer_token_env_var = "MATTERMOST_PAT"
default_tools_approval_mode = "writes"

[shell_environment_policy]
exclude = ["MATTERMOST_PAT"]

If you already have a [shell_environment_policy] table, add MATTERMOST_PAT to its existing exclude list instead of creating a second table. This keeps model-run shell commands from inheriting the PAT.

Start Codex using the secure method you chose. If you installed the recommended launcher, run codex normally. Use /mcp to verify the connection.

Claude Code

Register the remote server. Keep the header in single quotes so Claude stores the literal variable reference instead of your secret:

claude mcp add --transport http --scope user mattermost "https://mattermost-mcp.abaqus.cl/mcp" \
  --header 'Authorization: Bearer ${MATTERMOST_PAT}'

Start Claude Code using the secure method you chose. If you installed the recommended launcher, run claude normally. Use /mcp to verify the connection.

--scope user (recommended): keeps this personal setup in ~/.claude.json and makes it available across your projects.

--scope project: writes a shareable .mcp.json. Commit only the ${MATTERMOST_PAT} placeholder; every teammate must create and load their own PAT.

Cursor

Add this to the global ~/.cursor/mcp.json. Launch Cursor from the environment where MATTERMOST_PAT is loaded:

{
  "mcpServers": {
    "mattermost": {
      "url": "https://mattermost-mcp.abaqus.cl/mcp",
      "headers": {
        "Authorization": "Bearer ${env:MATTERMOST_PAT}"
      }
    }
  }
}

Fully quit Cursor and restart it using the secure method you chose. If you installed the recommended launcher, run cursor normally. Open Settings → Cursor Settings → MCP & Integrations, enable mattermost, and verify that its tools are listed.

Verify and troubleshoot

A successful connection should report your own Mattermost identity. If the PAT option is missing, stop and ask your Mattermost administrator to enable it for your account.

Connection checklist

Codex or Claude Code: restart the client using your chosen secure PAT method, then open /mcp. For Claude Code, these commands also show the saved entry:

claude mcp list
claude mcp get mattermost

Cursor: fully quit and relaunch it using your chosen secure PAT method, then open Settings → Cursor Settings → MCP & Integrations.

If you receive HTTP 401

Mattermost rejected the PAT. Confirm that the token was copied completely, remains active, and belongs to your account. If Claude has an old hardcoded or expired entry, remove only that entry and run the setup command again:

claude mcp remove mattermost

Never fix a 401 by borrowing another person's PAT.

Your first safe check

Ask the client to identify your Mattermost user and read a known channel before approving a write. Stop if the reported identity is not yours.

Use the Mattermost MCP to identify the authenticated user.
Then list the latest posts in a channel I name.
Do not write, react, or modify anything yet.

When you later approve a post or reply, the MCP keeps your Mattermost identity and automatically adds 🤖 AI-assisted message sent via Mattermost MCP. so other readers can see that an agent helped send it.