Mattermost MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "MATTERMOST_URL=${MATTERMOST_URL}" -e "MATTERMOST_TOKEN=${MATTERMOST_TOKEN}" -e "MATTERMOST_TEAM_ID=${MATTERMOST_TEAM_ID}" mattermost-mcp -- npx -y mcp-remote https://mattermost-mcp.your-account.workers.dev/mcp
Required:MATTERMOST_URLMATTERMOST_TOKENMATTERMOST_TEAM_ID
README.md

Interact with Mattermost workspaces to manage channels, messages, and threads.

Mattermost MCP Server

A Model Context Protocol (MCP) server for interacting with Mattermost workspaces. This server provides tools for managing channels, messages, threads, reactions, and user profiles through Mattermost's REST API.

Built on Cloudflare Workers using the Agents SDK.

Important: This is an MCP server without OAuth authentication, designed for trusted environments where the server runs with pre-configured API credentials.

Features

Tools (9 Total)

Read Operations (6 tools):

  • list_mattermost_channels - List all channels in the team
  • get_mattermost_channel_history - Get message history from a channel
  • get_mattermost_thread_replies - Get all replies in a thread
  • get_mattermost_users - List users in the workspace
  • get_mattermost_user_profile - Get detailed profile for a specific user

Write Operations (3 tools):

  • post_mattermost_message - Post a new message to a channel
  • reply_to_mattermost_thread - Reply to an existing thread
  • add_mattermost_reaction - Add emoji reactions to posts
  • create_mattermost_direct_channel - Create a direct message channel with a user

Prompts (2 Total)

  • mattermost_guide - Comprehensive guide for using Mattermost effectively
  • message_template - Helpful templates for crafting effective Mattermost messages

Resources (2 Total)

  • mattermost://channels - List of all channels in the team
  • mattermost://users - List of all users in the workspace

Architecture

This MCP server is built using:

  • Cloudflare Workers: Serverless compute
  • Agents SDK: Framework for building AI agents and MCP Servers
  • Durable Objects: For persistent MCP session state
  • Mattermost REST API v4: For workspace integration

Prerequisites

  • Node.js 18+
  • A Mattermost instance (self-hosted or cloud)
  • Personal Access Token from Mattermost (Profile → Security → Personal Access Tokens)
  • Team ID from your Mattermost workspace

Quick Start

Local Development

  1. Clone the repository:
git clone https://github.com/vnikhilbuddhavarapu/mattermost-mcp.git
cd mattermost-mcp
  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .dev.vars.example .dev.vars

Edit .dev.vars with your Mattermost credentials:

MATTERMOST_URL=https://mattermost.your-domain.com
MATTERMOST_TOKEN=your-personal-access-token
MATTERMOST_TEAM_ID=your-team-id

Finding your Team ID:

curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://mattermost.your-domain.com/api/v4/teams | jq '.[].id'
  1. Run locally:
npm run dev

Deploy to Cloudflare Workers

  1. Click the deploy button above or run:
npm run deploy
  1. Set your secrets:
npx wrangler secret put MATTERMOST_URL
npx wrangler secret put MATTERMOST_TOKEN
npx wrangler secret put MATTERMOST_TEAM_ID

Configuration

Environment Variables

Variable Required Description
MATTERMOST_URL Yes Your Mattermost instance URL (e.g., https://mattermost.example.com)
MATTERMOST_TOKEN Yes Personal Access Token from Mattermost
MATTERMOST_TEAM_ID Yes Team ID (get via API, not team name)

Usage with MCP Clients

Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mattermost": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mattermost-mcp.your-account.workers.dev/mcp"],
      "env": {
        "MATTERMOST_URL": "https://mattermost.your-domain.com",
        "MATTERMOST_TOKEN": "your-token-here",
        "MATTERMOST_TEAM_ID": "your-team-id"
      }
    }
  }
}

Other MCP Clients

Connect to the MCP endpoint:

https://mattermost-mcp.your-account.workers.dev/mcp

Project Structure

src/
├── index.ts                 # Main MCP server setup and Durable Object
├── mattermost-client.ts     # REST API client for Mattermost
├── shared/
│   └── utils.ts            # Logging utilities and request ID generation
├── tools/                   # MCP tool implementations
│   ├── list-channels.ts
│   ├── get-channel-history.ts
│   ├── post-message.ts
│   ├── reply-to-thread.ts
│   ├── get-thread-replies.ts
│   ├── add-reaction.ts
│   ├── get-users.ts
│   ├── get-user-profile.ts
│   ├── create-direct-channel.ts
│   └── index.ts            # Tool exports
├── prompts/                # MCP prompt templates
│   ├── mattermost-guide.ts
│   ├── message-template.ts
│   └── index.ts            # Prompt exports
└── resources/              # MCP resources
    ├── channe

Tools (9)

list_mattermost_channelsList all channels in the team
get_mattermost_channel_historyGet message history from a channel
get_mattermost_thread_repliesGet all replies in a thread
get_mattermost_usersList users in the workspace
get_mattermost_user_profileGet detailed profile for a specific user
post_mattermost_messagePost a new message to a channel
reply_to_mattermost_threadReply to an existing thread
add_mattermost_reactionAdd emoji reactions to posts
create_mattermost_direct_channelCreate a direct message channel with a user

Environment Variables

MATTERMOST_URLrequiredYour Mattermost instance URL
MATTERMOST_TOKENrequiredPersonal Access Token from Mattermost
MATTERMOST_TEAM_IDrequiredTeam ID from your Mattermost workspace

Configuration

claude_desktop_config.json
{"mcpServers": {"mattermost": {"command": "npx", "args": ["-y", "mcp-remote", "https://mattermost-mcp.your-account.workers.dev/mcp"], "env": {"MATTERMOST_URL": "https://mattermost.your-domain.com", "MATTERMOST_TOKEN": "your-token-here", "MATTERMOST_TEAM_ID": "your-team-id"}}}}

Try it

List all the channels in my Mattermost team and summarize the latest activity in the general channel.
Find the latest messages in the project-alpha thread and draft a reply acknowledging the updates.
Post a message to the team channel announcing that the deployment is complete.
Get the user profile for the team lead and create a direct message channel to discuss the project status.

Frequently Asked Questions

What are the key features of Mattermost MCP Server?

Manage channels, messages, and threads via Mattermost REST API. Support for reading channel history and thread replies. Ability to post new messages and reply to existing threads. Add emoji reactions to posts. Create direct message channels with workspace users.

What can I use Mattermost MCP Server for?

Automating team status updates by posting daily summaries to specific channels.. Querying channel history to quickly find information or decisions made in past discussions.. Streamlining communication by drafting and sending messages directly from the AI interface.. Managing team interactions by programmatically creating direct message channels for urgent tasks..

How do I install Mattermost MCP Server?

Install Mattermost MCP Server by running: npx -y mcp-remote https://mattermost-mcp.your-account.workers.dev/mcp

What MCP clients work with Mattermost MCP Server?

Mattermost MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Mattermost MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare