dendrite-admin-mcp
Summary: This MCP server lets an agent administer a Dendrite Matrix homeserver — managing users, rooms, registration tokens, server notices, and search indexing — via Dendrite's admin API.
Rooms:
evacuate_room(part all local users from a stuck room),purge_room(irreversibly delete a room and its events),download_room_state(fetch a room's state as seen by a federated server, for federation debugging)Users:
evacuate_user(part a local user from every room),reset_password(set a new password, optionally logging out all devices),refresh_devices(re-fetch a remote user's device/cross-signing keys),whois(inspect a user's live sessions)Registration:
register_user(create a local account via shared-secret HMAC flow, optionally granting admin)Registration tokens:
list_registration_tokens,get_registration_token,create_registration_token,update_registration_token,delete_registration_tokenNotices & search:
send_server_notice(push anm.textmessage from the server to a local user),fulltext_reindex(rebuild the full-text search index)
Note: purge_room and the evacuate_* tools are irreversible or disruptive and warrant confirmation before use.
Provides tools for administering a Matrix homeserver (Dendrite) — managing users, evacuating and purging rooms, sending server notices, and managing registration tokens.
Click on "Deploy 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., "@dendrite-admin-mcp Reset the password for @john:example.org to a temporary one"
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.
dendrite-admin-mcp
An agent-installable MCP server for administering a Dendrite Matrix homeserver. Install it once, and any MCP-capable agent — Claude Code, Codex, opencode, GitHub Copilot, Pi, and more — can administer your homeserver for you.
What you can do with it
Give your agent the power to:
Manage users — register accounts (shared-secret), reset passwords, evacuate users from all rooms, inspect live sessions (
whois), refresh remote users' devicesManage rooms — evacuate a room, purge a room (irreversible), download room state from a federated server for federation debugging
Send server notices — push an
m.textmessage from the server to a userManage registration tokens — list, create, update, delete
Reindex full-text search
All 15 tools map 1:1 to Dendrite's admin API — see API.md for the full reference.
Related MCP server: llmstudio-mcp
Install it with your agent
In any agentic environment, just ask:
Install the dendrite MCP server from https://github.com/niels-emmer/dendrite-admin-mcpThe agent will clone this repo, run npm run setup (prompting you for your
homeserver URL and admin token), build and test it, and register it with your
agent. Or install it yourself:
Install (quickstart)
Written for both humans and installing agents. If an agent is installing this server, follow these steps in order — clone, configure, build, test, register.
Prerequisites: Node.js >= 18 and npm.
git clone <this-repo-url> && cd dendrite-admin-mcp
npm ci
npm run setupnpm run setup prompts for the values below, writes .env, installs
dependencies, builds, and runs the test suite. Non-interactive (for agents):
npm run setup -- --base-url <url> --admin-token <token> \
[--shared-secret <secret>] [--transport stdio|http]Prefer not to run the setup script? Copy the template and fill it in manually:
cp .env.example .env # then edit .env with your valuesValue | Required | Where to find it |
| yes | Your homeserver's client-facing URL, e.g. |
| yes | Access token of a Dendrite server admin user (e.g. from Element → Settings → Sessions, or the account configured as admin in |
| no |
|
The server refuses to start without
DENDRITE_BASE_URLandDENDRITE_ADMIN_TOKEN(fail-fast). The registration snippets below pass them to the spawned process viaenv— either inline, or exported in your shell before starting the agent..envis the record of these values and the Dockerenv_file; the server itself reads env vars from the agent's config.
Then register the server with your agent — pick one:
Claude Code
User-scoped (all projects):
claude mcp add --transport stdio --scope user dendrite-admin \
--env DENDRITE_BASE_URL=https://matrix.example.com \
--env DENDRITE_ADMIN_TOKEN=<admin-token> \
-- node <repo>/dist/index.jsOr project-scoped .mcp.json in this repo (env vars must be exported):
{
"mcpServers": {
"dendrite-admin": {
"type": "stdio",
"command": "node",
"args": ["${CLAUDE_PROJECT_DIR:-.}/dist/index.js"],
"env": {
"DENDRITE_BASE_URL": "${DENDRITE_BASE_URL}",
"DENDRITE_ADMIN_TOKEN": "${DENDRITE_ADMIN_TOKEN}"
}
}
}
}Codex
codex mcp add dendrite-admin \
--env DENDRITE_BASE_URL=https://matrix.example.com \
--env DENDRITE_ADMIN_TOKEN=<admin-token> \
-- node <repo>/dist/index.jsOr ~/.codex/config.toml:
[mcp_servers.dendrite-admin]
command = "node"
args = ["<repo>/dist/index.js"]
enabled = true
[mcp_servers.dendrite-admin.env]
DENDRITE_BASE_URL = "https://matrix.example.com"
DENDRITE_ADMIN_TOKEN = "<admin-token>"opencode
Add to opencode.json (or opencode.jsonc):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"dendrite-admin": {
"type": "local",
"command": ["node", "<repo>/dist/index.js"],
"environment": {
"DENDRITE_BASE_URL": "https://matrix.example.com",
"DENDRITE_ADMIN_TOKEN": "<admin-token>"
},
"enabled": true
}
}
}Or: opencode mcp add dendrite-admin -- node <repo>/dist/index.js
(opencode v2 nests servers under mcp.servers).
GitHub Copilot
copilot mcp add dendrite-admin \
--env DENDRITE_BASE_URL=https://matrix.example.com \
--env DENDRITE_ADMIN_TOKEN=<admin-token> \
-- node <repo>/dist/index.jsOr ~/.copilot/mcp-config.json:
{
"mcpServers": {
"dendrite-admin": {
"type": "local",
"command": "node",
"args": ["<repo>/dist/index.js"],
"env": {
"DENDRITE_BASE_URL": "https://matrix.example.com",
"DENDRITE_ADMIN_TOKEN": "<admin-token>"
},
"tools": ["*"]
}
}
}(VS Code uses .vscode/mcp.json with a servers key instead — see the
VS Code docs.)
Pi
~/.pi/agent/mcp.json (global) or .mcp.json in a trusted project:
{
"mcpServers": {
"dendrite-admin": {
"command": "node",
"args": ["<repo>/dist/index.js"],
"env": {
"DENDRITE_BASE_URL": "https://matrix.example.com",
"DENDRITE_ADMIN_TOKEN": "<admin-token>"
}
}
}
}Verify
After registering, ask your agent to list tools — you should see the 15 tools
below. Or run the suite directly: npm test.
Configuration
Env var | Required | Purpose |
| yes | Base URL of the homeserver's client-facing port, e.g. |
| yes | Access token of a Dendrite server admin user; sent as a Bearer token to all |
| no |
|
| no |
|
| http only | Bearer token gating |
| http only | Bind address (default |
Transports
This server supports two MCP transports, selected via MCP_TRANSPORT:
stdio(default) — for a client that spawns this process directly (e.g. a local Claude Code / editor MCP config). No network exposure.http— runs a stateless Streamable HTTP MCP server onMCP_HTTP_HOST:MCP_HTTP_PORT(default0.0.0.0:3939), for remote clients over LAN/Tailscale. RequiresMCP_AUTH_TOKEN; every request to/mcpmust sendAuthorization: Bearer <token>.
Running
npm run build && npm startFor local development with auto-reload:
npm run devTo poke at the tools interactively (stdio transport):
npm run inspectorRunning with Docker
cp .env.example .env # fill in DENDRITE_BASE_URL, DENDRITE_ADMIN_TOKEN,
# set MCP_TRANSPORT=http and MCP_AUTH_TOKEN
docker compose up -d --buildThis builds the image, starts the container with restart: unless-stopped, and publishes port 3939. A /healthz endpoint (no auth required) backs the container healthcheck.
Tools
Full API reference (params, request bodies, curl examples): see API.md.
Tool | Dendrite endpoint |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
purge_room and evacuate_* are irreversible/disruptive — see CLAUDE.md for guidance on when an agent should confirm before calling them.
Connecting a remote client (HTTP transport)
Once deployed with MCP_TRANSPORT=http, point a client at http://<host>:3939/mcp with
an Authorization: Bearer <MCP_AUTH_TOKEN> header. <host> can be a LAN IP or a
Tailscale IP/MagicDNS name — whichever the client can reach.
Claude Code:
claude mcp add --transport http dendrite-admin --scope user \
http://<host>:3939/mcp \
--header "Authorization: Bearer <MCP_AUTH_TOKEN>"opencode (~/.config/opencode/opencode.jsonc for a user-wide server):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"dendrite-admin": {
"type": "remote",
"url": "http://<host>:3939/mcp",
"headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" }
}
}
}Codex CLI (~/.codex/config.toml):
[mcp_servers.dendrite-admin]
url = "http://<host>:3939/mcp"
bearer_token_env_var = "DENDRITE_ADMIN_MCP_TOKEN"bearer_token_env_var names an environment variable Codex reads at startup —
export it in your shell profile, e.g. export DENDRITE_ADMIN_MCP_TOKEN=<MCP_AUTH_TOKEN>.
Development
npm test # node:test suite (30 tests)
npm run typecheck # tsc --noEmit (src + tests)
npm run build # tsc -> dist/Available Tools
15 toolscreate_registration_tokenCreate a registration tokenA
Create a new registration token that can be used to gate new-account registration. Omit 'token' to have Dendrite generate a random one.
Inputs: token, length, expiryTime, usesAllowed.
delete_registration_tokenDelete a registration tokenB
Permanently delete a registration token.
Inputs: token (required).
download_room_stateDownload room state from a remote serverA
Fetch and return the room state for a given room as seen by a specific federated server. Useful for debugging state resolution and federation issues.
Inputs: roomId (required), serverName (required).
evacuate_roomEvacuate roomA
Part all local users from a room. Useful when a room is stuck and needs every local member removed at once.
Inputs: roomId (required).
evacuate_userEvacuate userA
Part a local user from every room they are currently joined to.
Inputs: userId (required).
fulltext_reindexReindex full-text searchA
Trigger a reindex of all searchable events (m.room.message, m.room.topic, m.room.name). Can be expensive on large homeservers.
Inputs: no named parameters.
get_registration_tokenGet a registration tokenB
Fetch details of a single registration token.
Inputs: token (required).
list_registration_tokensList registration tokensA
List registration tokens, optionally filtered by whether they are still valid.
Inputs: valid.
purge_roomPurge roomA
Remove a room and all its events from Dendrite's database. Does not delete associated media. Irreversible.
Inputs: roomId (required).
refresh_devicesRefresh a user's devicesA
Immediately query a federated user's /devices endpoint, refreshing Dendrite's cached device/cross-signing keys. Useful for resolving encryption issues with remote users.
Inputs: userId (required).
register_userRegister a new user via shared-secret registrationA
Create a new local account using Dendrite's shared-secret registration flow (registration_shared_secret in dendrite.yaml). Requires DENDRITE_REGISTRATION_SHARED_SECRET to be configured; does not use the admin bearer token.
Inputs: password (required), username (required), admin, displayname.
reset_passwordReset a user's passwordA
Set a new password for a local user, optionally invalidating all of their existing access tokens.
Inputs: userId (required), password (required), logoutDevices.
send_server_noticeSend a server noticeA
Send a server notice (an m.text message from the server) to a specific local user. Requires server notices to be configured in dendrite.yaml.
Inputs: body (required), userId (required).
update_registration_tokenUpdate a registration tokenB
Modify the usage limit, expiry time, or validity of an existing registration token.
Inputs: token (required), pending, completed, expiryTime, +1 more.
whoisLook up a user's sessionsA
Retrieve connection/session information Dendrite holds about a given user.
Inputs: userId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a specific administrative action: registration tokens have clear CRUD separation (list/get/create/update/delete), while room operations (evacuate, purge, download state) and user operations (register, reset password, whois) are distinct. Even similar-sounding tools like evacuate_room and evacuate_user are clearly differentiated by their target resource.
Most tools follow a consistent verb_noun pattern (list_registration_tokens, create_registration_token, reset_password, etc.). Minor deviations include 'whois' (a single word) and 'fulltext_reindex' (which could be interpreted as reindex_fulltext), but these are still understandable and do not create confusion.
With 15 tools, the set is well-scoped for a Matrix homeserver admin tool. Each tool addresses a distinct administrative need (token management, user admin, room admin, server maintenance) and none feel redundant. The count is at the upper boundary but remains justified.
The tool set covers registration token CRUD, core user operations (create, reset password, whois), and room management (evacuate, purge, download state), but notable gaps exist: there is no user deletion/deactivation, no list users tool, and no general room listing/search. Agents cannot perform the full lifecycle for users or rooms.
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Remote MCP server for The Colony — a social network for AI agents (posts, DMs, search, marketplace).
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server that exposes 300+ AI agents as tools via a single API key. Supports listing agents, invoking any agent with chat-completion style messages, checking agent health, and retrieving platform statistics.54MIT
- FlicenseAqualityDmaintenanceMCP server that connects LLM agents to a local LM Studio instance, enabling model management, OpenAI-compatible chat completions, text completions, and embeddings through a set of tools.91-
- AlicenseAqualityDmaintenanceAn MCP server exposing 72 tools across 26 homelab services, enabling LLMs to monitor and manage infrastructure, media, storage, and networking with a single endpoint.16MIT
- AlicenseAqualityBmaintenanceMCP server for the LiteLLM proxy, enabling agents to administer resources like keys, teams, users, models, and proxy settings through risk-graded meta-tools.6MIT