
mjknowles/matrix-mcp-server 是从 https://github.com/mjknowles/matrix-mcp-server. 导入的 MCP 服务器候选服务器。
概览
mjknowles/matrix-mcp-server 是从 https://github.com/mjknowles/matrix-mcp-server. 导入的 MCP 服务器候选服务器。
概述(AI 翻译)
一个全面的模型上下文协议(MCP)服务器,提供对矩阵家庭服务器功能的安全访问。该服务器采用TypeScript构建,使MCP客户端能够通过标准化界面与矩阵房间、消息、用户等交互。
特色
- 🔐 **OAuth 2.0 认证支持令牌交换
- 📱 15 个按功能层级组织的矩阵工具
- 🏠 多家庭服务器支持,支持可配置端点
- 🔄 带有临时客户端管理的实时操作
- 🚀 生产准备,具备全面的错误处理功能
- 📊 丰富的响应,包含详细矩阵数据
快速启动
先决条件
- Node.js 20+ 和 NPM
- 矩阵家庭服务器访问(Synapse、树枝晶等)
- MCP 客户端(Claude Desktop、带 MCP 扩展的 VS Code 等)
安装
开发模式
可用工具
📖 第0层:只读工具
房间工具
-
list-joined-rooms- 获取用户加入的所有房间 -
No参数required
-
返回房间名称、ID和成员数量
-
get-room-info- 获取详细房间信息 -
roomId(字符串):矩阵房间ID(例如,!roomid:domain.com)
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Matrix MCP Server
A comprehensive Model Context Protocol (MCP) server that provides secure access to Matrix homeserver functionality. Built with TypeScript, this server enables MCP clients to interact with Matrix rooms, messages, users, and more through a standardized interface.
Features
- 🔐 OAuth 2.0 Authentication with token exchange support
- 📱 15 Matrix Tools organized by functionality tiers
- 🏠 Multi-homeserver Support with configurable endpoints
- 🔄 Real-time Operations with ephemeral client management
- 🚀 Production Ready with comprehensive error handling
- 📊 Rich Responses with detailed Matrix data
Quick Start
Prerequisites
- Node.js 20+ and npm
- Matrix homeserver access (Synapse, Dendrite, etc.)
- MCP client (Claude Desktop, VS Code with MCP extension, etc.)
Installation
# Clone the repository
git clone
cd matrix-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Configure environment
cp .env.example .env
# Edit .env with your settings
# Start the server
npm start
Development Mode
# Start with hot reload (OAuth disabled for easier testing)
npm run dev
# Or start with OAuth enabled
ENABLE_OAUTH=true npm run dev
Available Tools
📖 Tier 0: Read-Only Tools
Room Tools
-
list-joined-rooms- Get all rooms the user has joined- No parameters required
- Returns room names, IDs, and member counts
-
get-room-info- Get detailed room informationroomId(string): Matrix room ID (e.g.,!roomid:domain.com)- Returns name, topic, settings, creator, and member count
-
get-room-members- List all members in a roomroomId(string): Matrix room ID- Returns display names and user IDs of joined members
Message Tools
-
get-room-messages- Retrieve recent messages from a roomroomId(string): Matrix room IDlimit(number, default: 20): Maximum messages to retrieve- Returns formatted message content including text and images
-
get-messages-by-date- Filter messages by date rangeroomId(string): Matrix room IDstartDate(string): ISO 8601 format (e.g.,2024-01-01T00:00:00Z)endDate(string): ISO 8601 format- Returns messages within the specified timeframe
-
identify-active-users- Find most active users by message countroomId(string): Matrix room IDlimit(number, default: 10): Maximum users to return- Returns users ranked by message activity
User Tools
-
get-user-profile- Get profile information for any usertargetUserId(string): Target user’s Matrix ID (e.g.,@user:domain.com)- Returns display name, avatar, presence, and shared rooms
-
get-my-profile- Get your own profile information- No parameters required
- Returns your profile, device info, and room statistics
安装
npx @modelcontextprotocol/inspector