A comprehensive Matrix deployment with Letta AI bot integration and MCP (Model Context Protocol) server support.
THIS DEPLOYMENT USES TUWUNEL AS THE MATRIX HOMESERVER, NOT SYNAPSE!
- Homeserver: Tuwunel (lightweight embedded Matrix server)
- NO PostgreSQL: Tuwunel uses RocksDB (embedded database)
- NO Synapse Admin APIs: Standard Synapse admin endpoints DO NOT work
- Admin Tools: Use Matrix client APIs or Tuwunel-specific tools only
Common Mistakes to Avoid:
- ❌ Trying to use
/_synapse/admin/v1/*endpoints (they don't exist) - ❌ Looking for PostgreSQL database or connection strings
- ❌ Following Synapse-specific documentation
- ✅ Use Matrix client API (
/_matrix/client/v3/*) instead - ✅ Remember: Tuwunel is a different server implementation!
See TUWUNEL_MIGRATION.md for full details.
- Stable Agent Usernames: Matrix usernames are now based on agent IDs instead of agent names, ensuring stability even when agents are renamed
- Fixed Session Management: Resolved session scope issues in invitation handling
- Improved Agent Sync: All agent rooms are properly monitored and agents respond with their own Matrix identities
A complete, self-contained Matrix deployment with Element web client and Matrix bot integration.
-
Prerequisites: Docker and Docker Compose installed on your system
-
Deploy: Simply run:
docker-compose up -d
-
Access:
- Element Web Client: http://localhost:8008
- Matrix Server: http://localhost:8008/_matrix/
- Tuwunel: Lightweight Matrix homeserver (NOT Synapse!)
- RocksDB: Embedded database (NO PostgreSQL)
- Element Web: Modern Matrix web client
- Nginx: Reverse proxy for routing
- Matrix Client: Custom bot integration with Letta agents
- MCP Server: Model Context Protocol server for tool integration
- Letta Agent MCP: Letta-specific MCP tools and agent management
The deployment is pre-configured with sensible defaults in .env. Key settings:
- Server Name:
matrix.oculair.ca(change this to your domain) - Database: RocksDB embedded in Tuwunel (NO separate database service)
- Ports: Exposed on port 8008 (via nginx proxy)
- Registration: Enabled without verification for easy setup
- Tuwunel Data: Stored in
./tuwunel-data/directory
Edit .env and update:
SYNAPSE_SERVER_NAME=your-domain.com
Also update nginx_matrix_proxy.conf:
server_name your-domain.com;
All data is stored in local directories:
./tuwunel-data/: Tuwunel's RocksDB database (ALL homeserver data)./synapse-data/: Legacy configuration files (registration configs for bridges)./matrix_store/: Matrix client session data./matrix_client_data/: Agent mappings and space configuration
- Default passwords are set for development/testing
- Change all passwords in
.envfor production use - Configure proper SSL/TLS termination for production
- Review and adjust registration settings as needed
The system automatically generates configuration files on first run. This may take a few minutes.
View service logs:
docker-compose logs synapse
docker-compose logs db
docker-compose logs nginxIf user registration fails, ensure enable_registration_without_verification: true is set in the generated synapse-data/homeserver.yaml.
- synapse: Matrix homeserver (port 8008)
- db: PostgreSQL database
- element: Element web client
- nginx: Reverse proxy
- matrix-client: Custom Matrix bot (optional)
Stop services:
docker-compose downRemove all data (destructive):
docker-compose down -v
rm -rf synapse-data postgres-data matrix_storedocker-compose.yml- Service definitions.env- Configuration variablessynapse_entrypoint.sh- Synapse initialization scriptnginx_matrix_proxy.conf- Nginx routing configurationelement-config.json- Element web client configDockerfile.matrix-client- Matrix bot containerrequirements.txt- Python dependenciescustom_matrix_client.py- Matrix bot implementationmatrix_auth.py- Authentication utilities