Element MCP Server

Element MCP Server

Connects Claude with Matrix/Element to read and search messages across rooms. Enables listing rooms, viewing room information, retrieving message history, and searching conversation content from your Matrix account.

Category
访问服务器

README

Element MCP Server

License: MIT Node.js MCP

An MCP (Model Context Protocol) server that connects Claude with Element. Read rooms, messages, and search content in your Matrix conversations.

🌐 También disponible en español más abajo / Spanish version below

What is this?

This server acts as a "bridge" between Claude and your Matrix account. Once configured, Claude can:

  • List your Matrix rooms
  • Read messages from any room
  • Search messages by content
  • View detailed room information

Prerequisites

  • Node.js 18+ installed
  • A Matrix account (e.g., on matrix.org or Element)
  • Your Matrix Access Token

Getting your Access Token

From Element Web/Desktop:

  1. Open Element and go to Settings (gear icon)
  2. Go to Help & About
  3. In the advanced section, find Access Token
  4. Copy the token (starts with something like syt_... or MDAxO...)

⚠️ Important: Your access token is like a password. Don't share it publicly.

Installation

# Clone the repository
git clone https://github.com/rosquillas/matrix-mcp-server.git
cd matrix-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

Configuration

Environment Variables

# Your Matrix homeserver (default: https://matrix.org)
MATRIX_HOMESERVER=https://matrix.org

# Your access token (REQUIRED)
MATRIX_ACCESS_TOKEN=your_token_here

# Transport type: 'stdio' or 'http' (default: stdio)
TRANSPORT=stdio

# Port for HTTP mode (default: 3000)
PORT=3000

Usage

stdio mode (recommended for Claude Desktop)

MATRIX_ACCESS_TOKEN=your_token npm start

HTTP mode (for remote use)

TRANSPORT=http MATRIX_ACCESS_TOKEN=your_token npm start

Claude Desktop Configuration

Add this to your Claude Desktop config file:

  • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "matrix": {
      "command": "node",
      "args": ["/path/to/matrix-mcp-server/dist/index.js"],
      "env": {
        "MATRIX_HOMESERVER": "https://matrix.org",
        "MATRIX_ACCESS_TOKEN": "your_token_here"
      }
    }
  }
}

Available Tools

matrix_list_rooms

List all rooms you've joined.

Parameters:

  • limit (optional): Maximum number of rooms (1-100, default: 20)

matrix_get_messages

Get messages from a specific room.

Parameters:

  • room_id (required): Room ID (e.g., !abc123:matrix.org)
  • limit (optional): Number of messages (1-100, default: 50)
  • direction (optional): 'b' for older, 'f' for newer

matrix_search_messages

Search messages by content.

Parameters:

  • query (required): Text to search
  • room_id (optional): Limit to a specific room
  • limit (optional): Max results (1-50, default: 10)

matrix_get_room_info

Get detailed room information.

Parameters:

  • room_id (required): Room ID

Example Usage

Once configured, you can tell Claude:

"Show me my Matrix rooms"

"What was discussed yesterday in the development room?"

"Search for messages about 'deployment' in my chats"

Security

  • Access token is passed as environment variable, never stored in code
  • Only read operations (cannot send messages)
  • Server only communicates with your configured homeserver

Troubleshooting

"MATRIX_ACCESS_TOKEN environment variable is required"

Make sure to set the environment variable with your token.

"Matrix API error (401)"

Your token expired or is invalid. Generate a new one from Element.

"Matrix API error (403)"

You don't have permissions to access that room.


Versión en Español

¿Qué es esto?

Este servidor actúa como un "puente" entre Claude y tu cuenta de Matrix. Una vez configurado, Claude puede:

  • Ver tus salas de Matrix
  • Leer mensajes de cualquier sala
  • Buscar mensajes por contenido
  • Ver información detallada de las salas

Requisitos Previos

  • Node.js 18+ instalado
  • Una cuenta de Matrix (por ejemplo, en matrix.org o Element)
  • Tu Access Token de Matrix

Obtener tu Access Token

Desde Element Web/Desktop:

  1. Abre Element y ve a Configuración (ícono de engrane)
  2. Ve a Ayuda y Sobre (Help & About)
  3. En la sección avanzada, encontrarás Access Token
  4. Copia el token (empieza con algo como syt_... o MDAxO...)

⚠️ Importante: Tu access token es como una contraseña. No lo compartas públicamente.

Instalación

# Clona el repositorio
git clone https://github.com/rosquillas/matrix-mcp-server.git
cd matrix-mcp-server

# Instala dependencias
npm install

# Compila el proyecto
npm run build

Configuración con Claude Desktop

Agrega esto a tu archivo de configuración:

  • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "matrix": {
      "command": "node",
      "args": ["/ruta/a/matrix-mcp-server/dist/index.js"],
      "env": {
        "MATRIX_HOMESERVER": "https://matrix.org",
        "MATRIX_ACCESS_TOKEN": "tu_token_aqui"
      }
    }
  }
}

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选