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.
Clone the repository:
git clone https://github.com/yourusername/mattermost-mcp.git
cd mattermost-mcp
Install dependencies:
npm install
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
}
}
Build the server:
npm run build
Start the server:
npm start
Configure topic monitoring in your config.local.json
file with these options:
enabled
: Set to true
to enable monitoringschedule
: Cron expression for monitoring schedule (e.g., "*/15 * * * *" for every 15 minutes)channels
: Array of channel names to monitortopics
: Array of topics to search for in messagesmessageLimit
: Number of recent messages to analyze per checknotificationChannelId
(optional): Channel ID for notificationsuserId
(optional): Your user ID for mentions in notificationsYou can trigger monitoring in several ways:
Using the provided scripts:
./run-monitoring-http.sh
Using the CLI (while server is running): Type one of these commands in the terminal:
run
monitor
check
Using command-line flags:
npm start -- --run-monitoring
Add --exit-after-monitoring
to exit after completion.
Using HTTP endpoints:
curl http://localhost:3456/run-monitoring
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)
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
Get Users
mattermost_get_users
Optional: limit
(default: 100), page
(default: 0)
Get User Profile
mattermost_get_user_profile
Required: user_id
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>
Add this to your claude_desktop_config.json
:
{
"mcpServers": {
"mattermost": {
"command": "node",
"args": [
"/path/to/mattermost-mcp/build/index.js"
]
}
}
}
If you encounter issues:
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.
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"
]
}
}
}
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.
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.