# Matrix/Element MCP

> Matrix/Element MCP connects your AI agent directly to decentralized Matrix communications. You manage rooms, send secure messages, synchronize account status, and handle user discovery—all through natural conversation. It gives you full control over complex chat networks without needing a dedicated client.

## Overview
- **Category:** communication-messaging
- **Price:** Free
- **Tags:** matrix, element, chat, decentralized, e2ee

## Description

This connector lets you treat your private Matrix chats like any other data source available to your AI agent. Instead of logging into an app just to check on group discussions or send a quick update, you tell your agent what you need done. It handles everything from joining new chat rooms and sending encrypted messages to checking the latest conversation state. You can use it to search for specific users across large networks, manage your profile details, or even upload keys for end-to-end security. Integrating this MCP via Vinkius lets your AI client handle complex communication tasks—like setting up an alert room or coordinating incident response—right within your existing workflow.

## Tools

### change_password
Updates the account password for Matrix login.

### claim_keys
Retrieves and claims end-to-end encrypted keys from the homeserver.

### create_room
Initiates a brand new chat room within Matrix.

### deactivate_account
Permanently deactivates the current user's Matrix account.

### download_media
Downloads media files shared within a room from the homeserver.

### get_room_state
Fetches specific state events and history for an existing chat room.

### join_room
Adds the user to a specified Matrix chat room using its ID or alias.

### knock_room
Requests temporary access to a private Matrix room.

### leave_room
Removes the user from a specific chat room.

### login_account
Authenticates and logs into the Matrix account.

### logout_account
Signs out of the current Matrix session.

### query_keys
Checks for existing end-to-end encryption keys on the homeserver.

### register_account
Sets up a brand new Matrix user account.

### search_user_directory
Searches the global directory for specific users or handles.

### send_message
Transmits a message or custom event into a specified Matrix room.

### set_room_state
Manually updates the state events for an existing chat room.

### sync_client
Synchronizes the client's local data with the homeserver to get the latest status.

### upload_keys
Uploads necessary end-to-end encryption keys to the homeserver for security.

### upload_media
Sends media files (images, videos) to the homeserver.

## Prompt Examples

**Prompt:** 
```
Sync my Matrix client to see if I have any new notifications.
```

**Response:** 
```
I've triggered a sync. You have 3 new messages in '!engineering:matrix.org' and a new invitation to join the 'Project X' room.
```

**Prompt:** 
```
Send a message to room !abc:matrix.org saying 'The deployment is complete'.
```

**Response:** 
```
Message sent successfully to room !abc:matrix.org with transaction ID 'txn_12345'.
```

**Prompt:** 
```
Search the user directory for 'bob'.
```

**Response:** 
```
I found 2 users matching 'bob': Bob Smith (@bob_s:matrix.org) and Bob Builder (@builder:matrix.org).
```

## Capabilities

### Manage Chat Rooms
Create, join, knock on, and leave chat rooms using simple commands.

### Send Messages and Events
Dispatch messages or custom events to any room with transaction tracking.

### Synchronize Account State
Fetch the latest status updates from your homeserver, keeping all conversations current.

### Discover Users
Search the global Matrix directory to find and connect with other users by name or handle.

### Handle Security Credentials
Query, upload, and manage end-to-end encryption keys for secure communication.

## Use Cases

### Incident Response Coordination
The ops lead needs to get an immediate status update on a server issue. They ask their agent to run `get_room_state` on the #alerts room, and the agent pulls the latest 10 messages, identifying which engineer last responded using that data.

### Onboarding New Team Members
A community manager needs to bring a new user into a private project group. They instruct their agent to first `search_user_directory` for the user's handle, then use `create_room`, and finally run `join_room` so everyone is connected.

### Archiving Project Discussions
A developer needs all the finalized conversation details from a finished project. They ask their agent to retrieve the room state using `get_room_state`, which aggregates messages, allowing them to archive the full context.

### Cross-Platform Messaging
You need to notify multiple stakeholders that a deployment is finished. You tell your agent to use `send_message` and specify the target rooms (e.g., #devops, #product), ensuring all channels receive the alert.

## Benefits

- Automate communication: Instead of manually opening your chat app to send an update, you simply ask your agent to use the `send_message` tool. It handles routing and transaction tracking automatically.
- Maintain security context: Use tools like `query_keys` or `upload_keys` to manage encryption keys directly through your workflow, ensuring communications stay end-to-end encrypted without manual steps.
- Stay current on activity: Running the `sync_client` tool pulls all new messages and state changes from the homeserver. You always have the latest version of a room's history available to your agent.
- Build networks: Need to connect with someone? Use `search_user_directory` to find user handles, or use `create_room` and `join_room` to build specific working groups on demand.
- Handle account lifecycle: You can manage the full account life cycle—from calling `register_account` to using `deactivate_account`—all through natural conversation with your agent.

## How It Works

The bottom line is that your AI client acts as a direct interface, running complex Matrix actions without you having to switch applications.

1. Subscribe to the Matrix/Element MCP and provide your specific Matrix Homeserver URL and Access Token.
2. Your AI client reads the available tools, allowing you to define a conversational task (e.g., 'Send an alert message to the ops room').
3. The agent executes the necessary tool calls—like sending messages or syncing state—and returns the results directly to your conversation.

## Frequently Asked Questions

**How do I use the Matrix/Element MCP to send messages?**
Use `send_message` and specify the target room ID or alias. You just tell your agent who needs the message, and it handles dispatching the content.

**Can I find users in a large network using Matrix/Element MCP?**
Yes, use `search_user_directory` to look up user handles. This tool queries the global directory so you can get started on communicating with new contacts.

**Is the communication secure when I use Matrix/Element MCP?**
Absolutely. The MCP includes tools like `query_keys` and `upload_keys` to manage end-to-end encryption, ensuring your agent handles communications securely.

**What if I need to start a new chat room with the MCP?**
You'll use the `create_room` tool. This initializes a brand new matrix space that you can then populate and manage using other tools like `join_room`.

**Does Matrix/Element MCP only work for existing rooms?**
No, it handles the entire lifecycle. You can use `create_room` to start fresh or `get_room_state` on an existing room to pull its history.