Mattermost MCP server

Integrates with Mattermost workspaces to enable channel listing, message history retrieval, posting, thread management, reactions, user information access, and topic monitoring for team communication platforms.
Back to servers
Provider
pvev
Release date
Mar 10, 2025
Language
TypeScript
Stats
12 stars

This MCP server enables Claude and other clients to interact with Mattermost workspaces through a standardized protocol. It provides tools for monitoring topics, managing messages, and accessing user information within your Mattermost instance.

Installation

Prerequisites

  • Node.js installed on your system
  • Access to a Mattermost workspace with API permissions

Setup Steps

  1. Clone the repository:

    git clone https://github.com/yourusername/mattermost-mcp.git
    cd mattermost-mcp
    
  2. Install dependencies:

    npm install
    
  3. Configure the server:

    Create a config.local.json file with your credentials:

    {
      "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
      }
    }
    
  4. Build the server:

    npm run build
    
  5. Start the server:

    npm start
    

Usage

Topic Monitoring

Configure topic monitoring in your config.local.json file with these options:

  • enabled: Set to true to enable monitoring
  • schedule: Cron expression for monitoring schedule (e.g., "*/15 * * * *" for every 15 minutes)
  • channels: Array of channel names to monitor
  • topics: Array of topics to search for in messages
  • messageLimit: Number of recent messages to analyze per check
  • notificationChannelId (optional): Channel ID for notifications
  • userId (optional): Your user ID for mentions in notifications

Running Monitoring Manually

You can trigger monitoring in several ways:

  1. Using the provided scripts:

    ./run-monitoring-http.sh
    
  2. Using the CLI (while server is running): Type one of these commands in the terminal:

    run
    monitor
    check
    
  3. Using command-line flags:

    npm start -- --run-monitoring
    

    Add --exit-after-monitoring to exit after completion.

  4. Using HTTP endpoints:

    curl http://localhost:3456/run-monitoring
    

Available Tools

Channel Tools

  • List Channels

    mattermost_list_channels
    

    Optional parameters: limit (default: 100), page (default: 0)

  • Get Channel History

    mattermost_get_channel_history
    

    Required: channel_id
    Optional: limit (default: 30), page (default: 0)

Message Tools

  • Post Message

    mattermost_post_message
    

    Required: channel_id, message

  • Reply to Thread

    mattermost_reply_to_thread
    

    Required: channel_id, post_id, message

  • Add Reaction

    mattermost_add_reaction
    

    Required: channel_id, post_id, emoji_name

  • Get Thread Replies

    mattermost_get_thread_replies
    

    Required: channel_id, post_id

User Tools

  • Get Users

    mattermost_get_users
    

    Optional: limit (default: 100), page (default: 0)

  • Get User Profile

    mattermost_get_user_profile
    

    Required: user_id

Utility Scripts

  • View Channel Messages:

    node view-channel-messages.js <channel-name> [count]
    
  • Analyze Channel:

    node analyze-channel.js <channel-name> [count]
    
  • Get Last Message:

    node get-last-message.js <channel-name>
    

Integration with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "mattermost": {
      "command": "node",
      "args": [
        "/path/to/mattermost-mcp/build/index.js"
      ]
    }
  }
}

Troubleshooting

If you encounter issues:

  • Verify your personal access token has the necessary permissions
  • Check that the token is correctly copied to your configuration
  • Confirm the Mattermost URL and team ID are correct

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later