Mattermost MCP Server
This server enables interaction with Mattermost workspaces to manage channels, messages, threads, and user profiles via the Mattermost REST API. It provides a comprehensive suite of tools for reading channel history, posting messages, and managing reactions within a trusted environment.
README
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 teamget_mattermost_channel_history- Get message history from a channelget_mattermost_thread_replies- Get all replies in a threadget_mattermost_users- List users in the workspaceget_mattermost_user_profile- Get detailed profile for a specific user
Write Operations (3 tools):
post_mattermost_message- Post a new message to a channelreply_to_mattermost_thread- Reply to an existing threadadd_mattermost_reaction- Add emoji reactions to postscreate_mattermost_direct_channel- Create a direct message channel with a user
Prompts (2 Total)
mattermost_guide- Comprehensive guide for using Mattermost effectivelymessage_template- Helpful templates for crafting effective Mattermost messages
Resources (2 Total)
mattermost://channels- List of all channels in the teammattermost://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
- Clone the repository:
git clone https://github.com/vnikhilbuddhavarapu/mattermost-mcp.git
cd mattermost-mcp
- Install dependencies:
npm install
- 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'
- Run locally:
npm run dev
Deploy to Cloudflare Workers
- Click the deploy button above or run:
npm run deploy
- 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
├── channels-list.ts
├── users-list.ts
└── index.ts # Resource exports
wrangler.jsonc # Cloudflare Workers configuration
worker-configuration.d.ts # TypeScript types for bindings
API Reference
Mattermost REST API v4
This server uses the Mattermost REST API v4. Key endpoints used:
Get Channels:
GET /api/v4/teams/{team_id}/channels
Get Posts:
GET /api/v4/channels/{channel_id}/posts
Create Post:
POST /api/v4/posts
{
"channel_id": "...",
"message": "...",
"root_id": "..." // optional, for threads
}
Add Reaction:
POST /api/v4/reactions
{
"post_id": "...",
"emoji_name": "..."
}
Documentation
- Cloudflare Agents SDK - Remote MCP Server Guide
- Cloudflare Workers Documentation
- Cloudflare MCP Server Docs
- Mattermost REST API Docs
- Model Context Protocol Spec
License
MIT
Connect to Cloudflare AI Playground
You can connect to your MCP server from the Cloudflare AI Playground, which is a remote MCP client:
- Go to https://playground.ai.cloudflare.com/
- Enter your deployed MCP server URL (
mattermost-mcp.<your-account>.workers.dev/mcp) - You can now use your MCP tools directly from the playground!
Connect Claude Desktop to your MCP server
You can also connect to your remote MCP server from local MCP clients, by using the mcp-remote proxy.
To connect to your MCP server from Claude Desktop, follow Anthropic's Quickstart and within Claude Desktop go to Settings > Developer > Edit Config.
Update with this configuration:
{
"mcpServers": {
"mattermost": {
"command": "npx",
"args": [
"mcp-remote",
"https://mattermost-mcp.your-account.workers.dev/mcp"
]
}
}
}
Restart Claude and you should see the tools become available.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。