morpheus-cli 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,493 +1,942 @@
1
- <div align="center">
2
- <img src="./assets/logo.png" alt="Morpheus Logo" width="220" />
3
- </div>
4
-
5
- # Morpheus
6
-
7
- > **Morpheus is a local-first AI operator that bridges developers and machines.**
8
-
9
- Morpheus is a local AI agent for developers, running as a CLI daemon that connects to **LLMs**, **local tools**, and **MCPs**, enabling interaction via **Terminal, Telegram, and Discord**. Inspired by the character Morpheus from *The Matrix*, the project acts as an **intelligent orchestrator**, bridging the gap between the developer and complex systems.
10
-
11
- ## Installation
12
-
13
- Install Morpheus globally via npm:
14
-
15
- ```bash
16
- npm install -g morpheus-cli
17
- ```
18
-
19
- ## Quick Start
20
-
21
- ### 1. Initialize
22
-
23
- Set up your configuration (API keys, preferences):
24
-
25
- ```bash
26
- morpheus init
27
- ```
28
-
29
- ### 2. Start the Agent
30
-
31
- Run the background daemon and Web UI:
32
-
33
- ```bash
34
- morpheus start
35
- ```
36
-
37
- This will:
38
- - Start the agent process
39
- - Launch the Web UI at http://localhost:3333
40
-
41
- ### Other Commands
42
-
43
- ```bash
44
- # Check if Morpheus is running
45
- morpheus status
46
-
47
- # Stop the agent
48
- morpheus stop
49
-
50
- # Diagnose issues
51
- morpheus doctor
52
- ```
53
-
54
- ## Troubleshooting
55
-
56
- ### Command not found
57
-
58
- If you installed successfully but can't run the `morpheus` command:
59
-
60
- 1. **Check your PATH**: Ensure your global npm bin directory is in your system PATH.
61
- - Run `npm bin -g` to see the folder.
62
- - On Windows, this is usually `%APPDATA%\npm`.
63
- - On Linux/Mac, verify `echo $PATH`.
64
- 2. **Restart Terminal**: New installations might not be visible until you restart your shell.
65
-
66
- ## Using NPX
67
- You can run Morpheus without installing it globally using `npx`:
68
-
69
- ```bash
70
-
71
- npx morpheus-cli init
72
-
73
- npx morpheus-cli start
74
-
75
- ```
76
-
77
- ## Technical Overview
78
-
79
- Morpheus is built with **Node.js** and **TypeScript**, using **LangChain** as the orchestration engine. It runs as a background daemon process, managing connections to LLM providers (OpenAI, Anthropic, Ollama) and external channels (Telegram, Discord).
80
-
81
- ### Core Components
82
-
83
- - **Runtime (`src/runtime/`)**: The heart of the application. Manages the Oracle (agent) lifecycle, provider instantiation, and command execution.
84
- - **CLI (`src/cli/`)**: Built with `commander`, handles user interaction, configuration, and daemon control (`start`, `stop`, `status`).
85
- - **Configuration (`src/config/`)**: Singleton-based configuration manager using `zod` for validation and `js-yaml` for persistence (`~/.morpheus/zaion.yaml`).
86
- - **Channels (`src/channels/`)**: Adapters for external communication. Currently supports Telegram (`telegraf`) with strict user whitelisting.
87
-
88
- ## Features
89
-
90
- ### 🖥️ Web Dashboard
91
- Local React-based UI to manage recordings, chat history, and system status across your agent instances.
92
-
93
- #### 🔒 UI Authentication
94
- To protect your Web UI, use the `THE_ARCHITECT_PASS` environment variable. This ensures only authorized users can access the dashboard and API.
95
-
96
- Additionally, you can use environment variables for API keys instead of storing them in the configuration file:
97
-
98
- | Variable | Description | Required |
99
- |----------|-------------|----------|
100
- | `OPENAI_API_KEY` | OpenAI API key (if using GPT) | No |
101
- | `ANTHROPIC_API_KEY` | Anthropic API key (if using Claude) | No |
102
- | `GOOGLE_API_KEY` | Google AI key (for Gemini and Audio) | Yes (for audio) |
103
- | `OPENROUTER_API_KEY` | OpenRouter API key (if using OpenRouter) | No |
104
- | `THE_ARCHITECT_PASS` | Web Dashboard access password | Recommended |
105
- | `TELEGRAM_BOT_TOKEN` | Telegram BotFather token | No |
106
-
107
- If these environment variables are set, they will take precedence over values stored in the configuration file.
108
-
109
- The system also supports generic environment variables that apply to all providers:
110
-
111
- | Variable | Description | Applies To |
112
- |----------|-------------|------------|
113
- | `MORPHEUS_AGENT_NAME` | Name of the agent | agent.name |
114
- | `MORPHEUS_AGENT_PERSONALITY` | Personality of the agent | agent.personality |
115
- | `MORPHEUS_LLM_PROVIDER` | LLM provider to use | llm.provider |
116
- | `MORPHEUS_LLM_MODEL` | Model name for LLM | llm.model |
117
- | `MORPHEUS_LLM_TEMPERATURE` | Temperature setting for LLM | llm.temperature |
118
- | `MORPHEUS_LLM_MAX_TOKENS` | Maximum tokens for LLM | llm.max_tokens |
119
- | `MORPHEUS_LLM_CONTEXT_WINDOW` | Context window size for LLM | llm.context_window |
120
- | `MORPHEUS_LLM_API_KEY` | Generic API key for LLM (lower precedence than provider-specific keys) | llm.api_key |
121
- | `MORPHEUS_SANTI_PROVIDER` | Sati provider to use | santi.provider |
122
- | `MORPHEUS_SANTI_MODEL` | Model name for Sati | santi.model |
123
- | `MORPHEUS_SANTI_TEMPERATURE` | Temperature setting for Sati | santi.temperature |
124
- | `MORPHEUS_SANTI_MAX_TOKENS` | Maximum tokens for Sati | santi.max_tokens |
125
- | `MORPHEUS_SANTI_CONTEXT_WINDOW` | Context window size for Sati | santi.context_window |
126
- | `MORPHEUS_SANTI_API_KEY` | Generic API key for Sati (lower precedence than provider-specific keys) | santi.api_key |
127
- | `MORPHEUS_SANTI_MEMORY_LIMIT` | Memory retrieval limit for Sati | santi.memory_limit |
128
- | `MORPHEUS_AUDIO_MODEL` | Model name for audio processing | audio.model |
129
- | `MORPHEUS_AUDIO_ENABLED` | Enable/disable audio processing | audio.enabled |
130
- | `MORPHEUS_AUDIO_API_KEY` | Generic API key for audio (lower precedence than provider-specific keys) | audio.apiKey |
131
- | `MORPHEUS_AUDIO_MAX_DURATION` | Max duration for audio processing | audio.maxDurationSeconds |
132
- | `MORPHEUS_TELEGRAM_ENABLED` | Enable/disable Telegram channel | channels.telegram.enabled |
133
- | `MORPHEUS_TELEGRAM_TOKEN` | Telegram bot token | channels.telegram.token |
134
- | `MORPHEUS_TELEGRAM_ALLOWED_USERS` | Comma-separated list of allowed Telegram user IDs | channels.telegram.allowedUsers |
135
- | `MORPHEUS_UI_ENABLED` | Enable/disable Web UI | ui.enabled |
136
- | `MORPHEUS_UI_PORT` | Port for Web UI | ui.port |
137
- | `MORPHEUS_LOGGING_ENABLED` | Enable/disable logging | logging.enabled |
138
- | `MORPHEUS_LOGGING_LEVEL` | Logging level | logging.level |
139
- | `MORPHEUS_LOGGING_RETENTION` | Log retention period | logging.retention |
140
-
141
- **Precedence Order**: The system follows this order of precedence when resolving configuration values:
142
- 1. Provider-specific environment variable (e.g., `OPENAI_API_KEY`) - Highest priority
143
- 2. Generic environment variable (e.g., `MORPHEUS_LLM_API_KEY`) - Medium priority
144
- 3. Configuration file value (e.g., `config.llm.api_key`) - Lower priority
145
- 4. Default value - Lowest priority
146
-
147
- > **Note**: If `THE_ARCHITECT_PASS` is not set, the system will use the default password `iamthearchitect`. This is less secure and it's recommended to set your own password in production environments.
148
-
149
- **Option 1: Using a `.env` file**
150
- Create a `.env` file in the root of your project:
151
-
152
- ```env
153
- OPENAI_API_KEY="your-openai-api-key"
154
- ANTHROPIC_API_KEY="your-anthropic-api-key"
155
- GOOGLE_API_KEY="your-google-api-key"
156
- THE_ARCHITECT_PASS="your-secure-password"
157
- TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
158
- OPENROUTER_API_KEY="your-openrouter-api-key"
159
- ```
160
-
161
- **Option 2: Using Shell export**
162
-
163
- ```bash
164
- export OPENAI_API_KEY="your-openai-api-key"
165
- export ANTHROPIC_API_KEY="your-anthropic-api-key"
166
- export GOOGLE_API_KEY="your-google-api-key"
167
- export OPENROUTER_API_KEY="your-openrouter-api-key"
168
- export THE_ARCHITECT_PASS="your-secure-password"
169
- export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
170
- morpheus start
171
- ```
172
-
173
- When enabled:
174
- - The Web UI will redirect to a Login page.
175
- - API requests require the `x-architect-pass` header.
176
- - The session is persisted locally in your browser.
177
-
178
- ### 🧩 MCP Support (Model Context Protocol)
179
- Full integration with [Model Context Protocol](https://modelcontextprotocol.io/), allowing Morpheus to use standardized tools from any MCP-compatible server.
180
-
181
- ### 🧠 Sati (Long-Term Memory)
182
- Morpheus features a dedicated middleware system called **Sati** (Mindfulness) that provides long-term memory capabilities.
183
- - **Automated Storage**: Automatically extracts and saves preferences, project details, and facts from conversations.
184
- - **Contextual Retrieval**: Injects relevant memories into the context based on your current query.
185
- - **Data Privacy**: Stored in a local, independent SQLite database (`santi-memory.db`), ensuring sensitive data is handled securely and reducing context window usage.
186
- - **Memory Management**: View and manage your long-term memories through the Web UI or via API endpoints.
187
-
188
- ### 📊 Usage Analytics
189
- Track your token usage across different providers and models directly from the Web UI. View detailed breakdowns of input/output tokens and message counts to monitor costs and activity.
190
-
191
- ### 🎙️ Audio Transcription (Telegram)
192
- Send voice messages directly to the Telegram bot. Morpheus will:
193
- 1. Transcribe the audio using **Google Gemini**.
194
- 2. Process the text as a standard prompt.
195
- 3. Reply with the answer.
196
-
197
- *Requires a Google Gemini API Key.*
198
-
199
- ## Development Setup
200
-
201
- This guide is for developers contributing to the Morpheus codebase.
202
-
203
- ### Prerequisites
204
-
205
- - **Node.js**: >= 18.x
206
- - **npm**: >= 9.x
207
- - **TypeScript**: >= 5.x
208
-
209
- ### 1. Clone & Install
210
-
211
- ```bash
212
- git clone https://github.com/your-org/morpheus.git
213
- cd morpheus
214
- npm install
215
- ```
216
-
217
- ### 2. Build
218
-
219
- Compile TypeScript source to `dist/` and build the Web UI.
220
-
221
- ```bash
222
- npm run build
223
- ```
224
-
225
- ### 3. Run the CLI
226
-
227
- You can run the CLI directly from the source using `npm start`.
228
-
229
- ```bash
230
- # Initialize configuration (creates ~/.morpheus)
231
- npm start -- init
232
-
233
- # Start the daemon
234
- npm start -- start
235
-
236
- # Check status
237
- npm start -- status
238
- ```
239
-
240
- ### 4. Configuration
241
-
242
- The configuration file is located at `~/.morpheus/zaion.yaml`. You can edit it manually or use the `morpheus config` command.
243
-
244
- ```yaml
245
- agent:
246
- name: "Morpheus"
247
- personality: "stoic, wise, and helpful"
248
- llm:
249
- provider: "openai" # options: openai, anthropic, ollama, gemini
250
- model: "gpt-4-turbo"
251
- temperature: 0.7
252
- context_window: 100 # Number of messages to load into LLM context
253
- api_key: "sk-..."
254
- santi: # Optional: Sati (Long-Term Memory) specific settings
255
- provider: "openai" # defaults to llm.provider
256
- model: "gpt-4o"
257
- memory_limit: 1000 # Number of messages/items to retrieve
258
- channels:
259
- telegram:
260
- enabled: true
261
- token: "YOUR_TELEGRAM_BOT_TOKEN"
262
- allowedUsers: ["123456789"] # Your Telegram User ID
263
- discord:
264
- enabled: false # Coming soon
265
-
266
- # Web UI Dashboard
267
- ui:
268
- enabled: true
269
- port: 3333
270
-
271
- # Audio Transcription Support
272
- audio:
273
- enabled: true
274
- apiKey: "YOUR_GEMINI_API_KEY" # Optional if llm.provider is 'gemini'
275
- maxDurationSeconds: 300
276
- ```
277
-
278
- ### 5. MCP Configuration
279
-
280
- Morpheus supports external tools via **MCP (Model Context Protocol)**. Configure your MCP servers in `~/.morpheus/mcps.json`:
281
-
282
- ```json
283
- {
284
- "coolify": {
285
- "transport": "stdio",
286
- "command": "npx",
287
- "args": ["-y", "@coolify/mcp-server"],
288
- "env": {
289
- "COOLIFY_URL": "https://app.coolify.io",
290
- "COOLIFY_TOKEN": "your-token"
291
- }
292
- },
293
- "coingecko": {
294
- "transport": "http",
295
- "url": "https://mcps.mnunes.xyz/coingecko/mcp"
296
- }
297
- }
298
- ```
299
-
300
- ## API Endpoints
301
-
302
- Morpheus exposes several API endpoints for programmatic access to its features:
303
-
304
- ### Sati Memories Endpoints
305
-
306
- #### GET `/api/sati/memories`
307
- Retrieve all memories stored by the Sati agent (long-term memory).
308
-
309
- * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
310
- * **Response:**
311
- ```json
312
- [
313
- {
314
- "id": "unique-id",
315
- "category": "work",
316
- "importance": "high",
317
- "summary": "Memory summary",
318
- "details": "Additional details of the memory",
319
- "hash": "unique-hash",
320
- "source": "source",
321
- "created_at": "2023-01-01T00:00:00.000Z",
322
- "updated_at": "2023-01-01T00:00:00.000Z",
323
- "last_accessed_at": "2023-01-01T00:00:00.000Z",
324
- "access_count": 5,
325
- "version": 1,
326
- "archived": false
327
- }
328
- ]
329
- ```
330
-
331
- #### DELETE `/api/sati/memories/:id`
332
- Archive (soft delete) a specific memory from the Sati agent.
333
-
334
- * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
335
- * **Parameters:** `id` - ID of the memory to archive.
336
- * **Response:**
337
- ```json
338
- {
339
- "success": true,
340
- "message": "Memory archived successfully"
341
- }
342
- ```
343
-
344
- #### POST `/api/sati/memories/bulk-delete`
345
- Archive (soft delete) multiple memories from the Sati agent at once.
346
-
347
- * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
348
- * **Body:**
349
- ```json
350
- {
351
- "ids": ["id1", "id2", "id3"]
352
- }
353
- ```
354
- * **Response:**
355
- ```json
356
- {
357
- "success": true,
358
- "message": "X memories archived successfully",
359
- "deletedCount": X
360
- }
361
- ```
362
-
363
- ## Testing
364
-
365
- We use **Vitest** for testing.
366
-
367
- ```bash
368
- # Run unit tests
369
- npm test
370
-
371
- # Run tests in watch mode
372
- npm run test:watch
373
- ```
374
-
375
- ## Project Structure
376
-
377
- ```text
378
- .
379
- ├── assets/ # Static assets
380
- ├── bin/ # CLI entry point (morpheus.js)
381
- ├── specs/ # Technical specifications & documentation
382
- ├── src/
383
- │ ├── channels/ # Communication adapters (Telegram, etc.)
384
- │ ├── cli/ # CLI commands and logic
385
- │ ├── config/ # Configuration management
386
- │ ├── runtime/ # Core agent logic, lifecycle, and providers
387
- │ ├── types/ # Shared TypeScript definitions
388
- │ └── ui/ # React Web UI Dashboard
389
- └── package.json
390
- ```
391
-
392
- ## Roadmap
393
-
394
- - [x] **Web Dashboard**: Local UI for management and logs.
395
- - [x] **MCP Support**: Full integration with Model Context Protocol.
396
- - [ ] **Discord Adapter**: Support for Discord interactions.
397
- - [ ] **Plugin System**: Extend functionality via external modules.
398
-
399
- ## 🕵️ Privacy Protection
400
-
401
- The Web UI includes privacy protection headers to prevent indexing by search engines:
402
- - HTML meta tags: `<meta name="robots" content="noindex, nofollow">`
403
- - HTTP header: `X-Robots-Tag: noindex, nofollow`
404
-
405
- This ensures that your private agent dashboard remains private and is not discoverable by search engines.
406
-
407
- ## 🐳 Running with Docker
408
-
409
- Morpheus can be easily deployed using Docker and Docker Compose. The container supports all environment variables for configuration.
410
-
411
- ### Prerequisites
412
-
413
- - Docker Engine
414
- - Docker Compose
415
-
416
- ### Quick Start
417
-
418
- 1. Create a `.env` file with your configuration:
419
-
420
- ```bash
421
- cp .env.example .env
422
- # Edit .env with your actual API keys and settings
423
- ```
424
-
425
- 2. Build and start the container:
426
-
427
- ```bash
428
- docker-compose up -d
429
- ```
430
-
431
- 3. Access the Web UI at `http://localhost:3333`
432
-
433
- ### Using Docker Directly
434
-
435
- ```bash
436
- # Build the image
437
- docker build -t morpheus .
438
-
439
- # Run with environment variables
440
- docker run -d \
441
- --name morpheus-agent \
442
- -p 3333:3333 \
443
- -v morpheus_data:/root/.morpheus \
444
- -e MORPHEUS_LLM_PROVIDER=openai \
445
- -e OPENAI_API_KEY=your-api-key-here \
446
- -e THE_ARCHITECT_PASS=your-password \
447
- morpheus
448
- ```
449
-
450
- ### Environment Variables in Docker
451
-
452
- All environment variables described above work in Docker. The precedence order remains the same:
453
- 1. Container environment variables
454
- 2. Configuration file values
455
- 3. Default values
456
-
457
- ### Persistent Data
458
-
459
- The container stores configuration and data in `/root/.morpheus`. Mount a volume to persist data between container restarts:
460
-
461
- ```yaml
462
- volumes:
463
- - morpheus_data:/root/.morpheus # Recommended for persistence
464
- ```
465
-
466
- ### Health Check
467
-
468
- The container includes a health check that verifies the health endpoint is accessible. The application exposes a public `/health` endpoint that doesn't require authentication:
469
-
470
- ```bash
471
- curl http://localhost:3333/health
472
- ```
473
-
474
- Response:
475
- ```json
476
- {
477
- "status": "healthy",
478
- "timestamp": "2026-02-05T21:30:00.000Z",
479
- "uptime": 123.45
480
- }
481
- ```
482
-
483
- ## Contributing
484
-
485
- 1. Fork the repository.
486
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`).
487
- 3. Commit your changes (`git commit -m 'feat: Add amazing feature'`).
488
- 4. Push to the branch (`git push origin feature/amazing-feature`).
489
- 5. Open a Pull Request.
490
-
491
- ## License
492
-
493
- MIT
1
+ <div align="center">
2
+ <img src="./assets/logo.png" alt="Morpheus Logo" width="220" />
3
+ </div>
4
+
5
+ # Morpheus
6
+
7
+ > **Morpheus is a local-first AI operator that bridges developers and machines.**
8
+
9
+ Morpheus is a local AI agent for developers, running as a CLI daemon that connects to **LLMs**, **local tools**, and **MCPs**, enabling interaction via **Terminal, Telegram, and Discord**. Inspired by the character Morpheus from *The Matrix*, the project acts as an **intelligent orchestrator**, bridging the gap between the developer and complex systems.
10
+
11
+ ## Installation
12
+
13
+ Install Morpheus globally via npm:
14
+
15
+ ```bash
16
+ npm install -g morpheus-cli
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### 1. Initialize
22
+
23
+ Set up your configuration (API keys, preferences):
24
+
25
+ ```bash
26
+ morpheus init
27
+ ```
28
+
29
+ ### 2. Start the Agent
30
+
31
+ Run the background daemon and Web UI:
32
+
33
+ ```bash
34
+ morpheus start
35
+ ```
36
+
37
+ This will:
38
+ - Start the agent process
39
+ - Launch the Web UI at http://localhost:3333
40
+
41
+ ### Other Commands
42
+
43
+ ```bash
44
+ # Check if Morpheus is running
45
+ morpheus status
46
+
47
+ # Stop the agent
48
+ morpheus stop
49
+
50
+ # Restart the agent
51
+ morpheus restart
52
+
53
+ # Diagnose issues
54
+ morpheus doctor
55
+ ```
56
+
57
+ ## Troubleshooting
58
+
59
+ ### Command not found
60
+
61
+ If you installed successfully but can't run the `morpheus` command:
62
+
63
+ 1. **Check your PATH**: Ensure your global npm bin directory is in your system PATH.
64
+ - Run `npm bin -g` to see the folder.
65
+ - On Windows, this is usually `%APPDATA%\npm`.
66
+ - On Linux/Mac, verify `echo $PATH`.
67
+ 2. **Restart Terminal**: New installations might not be visible until you restart your shell.
68
+
69
+ ## Using NPX
70
+ You can run Morpheus without installing it globally using `npx`:
71
+
72
+ ```bash
73
+
74
+ npx morpheus-cli init
75
+
76
+ npx morpheus-cli start
77
+
78
+ ```
79
+
80
+ ## Technical Overview
81
+
82
+ Morpheus is built with **Node.js** and **TypeScript**, using **LangChain** as the orchestration engine. It runs as a background daemon process, managing connections to LLM providers (OpenAI, Anthropic, Ollama) and external channels (Telegram, Discord).
83
+
84
+ ### Core Components
85
+
86
+ - **Runtime (`src/runtime/`)**: The heart of the application. Manages the Oracle (agent) lifecycle, provider instantiation, and command execution.
87
+ - **CLI (`src/cli/`)**: Built with `commander`, handles user interaction, configuration, and daemon control (`start`, `stop`, `status`).
88
+ - **Configuration (`src/config/`)**: Singleton-based configuration manager using `zod` for validation and `js-yaml` for persistence (`~/.morpheus/zaion.yaml`).
89
+ - **Channels (`src/channels/`)**: Adapters for external communication. Currently supports Telegram (`telegraf`) with strict user whitelisting.
90
+
91
+ ## Features
92
+
93
+ ### 🖥️ Web Dashboard
94
+ Local React-based UI to manage recordings, chat history, and system status across your agent instances.
95
+
96
+ #### 🔒 UI Authentication
97
+ To protect your Web UI, use the `THE_ARCHITECT_PASS` environment variable. This ensures only authorized users can access the dashboard and API.
98
+
99
+ Additionally, you can use environment variables for API keys instead of storing them in the configuration file:
100
+
101
+ | Variable | Description | Required |
102
+ |----------|-------------|----------|
103
+ | `OPENAI_API_KEY` | OpenAI API key (if using GPT) | No |
104
+ | `ANTHROPIC_API_KEY` | Anthropic API key (if using Claude) | No |
105
+ | `GOOGLE_API_KEY` | Google AI key (for Gemini and Audio) | Yes (for audio) |
106
+ | `OPENROUTER_API_KEY` | OpenRouter API key (if using OpenRouter) | No |
107
+ | `THE_ARCHITECT_PASS` | Web Dashboard access password | Recommended |
108
+ | `TELEGRAM_BOT_TOKEN` | Telegram BotFather token | No |
109
+
110
+ If these environment variables are set, they will take precedence over values stored in the configuration file.
111
+
112
+ The system also supports generic environment variables that apply to all providers:
113
+
114
+ | Variable | Description | Applies To |
115
+ |----------|-------------|------------|
116
+ | `MORPHEUS_AGENT_NAME` | Name of the agent | agent.name |
117
+ | `MORPHEUS_AGENT_PERSONALITY` | Personality of the agent | agent.personality |
118
+ | `MORPHEUS_LLM_PROVIDER` | LLM provider to use | llm.provider |
119
+ | `MORPHEUS_LLM_MODEL` | Model name for LLM | llm.model |
120
+ | `MORPHEUS_LLM_TEMPERATURE` | Temperature setting for LLM | llm.temperature |
121
+ | `MORPHEUS_LLM_MAX_TOKENS` | Maximum tokens for LLM | llm.max_tokens |
122
+ | `MORPHEUS_LLM_CONTEXT_WINDOW` | Context window size for LLM | llm.context_window |
123
+ | `MORPHEUS_LLM_API_KEY` | Generic API key for LLM (lower precedence than provider-specific keys) | llm.api_key |
124
+ | `MORPHEUS_SANTI_PROVIDER` | Sati provider to use | santi.provider |
125
+ | `MORPHEUS_SANTI_MODEL` | Model name for Sati | santi.model |
126
+ | `MORPHEUS_SANTI_TEMPERATURE` | Temperature setting for Sati | santi.temperature |
127
+ | `MORPHEUS_SANTI_MAX_TOKENS` | Maximum tokens for Sati | santi.max_tokens |
128
+ | `MORPHEUS_SANTI_CONTEXT_WINDOW` | Context window size for Sati | santi.context_window |
129
+ | `MORPHEUS_SANTI_API_KEY` | Generic API key for Sati (lower precedence than provider-specific keys) | santi.api_key |
130
+ | `MORPHEUS_SANTI_MEMORY_LIMIT` | Memory retrieval limit for Sati | santi.memory_limit |
131
+ | `MORPHEUS_AUDIO_MODEL` | Model name for audio processing | audio.model |
132
+ | `MORPHEUS_AUDIO_ENABLED` | Enable/disable audio processing | audio.enabled |
133
+ | `MORPHEUS_AUDIO_API_KEY` | Generic API key for audio (lower precedence than provider-specific keys) | audio.apiKey |
134
+ | `MORPHEUS_AUDIO_MAX_DURATION` | Max duration for audio processing | audio.maxDurationSeconds |
135
+ | `MORPHEUS_TELEGRAM_ENABLED` | Enable/disable Telegram channel | channels.telegram.enabled |
136
+ | `MORPHEUS_TELEGRAM_TOKEN` | Telegram bot token | channels.telegram.token |
137
+ | `MORPHEUS_TELEGRAM_ALLOWED_USERS` | Comma-separated list of allowed Telegram user IDs | channels.telegram.allowedUsers |
138
+ | `MORPHEUS_UI_ENABLED` | Enable/disable Web UI | ui.enabled |
139
+ | `MORPHEUS_UI_PORT` | Port for Web UI | ui.port |
140
+ | `MORPHEUS_LOGGING_ENABLED` | Enable/disable logging | logging.enabled |
141
+ | `MORPHEUS_LOGGING_LEVEL` | Logging level | logging.level |
142
+ | `MORPHEUS_LOGGING_RETENTION` | Log retention period | logging.retention |
143
+
144
+ **Precedence Order**: The system follows this order of precedence when resolving configuration values:
145
+ 1. Provider-specific environment variable (e.g., `OPENAI_API_KEY`) - Highest priority
146
+ 2. Generic environment variable (e.g., `MORPHEUS_LLM_API_KEY`) - Medium priority
147
+ 3. Configuration file value (e.g., `config.llm.api_key`) - Lower priority
148
+ 4. Default value - Lowest priority
149
+
150
+ > **Note**: If `THE_ARCHITECT_PASS` is not set, the system will use the default password `iamthearchitect`. This is less secure and it's recommended to set your own password in production environments.
151
+
152
+ **Option 1: Using a `.env` file**
153
+ Create a `.env` file in the root of your project:
154
+
155
+ ```env
156
+ OPENAI_API_KEY="your-openai-api-key"
157
+ ANTHROPIC_API_KEY="your-anthropic-api-key"
158
+ GOOGLE_API_KEY="your-google-api-key"
159
+ THE_ARCHITECT_PASS="your-secure-password"
160
+ TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
161
+ OPENROUTER_API_KEY="your-openrouter-api-key"
162
+ ```
163
+
164
+ **Option 2: Using Shell export**
165
+
166
+ ```bash
167
+ export OPENAI_API_KEY="your-openai-api-key"
168
+ export ANTHROPIC_API_KEY="your-anthropic-api-key"
169
+ export GOOGLE_API_KEY="your-google-api-key"
170
+ export OPENROUTER_API_KEY="your-openrouter-api-key"
171
+ export THE_ARCHITECT_PASS="your-secure-password"
172
+ export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
173
+ morpheus start
174
+ ```
175
+
176
+ When enabled:
177
+ - The Web UI will redirect to a Login page.
178
+ - API requests require the `x-architect-pass` header.
179
+ - The session is persisted locally in your browser.
180
+
181
+ ### 🧩 MCP Support (Model Context Protocol)
182
+ Full integration with [Model Context Protocol](https://modelcontextprotocol.io/), allowing Morpheus to use standardized tools from any MCP-compatible server.
183
+
184
+ ### 🧠 Sati (Long-Term Memory)
185
+ Morpheus features a dedicated middleware system called **Sati** (Mindfulness) that provides long-term memory capabilities.
186
+ - **Automated Storage**: Automatically extracts and saves preferences, project details, and facts from conversations.
187
+ - **Contextual Retrieval**: Injects relevant memories into the context based on your current query.
188
+ - **Data Privacy**: Stored in a local, independent SQLite database (`santi-memory.db`), ensuring sensitive data is handled securely and reducing context window usage.
189
+ - **Memory Management**: View and manage your long-term memories through the Web UI or via API endpoints.
190
+
191
+ ### 📊 Usage Analytics
192
+ Track your token usage across different providers and models directly from the Web UI. View detailed breakdowns of input/output tokens and message counts to monitor costs and activity.
193
+
194
+ ### 🎙️ Audio Transcription (Telegram)
195
+ Send voice messages directly to the Telegram bot. Morpheus will:
196
+ 1. Transcribe the audio using **Google Gemini**.
197
+ 2. Process the text as a standard prompt.
198
+ 3. Reply with the answer.
199
+
200
+ *Requires a Google Gemini API Key.*
201
+
202
+ ### 🤖 Telegram Commands
203
+ The Morpheus Telegram bot supports several commands for interacting with the agent:
204
+
205
+ - `/start` - Show welcome message and available commands
206
+ - `/status` - Check the status of the Morpheus agent
207
+ - `/doctor` - Diagnose environment and configuration issues
208
+ - `/stats` - Show token usage statistics
209
+ - `/help` - Show available commands
210
+ - `/zaion` - Show system configurations
211
+ - `/sati <qnt>` - Show specific memories
212
+ - `/restart` - Restart the Morpheus agent
213
+ - `/mcp` or `/mcps` - List registered MCP servers
214
+
215
+ ## Development Setup
216
+
217
+ This guide is for developers contributing to the Morpheus codebase.
218
+
219
+ ### Prerequisites
220
+
221
+ - **Node.js**: >= 18.x
222
+ - **npm**: >= 9.x
223
+ - **TypeScript**: >= 5.x
224
+
225
+ ### 1. Clone & Install
226
+
227
+ ```bash
228
+ git clone https://github.com/your-org/morpheus.git
229
+ cd morpheus
230
+ npm install
231
+ ```
232
+
233
+ ### 2. Build
234
+
235
+ Compile TypeScript source to `dist/` and build the Web UI.
236
+
237
+ ```bash
238
+ npm run build
239
+ ```
240
+
241
+ ### 3. Run the CLI
242
+
243
+ You can run the CLI directly from the source using `npm start`.
244
+
245
+ ```bash
246
+ # Initialize configuration (creates ~/.morpheus)
247
+ npm start -- init
248
+
249
+ # Start the daemon
250
+ npm start -- start
251
+
252
+ # Check status
253
+ npm start -- status
254
+ ```
255
+
256
+ ### 4. Configuration
257
+
258
+ The configuration file is located at `~/.morpheus/zaion.yaml`. You can edit it manually or use the `morpheus config` command.
259
+
260
+ ```yaml
261
+ agent:
262
+ name: "Morpheus"
263
+ personality: "stoic, wise, and helpful"
264
+ llm:
265
+ provider: "openai" # options: openai, anthropic, ollama, gemini
266
+ model: "gpt-4-turbo"
267
+ temperature: 0.7
268
+ context_window: 100 # Number of messages to load into LLM context
269
+ api_key: "sk-..."
270
+ santi: # Optional: Sati (Long-Term Memory) specific settings
271
+ provider: "openai" # defaults to llm.provider
272
+ model: "gpt-4o"
273
+ memory_limit: 1000 # Number of messages/items to retrieve
274
+ channels:
275
+ telegram:
276
+ enabled: true
277
+ token: "YOUR_TELEGRAM_BOT_TOKEN"
278
+ allowedUsers: ["123456789"] # Your Telegram User ID
279
+ discord:
280
+ enabled: false # Coming soon
281
+
282
+ # Web UI Dashboard
283
+ ui:
284
+ enabled: true
285
+ port: 3333
286
+
287
+ # Audio Transcription Support
288
+ audio:
289
+ enabled: true
290
+ apiKey: "YOUR_GEMINI_API_KEY" # Optional if llm.provider is 'gemini'
291
+ maxDurationSeconds: 300
292
+ ```
293
+
294
+ ### 5. MCP Configuration
295
+
296
+ Morpheus supports external tools via **MCP (Model Context Protocol)**. Configure your MCP servers in `~/.morpheus/mcps.json`:
297
+
298
+ ```json
299
+ {
300
+ "coolify": {
301
+ "transport": "stdio",
302
+ "command": "npx",
303
+ "args": ["-y", "@coolify/mcp-server"],
304
+ "env": {
305
+ "COOLIFY_URL": "https://app.coolify.io",
306
+ "COOLIFY_TOKEN": "your-token"
307
+ }
308
+ },
309
+ "coingecko": {
310
+ "transport": "http",
311
+ "url": "https://mcps.mnunes.xyz/coingecko/mcp"
312
+ }
313
+ }
314
+ ```
315
+
316
+ ## API Endpoints
317
+
318
+ Morpheus exposes several API endpoints for programmatic access to its features:
319
+
320
+ ### Health Check Endpoints
321
+
322
+ #### GET `/health`
323
+ Public health check endpoint without authentication.
324
+
325
+ * **Response:**
326
+ ```json
327
+ {
328
+ "status": "healthy",
329
+ "timestamp": "2026-02-05T21:30:00.000Z",
330
+ "uptime": 123.45
331
+ }
332
+ ```
333
+
334
+ #### GET `/api/health`
335
+ Health check endpoint for the API (requires authentication).
336
+
337
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
338
+ * **Response:**
339
+ ```json
340
+ {
341
+ "status": "healthy",
342
+ "timestamp": "2026-02-05T21:30:00.000Z",
343
+ "uptime": 123.45
344
+ }
345
+ ```
346
+
347
+ ### Status Endpoint
348
+
349
+ #### GET `/api/status`
350
+ Get the current status of the Morpheus agent.
351
+
352
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
353
+ * **Response:**
354
+ ```json
355
+ {
356
+ "status": "online",
357
+ "uptimeSeconds": 1234.56,
358
+ "pid": 12345,
359
+ "projectVersion": "1.0.0",
360
+ "nodeVersion": "v18.17.0",
361
+ "agentName": "Morpheus",
362
+ "llmProvider": "openai",
363
+ "llmModel": "gpt-4-turbo"
364
+ }
365
+ ```
366
+
367
+ ### Configuration Endpoints
368
+
369
+ #### GET `/api/config`
370
+ Retrieve the current configuration.
371
+
372
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
373
+ * **Response:**
374
+ ```json
375
+ {
376
+ "agent": {
377
+ "name": "Morpheus",
378
+ "personality": "stoic, wise, and helpful"
379
+ },
380
+ "llm": {
381
+ "provider": "openai",
382
+ "model": "gpt-4-turbo",
383
+ "temperature": 0.7,
384
+ "context_window": 100,
385
+ "api_key": "***"
386
+ },
387
+ "santi": {
388
+ "provider": "openai",
389
+ "model": "gpt-4o",
390
+ "memory_limit": 1000
391
+ },
392
+ "channels": {
393
+ "telegram": {
394
+ "enabled": true,
395
+ "token": "***",
396
+ "allowedUsers": ["123456789"]
397
+ },
398
+ "discord": {
399
+ "enabled": false
400
+ }
401
+ },
402
+ "ui": {
403
+ "enabled": true,
404
+ "port": 3333
405
+ },
406
+ "audio": {
407
+ "enabled": true,
408
+ "apiKey": "***",
409
+ "maxDurationSeconds": 300
410
+ }
411
+ }
412
+ ```
413
+
414
+ #### POST `/api/config`
415
+ Update the configuration.
416
+
417
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
418
+ * **Body:** Complete configuration object (same structure as GET response).
419
+ * **Response:**
420
+ ```json
421
+ {
422
+ "agent": {
423
+ "name": "Morpheus",
424
+ "personality": "stoic, wise, and helpful"
425
+ },
426
+ "llm": {
427
+ "provider": "openai",
428
+ "model": "gpt-4-turbo",
429
+ "temperature": 0.7,
430
+ "context_window": 100,
431
+ "api_key": "***"
432
+ },
433
+ "santi": {
434
+ "provider": "openai",
435
+ "model": "gpt-4o",
436
+ "memory_limit": 1000
437
+ },
438
+ "channels": {
439
+ "telegram": {
440
+ "enabled": true,
441
+ "token": "***",
442
+ "allowedUsers": ["123456789"]
443
+ },
444
+ "discord": {
445
+ "enabled": false
446
+ }
447
+ },
448
+ "ui": {
449
+ "enabled": true,
450
+ "port": 3333
451
+ },
452
+ "audio": {
453
+ "enabled": true,
454
+ "apiKey": "***",
455
+ "maxDurationSeconds": 300
456
+ }
457
+ }
458
+ ```
459
+
460
+ #### GET `/api/config/sati`
461
+ Retrieve the Sati (long-term memory) configuration.
462
+
463
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
464
+ * **Response:**
465
+ ```json
466
+ {
467
+ "provider": "openai",
468
+ "model": "gpt-4o",
469
+ "memory_limit": 1000
470
+ }
471
+ ```
472
+
473
+ #### POST `/api/config/sati`
474
+ Update the Sati (long-term memory) configuration.
475
+
476
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
477
+ * **Body:**
478
+ ```json
479
+ {
480
+ "provider": "openai",
481
+ "model": "gpt-4o",
482
+ "memory_limit": 1000
483
+ }
484
+ ```
485
+ * **Response:**
486
+ ```json
487
+ {
488
+ "success": true
489
+ }
490
+ ```
491
+
492
+ #### DELETE `/api/config/sati`
493
+ Remove the Sati (long-term memory) configuration (falls back to Oracle config).
494
+
495
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
496
+ * **Response:**
497
+ ```json
498
+ {
499
+ "success": true
500
+ }
501
+ ```
502
+
503
+ ### Statistics Endpoints
504
+
505
+ #### GET `/api/stats/usage`
506
+ Get global token usage statistics.
507
+
508
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
509
+ * **Response:**
510
+ ```json
511
+ {
512
+ "totalInputTokens": 12345,
513
+ "totalOutputTokens": 6789,
514
+ "totalTokens": 19134
515
+ }
516
+ ```
517
+
518
+ #### GET `/api/stats/usage/grouped`
519
+ Get token usage statistics grouped by provider and model.
520
+
521
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
522
+ * **Response:**
523
+ ```json
524
+ [
525
+ {
526
+ "provider": "openai",
527
+ "model": "gpt-4-turbo",
528
+ "totalTokens": 12345,
529
+ "inputTokens": 10000,
530
+ "outputTokens": 2345,
531
+ "messageCount": 100
532
+ },
533
+ {
534
+ "provider": "anthropic",
535
+ "model": "claude-3-opus",
536
+ "totalTokens": 6789,
537
+ "inputTokens": 5000,
538
+ "outputTokens": 1789,
539
+ "messageCount": 50
540
+ }
541
+ ]
542
+ ```
543
+
544
+ ### Sati Memories Endpoints
545
+
546
+ #### GET `/api/sati/memories`
547
+ Retrieve all memories stored by the Sati agent (long-term memory).
548
+
549
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
550
+ * **Response:**
551
+ ```json
552
+ [
553
+ {
554
+ "id": "unique-id",
555
+ "category": "work",
556
+ "importance": "high",
557
+ "summary": "Memory summary",
558
+ "details": "Additional details of the memory",
559
+ "hash": "unique-hash",
560
+ "source": "source",
561
+ "created_at": "2023-01-01T00:00:00.000Z",
562
+ "updated_at": "2023-01-01T00:00:00.000Z",
563
+ "last_accessed_at": "2023-01-01T00:00:00.000Z",
564
+ "access_count": 5,
565
+ "version": 1,
566
+ "archived": false
567
+ }
568
+ ]
569
+ ```
570
+
571
+ #### DELETE `/api/sati/memories/:id`
572
+ Archive (soft delete) a specific memory from the Sati agent.
573
+
574
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
575
+ * **Parameters:** `id` - ID of the memory to archive.
576
+ * **Response:**
577
+ ```json
578
+ {
579
+ "success": true,
580
+ "message": "Memory archived successfully"
581
+ }
582
+ ```
583
+
584
+ #### POST `/api/sati/memories/bulk-delete`
585
+ Archive (soft delete) multiple memories from the Sati agent at once.
586
+
587
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
588
+ * **Body:**
589
+ ```json
590
+ {
591
+ "ids": ["id1", "id2", "id3"]
592
+ }
593
+ ```
594
+ * **Response:**
595
+ ```json
596
+ {
597
+ "success": true,
598
+ "message": "X memories archived successfully",
599
+ "deletedCount": X
600
+ }
601
+ ```
602
+
603
+ ### MCP Server Endpoints
604
+
605
+ #### GET `/api/mcp/servers`
606
+ List all registered MCP servers.
607
+
608
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
609
+ * **Response:**
610
+ ```json
611
+ {
612
+ "servers": [
613
+ {
614
+ "name": "coolify",
615
+ "config": {
616
+ "transport": "stdio",
617
+ "command": "npx",
618
+ "args": ["-y", "@coolify/mcp-server"],
619
+ "env": {
620
+ "COOLIFY_URL": "https://app.coolify.io",
621
+ "COOLIFY_TOKEN": "your-token"
622
+ }
623
+ },
624
+ "enabled": true
625
+ },
626
+ {
627
+ "name": "coingecko",
628
+ "config": {
629
+ "transport": "http",
630
+ "url": "https://mcps.mnunes.xyz/coingecko/mcp"
631
+ },
632
+ "enabled": false
633
+ }
634
+ ]
635
+ }
636
+ ```
637
+
638
+ #### POST `/api/mcp/servers`
639
+ Add a new MCP server.
640
+
641
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
642
+ * **Body:**
643
+ ```json
644
+ {
645
+ "name": "new-server",
646
+ "config": {
647
+ "transport": "stdio",
648
+ "command": "npx",
649
+ "args": ["-y", "@new-mcp-server"],
650
+ "env": {
651
+ "NEW_SERVER_URL": "https://example.com",
652
+ "NEW_SERVER_TOKEN": "your-token"
653
+ }
654
+ }
655
+ }
656
+ ```
657
+ * **Response:**
658
+ ```json
659
+ {
660
+ "ok": true
661
+ }
662
+ ```
663
+
664
+ #### PUT `/api/mcp/servers/:name`
665
+ Update an existing MCP server.
666
+
667
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
668
+ * **Parameters:** `name` - Name of the server to update.
669
+ * **Body:**
670
+ ```json
671
+ {
672
+ "transport": "stdio",
673
+ "command": "npx",
674
+ "args": ["-y", "@updated-mcp-server"],
675
+ "env": {
676
+ "UPDATED_SERVER_URL": "https://example.com",
677
+ "UPDATED_SERVER_TOKEN": "your-updated-token"
678
+ }
679
+ }
680
+ ```
681
+ * **Response:**
682
+ ```json
683
+ {
684
+ "ok": true
685
+ }
686
+ ```
687
+
688
+ #### DELETE `/api/mcp/servers/:name`
689
+ Delete an MCP server.
690
+
691
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
692
+ * **Parameters:** `name` - Name of the server to delete.
693
+ * **Response:**
694
+ ```json
695
+ {
696
+ "ok": true
697
+ }
698
+ ```
699
+
700
+ #### PATCH `/api/mcp/servers/:name/toggle`
701
+ Enable or disable an MCP server.
702
+
703
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
704
+ * **Parameters:** `name` - Name of the server to toggle.
705
+ * **Body:**
706
+ ```json
707
+ {
708
+ "enabled": true
709
+ }
710
+ ```
711
+ * **Response:**
712
+ ```json
713
+ {
714
+ "ok": true
715
+ }
716
+ ```
717
+
718
+ ### Logging Endpoints
719
+
720
+ #### GET `/api/logs`
721
+ List all log files.
722
+
723
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
724
+ * **Response:**
725
+ ```json
726
+ [
727
+ {
728
+ "name": "morpheus.log",
729
+ "size": 10240,
730
+ "modified": "2026-02-05T21:30:00.000Z"
731
+ },
732
+ {
733
+ "name": "morpheus-2026-02-04.log",
734
+ "size": 20480,
735
+ "modified": "2026-02-04T21:30:00.000Z"
736
+ }
737
+ ]
738
+ ```
739
+
740
+ #### GET `/api/logs/:filename`
741
+ Get the last lines of a specific log file.
742
+
743
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
744
+ * **Parameters:** `filename` - Name of the log file to read.
745
+ * **Query Parameters:** `limit` - Number of lines to return (default: 50).
746
+ * **Response:**
747
+ ```json
748
+ {
749
+ "lines": [
750
+ "2026-02-05T21:30:00.000Z INFO: Starting Morpheus agent...",
751
+ "2026-02-05T21:30:01.000Z DEBUG: Connected to OpenAI API",
752
+ "2026-02-05T21:30:02.000Z INFO: Telegram bot initialized"
753
+ ]
754
+ }
755
+ ```
756
+
757
+ ### Control Endpoints
758
+
759
+ #### POST `/api/restart`
760
+ Restart the Morpheus agent.
761
+
762
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
763
+ * **Response:**
764
+ ```json
765
+ {
766
+ "success": true,
767
+ "message": "Restart initiated. Process will shut down and restart shortly."
768
+ }
769
+ ```
770
+
771
+ ## Testing
772
+
773
+ We use **Vitest** for testing.
774
+
775
+ ```bash
776
+ # Run unit tests
777
+ npm test
778
+
779
+ # Run tests in watch mode
780
+ npm run test:watch
781
+ ```
782
+
783
+ ## Project Structure
784
+
785
+ ```text
786
+ .
787
+ ├── assets/ # Static assets
788
+ ├── bin/ # CLI entry point (morpheus.js)
789
+ ├── specs/ # Technical specifications & documentation
790
+ ├── src/
791
+ │ ├── channels/ # Communication adapters (Telegram, etc.)
792
+ │ ├── cli/ # CLI commands and logic
793
+ │ ├── config/ # Configuration management
794
+ │ ├── runtime/ # Core agent logic, lifecycle, and providers
795
+ │ ├── types/ # Shared TypeScript definitions
796
+ │ └── ui/ # React Web UI Dashboard
797
+ └── package.json
798
+ ```
799
+
800
+ ## Roadmap
801
+
802
+ - [x] **Web Dashboard**: Local UI for management and logs.
803
+ - [x] **MCP Support**: Full integration with Model Context Protocol.
804
+ - [ ] **Discord Adapter**: Support for Discord interactions.
805
+ - [ ] **Plugin System**: Extend functionality via external modules.
806
+
807
+ ## 🕵️ Privacy Protection
808
+
809
+ The Web UI includes privacy protection headers to prevent indexing by search engines:
810
+ - HTML meta tags: `<meta name="robots" content="noindex, nofollow">`
811
+ - HTTP header: `X-Robots-Tag: noindex, nofollow`
812
+
813
+ This ensures that your private agent dashboard remains private and is not discoverable by search engines.
814
+
815
+ ## 🐳 Running with Docker
816
+
817
+ Morpheus can be easily deployed using Docker and Docker Compose. The container supports all environment variables for configuration.
818
+ The Docker image is publicly available at [Docker Hub](https://hub.docker.com/r/marcosnunesmbs/morpheus).
819
+
820
+ ### Prerequisites
821
+
822
+ - Docker Engine
823
+ - Docker Compose
824
+
825
+ ### Quick Start
826
+
827
+ 1. Create a `.env` file with your configuration:
828
+
829
+ ```bash
830
+ cp .env.example .env
831
+ # Edit .env with your actual API keys and settings
832
+ ```
833
+
834
+ 2. Build and start the container:
835
+
836
+ ```bash
837
+ docker-compose up -d
838
+ ```
839
+
840
+ 3. Access the Web UI at `http://localhost:3333`
841
+
842
+ ### Docker Compose Example
843
+
844
+ Here's a complete example of how to run Morpheus using Docker Compose:
845
+
846
+ ```yaml
847
+ version: '3.8'
848
+
849
+ services:
850
+ morpheus:
851
+ image: morpheus/morpheus-agent:latest
852
+ container_name: morpheus-agent
853
+ ports:
854
+ - "3333:3333"
855
+ volumes:
856
+ - morpheus_data:/root/.morpheus
857
+ environment:
858
+ # LLM Configuration
859
+ - MORPHEUS_LLM_PROVIDER=openai
860
+ - MORPHEUS_LLM_MODEL=gpt-4o
861
+ - MORPHEUS_LLM_TEMPERATURE=0.7
862
+
863
+ # API Keys
864
+ - OPENAI_API_KEY=your-openai-api-key
865
+ - ANTHROPIC_API_KEY=your-anthropic-api-key
866
+ - GOOGLE_API_KEY=your-google-api-key
867
+ - OPENROUTER_API_KEY=your-openrouter-api-key
868
+
869
+ # Security
870
+ - THE_ARCHITECT_PASS=your-secure-password
871
+
872
+ # Agent Configuration
873
+ - MORPHEUS_AGENT_NAME=morpheus
874
+ - MORPHEUS_AGENT_PERSONALITY=helpful_dev
875
+
876
+ # UI Configuration
877
+ - MORPHEUS_UI_ENABLED=true
878
+ - MORPHEUS_UI_PORT=3333
879
+ restart: unless-stopped
880
+ ```
881
+
882
+ ### Using Docker Directly
883
+
884
+ ```bash
885
+ # Build the image
886
+ docker build -t morpheus .
887
+
888
+ # Run with environment variables
889
+ docker run -d \
890
+ --name morpheus-agent \
891
+ -p 3333:3333 \
892
+ -v morpheus_data:/root/.morpheus \
893
+ -e MORPHEUS_LLM_PROVIDER=openai \
894
+ -e OPENAI_API_KEY=your-api-key-here \
895
+ -e THE_ARCHITECT_PASS=your-password \
896
+ morpheus
897
+ ```
898
+
899
+ ### Environment Variables in Docker
900
+
901
+ All environment variables described above work in Docker. The precedence order remains the same:
902
+ 1. Container environment variables
903
+ 2. Configuration file values
904
+ 3. Default values
905
+
906
+ ### Persistent Data
907
+
908
+ The container stores configuration and data in `/root/.morpheus`. Mount a volume to persist data between container restarts:
909
+
910
+ ```yaml
911
+ volumes:
912
+ - morpheus_data:/root/.morpheus # Recommended for persistence
913
+ ```
914
+
915
+ ### Health Check
916
+
917
+ The container includes a health check that verifies the health endpoint is accessible. The application exposes a public `/health` endpoint that doesn't require authentication:
918
+
919
+ ```bash
920
+ curl http://localhost:3333/health
921
+ ```
922
+
923
+ Response:
924
+ ```json
925
+ {
926
+ "status": "healthy",
927
+ "timestamp": "2026-02-05T21:30:00.000Z",
928
+ "uptime": 123.45
929
+ }
930
+ ```
931
+
932
+ ## Contributing
933
+
934
+ 1. Fork the repository.
935
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`).
936
+ 3. Commit your changes (`git commit -m 'feat: Add amazing feature'`).
937
+ 4. Push to the branch (`git push origin feature/amazing-feature`).
938
+ 5. Open a Pull Request.
939
+
940
+ ## License
941
+
942
+ MIT