MatrixBLOCK
MCP Server for a Matrix home server integration; chat, manage rooms, etc.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
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 information
roomId(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 room
roomId(string): Matrix room ID- Returns display names and user IDs of joined members
Message Tools
- `get-room-messages` - Retrieve recent messages from a room
roomId(string): Matrix room IDlimit(number, default: 20): Maxim
152607b1bc05OBSERVED · 2026-10-08Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add matrix-mcp-server --env ENABLE_OAUTH=${ENABLE_OAUTH} --env ENABLE_TOKEN_EXCHANGE=${ENABLE_TOKEN_EXCHANGE} --env IDP_AUTHORIZATION_URL=${IDP_AUTHORIZATION_URL} --env IDP_TOKEN_URL=${IDP_TOKEN_URL} -- npx -y [email protected]{
"mcpServers": {
"matrix-mcp-server": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"ENABLE_OAUTH": "${ENABLE_OAUTH}",
"ENABLE_TOKEN_EXCHANGE": "${ENABLE_TOKEN_EXCHANGE}",
"IDP_AUTHORIZATION_URL": "${IDP_AUTHORIZATION_URL}",
"IDP_TOKEN_URL": "${IDP_TOKEN_URL}"
}
}
}
}Exposed tools (20)
15 read · 5 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
create-room | write | |
get-all-users | read | |
get-direct-messages | read | |
get-messages-by-date | read | |
get-my-profile | read | |
get-notification-counts | read | |
get-room-info | read | |
get-room-members | read | |
get-room-messages | read | |
get-user-profile | read | |
identify-active-users | read | |
invite-user | read | |
join-room | read | |
leave-room | read | |
list-joined-rooms | read | |
search-public-rooms | read | |
send-direct-message | write | |
send-message | write | |
set-room-name | write | |
set-room-topic | write |
Trust audit
BLOCKgrade D · trust 69/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (5 observation(s))
- Network
- declared (8 observation(s))
- Shell
- none-observed
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (13)
agent: new https.Agent({ rejectUnauthorized: false }), // For local development with self-signed certsrequestAgent: new https.Agent({ rejectUnauthorized: false }),agent: new https.Agent({ rejectUnauthorized: false }),const agent = new https.Agent({ rejectUnauthorized: false });console.log(`Performing token exchange with IDP at ${tokenUrl}`);import { createConfiguredMatrixClient, getAccessToken, getMatrixContext } from "../../utils/server-helpers.js";import { removeClientFromCache } from "../../matrix/client.js";import { processMessage, processMessagesByDate, countMessagesByUser } from "../../matrix/messageProcessor.js";import { ToolRegistrationFunction } from "../../types/tool-types.js";import { createConfiguredMatrixClient, getAccessToken, getMatrixContext } from "../../utils/server-helpers.js";@modelcontextprotocol/sdk, cors, dotenv, express, jsonwebtoken, jwks-rsa, matrix-js-sdk, node-fetch
- `ENABLE_TOKEN_EXCHANGE`: Set to "true" to exchange the access token used to access this MCP server for one from the Matrix client in your IdP (assuming both this mcp server and your homeserver share
- User has 2 joined rooms with full access
Gates applied: no_behavioural_pass.
152607b1bc05full audit observations/trust-audit/mcp-server/mjknowles__matrix.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 152607b1bc05 | BLOCK | D | 69 | first audit |
Questions
What is the Matrix MCP server?
MCP Server for a Matrix home server integration; chat, manage rooms, etc.
What tools does Matrix expose?
20 in total: 15 read-only, 5 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is Matrix safe to connect to an agent?
No — not without reading the findings first. The audit graded it D (69/100) and found 4 critical or high issues in the source. Each one is listed on this page with the file and line it is on.
What credentials does Matrix need?
It reads ENABLE_OAUTH, ENABLE_TOKEN_EXCHANGE, IDP_AUTHORIZATION_URL, IDP_TOKEN_URL, MATRIX_CLIENT_SECRET, OAUTH_CALLBACK_URL, OAUTH_SCOPES_SUPPORTED and SSL_KEY_PATH from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does Matrix run?
It speaks streamable-http, so it runs as a service you connect to over the network. It is published on npm as matrix-mcp-server at 1.0.0.
How current is this page?
The grade is for one exact copy of the source (152607b1bc05), read on 2026-10-08. The repository is watched and re-audited when it changes.