Mattermost API服务

MCP server for Mattermost REST API v4是一个提供Mattermost REST API v4接口的服务器,支持用户管理、频道管理、帖子管理等功能。

  • by mainpart
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 mainpart/mattermost-mcp

使用说明

马特莫斯特医学中心

用于Mattermost REST API v4的MCP服务器。

设置

1.获取个人访问令牌

系统控制台→ 集成→ 必须启用个人访问令牌。

# Login (session token is in the "Token" response header)
curl -i -X POST https://mm.example.com/api/v4/users/login \
  -d '{"login_id":"your_username","password":"your_password"}'

# Get your user ID
curl -H 'Authorization: Bearer <session_token>' \
  https://mm.example.com/api/v4/users/me
# → {"id":"abc123...","username":"your_username",...}

# Create PAT (save the token — it's shown only once!)
curl -X POST -H 'Authorization: Bearer <session_token>' \
  https://mm.example.com/api/v4/users/<user_id>/tokens \
  -d '{"description":"MCP server token"}'
# → {"id":"...","token":"YOUR_PAT_HERE",...}

2.获取团队ID

curl -H 'Authorization: Bearer <token>' \
  https://mm.example.com/api/v4/users/me/teams
# Returns id, name, display_name for each team
# Use the "id" field value as MATTERMOST_TEAM_ID

3.添加到克劳德代码

claude mcp add mattermost --scope project \
  -e MATTERMOST_URL=https://mm.example.com \
  -e MATTERMOST_TOKEN=your_pat_token \
  -e MATTERMOST_TEAM_ID=your-team-id \
  -- uvx --from git+https://github.com/mainpart/mattermost-mcp mattermost-mcp

所有工具:添加 -e MATTERMOST_TOOLS=all

选择性: -e MATTERMOST_TOOLS=get_me,get_posts,create_post

4.验证

claude mcp list
# mattermost: ... - ✓ Connected

环境变量

变量 必填 描述
MATTERMOST_URL yes 实例URL(例如。 https://mm.example.com)
MATTERMOST_TOKEN 是 个人访问令牌
MATTERMOST_TEAM_ID no 需要team_ID的工具的默认团队ID
MATTERMOST_TOOLS 否 逗号分隔的工具列表, all,或默认为空
MATTERMOST_LOG_LEVEL no 日志记录级别(默认值: WARNING)

工具

默认启用(20): get_me, get_user, search_users, get_my_teams, get_channels, get_my_channels, get_channel_by_name, search_channels, create_channel, create_direct_channel, get_posts, get_post_thread, search_posts, get_unread, get_pinned_posts, create_post, add_reaction, get_file_info, get_file, upload_file

默认禁用(8): get_user_status, set_user_status, get_reactions, remove_reaction, update_post, delete_post, pin_post, unpin_post