matrix-mcp-server
Provides tools for interacting with the Matrix protocol, enabling AI agents to send messages, manage rooms, invite or kick users, and resolve room or user names to Matrix IDs.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@matrix-mcp-serversend a message to the eng room: 'Morning everyone!'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@guan-tends/matrix-mcp-server
A standalone MCP (Model Context Protocol) tool server that exposes Matrix chat operations as callable tools. Any MCP-compatible client — AI agents, automation pipelines, developer tools — can use these tools to send messages, manage rooms, resolve names, and interact with the Matrix protocol.
Built on @vector-im/matrix-bot-sdk with full E2EE (end-to-end encryption) support.
Features
15 MCP tools — messaging, room management, user management, and intelligent ID resolution
E2EE support — full Megolm encryption via Rust crypto backend
Human-friendly name resolution — refer to rooms and users by name, not opaque IDs
Alias system — teach the server custom shortcuts (e.g.,
"eng"→"!abc123:matrix.org")Standalone HTTP server — runs independently, connect any MCP client via HTTP
Zero-cron, zero-LLM — pure tool server. Scheduling and intelligence live in the agent layer
Related MCP server: ottoauthMCP
Install
npm install @guan-tends/matrix-mcp-serverRequirements
Node.js >= 22.0.0
A Matrix account with an access token
Quick Start
1. Clone and configure
git clone https://github.com/guan-tends/matrix-mcp-server.git
cd matrix-mcp-server
npm install
cp config.example.json5 config.json5Edit config.json5 with your Matrix credentials:
{
homeserverUrl: "https://matrix.org",
accessToken: "syt_...",
serverName: "matrix.org",
port: 3456,
host: "0.0.0.0",
storePath: "./data/store.json",
cryptoPath: "./data/crypto",
}2. Run
npm startThe server listens on http://0.0.0.0:3456 and accepts MCP protocol requests over HTTP.
3. Connect your MCP client
Point any MCP-compatible client at the server:
{
"mcpServers": {
"matrix": {
"url": "http://localhost:3456"
}
}
}Or use with @guan-tends/mcp-ai aggregator for multi-server tool composition.
Configuration
File-based
Edit config.json5 (see config.example.json5 for all options).
Environment variables
All config values can be set via environment variables (highest precedence):
Variable | Config Key |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tools (15)
Messaging
Tool | Description |
| Send text to a room (by ID or resolved name) |
| Send HTML-formatted message |
| React to a message with emoji |
| Send a direct message (creates encrypted DM if needed) |
Room Management
Tool | Description |
| Join a room by ID or alias |
| Leave a room |
| List all joined rooms |
| Get recent messages from a room |
User Management
Tool | Description |
| Get presence status for a user |
| Invite a user to a room |
| Kick a user from a room |
ID Resolution
Tool | Description |
| Teach the server a room alias (e.g., |
| Teach the server a user alias (e.g., |
| Resolve a room name to its Matrix ID with confidence score |
| Resolve a user name to their Matrix ID with confidence score |
Resolution Strategy
The resolver uses a hybrid approach with confidence scoring:
User aliases (confidence: 1.0) — User-defined mappings
Exact match (confidence: 0.9) — Exact display name or canonical alias
Partial match (confidence: 0.7) — Partial name match
Ambiguity (confidence: 0.5) — Multiple matches, returns candidates
Architecture
┌─────────────────────────┐
│ index.js │
│ (composition root) │
└──────────┬──────────────┘
│ wires
┌────────────────┼────────────────┐
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ MatrixClient │ │ AliasStore │ │ McpDataStore │
│ (bot-sdk) │ │ (aliases) │ │ (DM cache) │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ │ │
└────────┬────────┘ │
▼ │
┌──────────────────┐ │
│ MatrixIdResolver │◄────────────────┘
└────────┬─────────┘
│
▼
┌──────────────────┐
│ mcp-server.js │── MCP SDK SimpleServer
│ (15 tools) │── HTTP transport
└──────────────────┘Composition-Root IoC: index.js wires all dependencies. No module imports another's deps. Each module is independently testable.
Design Decisions
Composition-Root IoC —
index.jswires all dependencies. Modules don't cross-import.Minimal AliasStore — Only 4 methods needed for room/user alias management.
Simple JSON persistence —
persist.jshandles load/save. Two data files.withErrorHandlingwrapper — DRYs the repeated try/catch in every tool.No cron, no LLM, no bot — Pure MCP tool server. Agents handle their own scheduling.
Testing
# All tests (unit + E2E)
npm test
# Watch mode
npm run test:watch
# With coverage
npm run test:coverage65 tests across 6 files (5 unit, 1 E2E).
Project Structure
src/
├── index.js — Composition root: config → Matrix client → wire → start
├── mcp-server.js — 15 MCP tools + helpers (withErrorHandling, resolveRoomInput, etc.)
├── matrix-id-resolver.js — Room/user name → Matrix ID resolution
├── alias-store.js — Minimal per-user alias storage
├── mcp-data-store.js — DM room ID cache
└── persist.js — Simple JSON load/save utility
__tests__/
├── unit/ — Unit tests (alias-store, mcp-data-store, resolver, mcp-server, persist)
├── e2e/ — E2E test (full server start → MCP client → tool calls)
├── mocks/ — Mock MatrixClient for testing
└── vitest.config.jsSponsors
If this project is useful to you, consider supporting its development:
Solana:
Eu8wQcW68TKMs1a6eqzZu8znzU52QLqQugAMG8uCD6y6EVM (Ethereum / Base / Arbitrum / Optimism / Polygon):
0x2733ff7c865C56d565a99BE1DC11B81cc76850A5XRP Ledger:
r4X6e7McAQj7e8vBCeued1RYu4mCJrREDG
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA self-hostable MCP server that turns a folder of skills into callable tools via MCP and REST APIs.2MIT
- FlicenseNot gradedqualityDmaintenanceStandalone MCP server that proxies tool calls to Ottoauth HTTP endpoints, enabling account creation and dynamic service interaction.
- FlicenseNot gradedqualityDmaintenanceMCP server for Rocket.Chat, enabling AI agents to interact with Rocket.Chat workspaces via tools like listing users, sending messages, and managing channels.2
- AlicenseNot gradedqualityCmaintenanceMCP server for Matrix that lets Claude list rooms, search/read messages, send messages and files, react, create rooms, and invite users, with multi-homeserver support and safe-by-default writes; no end-to-end encryption.MIT
Related MCP Connectors
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/guan-tends/matrix-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server