Mattermost集成服务器

该项目实现了一个用于Mattermost集成的模型上下文协议(MCP)服务器,通过连接Mattermost API端点检索和处理各种信息,并通过标准MCP传输方式提供这些信息。

  • by kakehashi-inc
  • TypeScript
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 kakehashi-inc/mattermost-mcp-server

使用说明

mcp-server-mattermost

这个项目实现了一个用于Mattermost集成的模型上下文协议(MCP)服务器。它连接到Mattermost API端点以检索和处理各种信息,并通过标准的MCP传输方式提供这些信息。

特性

  • 通过令牌进行安全连接至Mattermost API端点
  • 支持多种运输方式:
    • stdio
    • http-stream
    • sse
  • 在多个Mattermost频道中搜索消息
  • 可自定义的默认频道和消息获取限制

要求

  • Node.js >= 22
  • npm >= 10

设置

  1. 克隆此存储库:
git clone https://github.com/kakehashi-inc/mcp-server-mattermost.git
cd mcp-server-mattermost
  1. 安装依赖项:
npm install
  1. 设置你的环境变量:

必需的环境变量

  • MATTERMOST_ENDPOINT你的Mattermost服务器URL
  • MATTERMOST_TOKEN你的Mattermost身份验证令牌
  • MATTERMOST_TEAM要监控的团队名称
  • MATTERMOST_CHANNELS要监控的频道名称列表,以逗号分隔

环境变量设置选项

选项1:直接环境变量

export MATTERMOST_ENDPOINT="https://your-mattermost-server.com"
export MATTERMOST_TOKEN="your-token-here"
export MATTERMOST_TEAM="your-team-name"
export MATTERMOST_CHANNELS="general,random,dev"

选项2:使用.env文件(配合dotenvx)

# Install dotenvx (optional)
npm install -g @dotenvx/dotenvx

# Create .env file
cp .env.example .env
# Edit .env file with your values

# Encrypt your .env file (recommended for production)
dotenvx encrypt
  1. 构建服务器:
npm run build

用法

服务器支持三种传输模式:stdio(默认)、sse 和 http-stream。

标准输入输出传输模式

# Using npm scripts (with dotenvx)
npm run start:stdio

# Direct execution
node dist/main.js --transport stdio

# Using npx
npx mcp-server-mattermost --transport stdio

SSE传输模式

# Using npm scripts (with dotenvx)
npm run start:sse

# Direct execution
node dist/main.js --transport sse

HTTP传输模式

# Using npm scripts (with dotenvx)
npm run start:http

# Direct execution
node dist/main.js --transport http-stream

Claude桌面集成

要在Claude Desktop中使用此MCP服务器,请在Claude Desktop设置中添加以下配置:

样本配置

{
  "mcpServers": {
    "mattermost": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-mattermost@latest",
        "--transport", "stdio",
        "--endpoint", "https://your-mattermost-server/api/v4",
        "--token", "your_personal_access_token",
        "--team", "your_team_name",
        "--channels", "town-square,general,your_channel_name"
      ]
    }
  }
}

开发

  • npm run dev以开发模式启动服务器并启用热重载
  • npm run lint运行 ESLint
  • npm run format使用Prettier格式化代码
  • npm test运行测试
  • npm run inspect运行MCP检查器

参考文献

许可证

麻省理工学院