Daemon, CLI & MCP
Overview
Section titled “Overview”chattor can run in two modes:
- TUI mode (default): The interactive terminal UI
- Daemon mode: A headless background process that exposes a JSON-RPC API over a Unix socket
The daemon enables CLI scripting, automation, and AI agent integration via MCP (Model Context Protocol).
Starting the Daemon
Section titled “Starting the Daemon”chattor daemonThe daemon:
- Bootstraps Tor and starts a hidden service (same as TUI mode)
- Opens a Unix socket at
{data_dir}/chattor.sock - Writes a PID file at
{data_dir}/chattor.pidfor mutual exclusion - Runs background tasks (message queue, channel sync, heartbeat)
- Processes incoming messages from peers
Only one daemon instance can run at a time. If a daemon is already running, chattor daemon will exit with an error.
CLI Commands
Section titled “CLI Commands”With a daemon running, use CLI subcommands to interact:
Identity & Status
Section titled “Identity & Status”chattor status # Daemon status + Tor connection infochattor identity # Your onion address and friend codeFriends
Section titled “Friends”chattor friends list # List all friendschattor friends add <friend-code> # Send a friend requestchattor friends requests # Show pending requestschattor friends accept <friend-code> # Accept a requestchattor friends reject <friend-code> # Reject a requestMessaging
Section titled “Messaging”chattor send <onion-address> "Hello!" # Send a messagechattor recv # Fetch recent messageschattor recv --conversation <onion> --limit 50 # Filter by conversationchattor listen # Stream incoming messages (real-time)The listen command streams messages as newline-delimited JSON until interrupted with Ctrl+C. Useful for building bots or notification integrations.
Channels
Section titled “Channels”chattor channels list # List your channels + subscriptionschattor channels publish <channel-id> "Post" # Publish to a channelchattor channels subscribe <onion> # Subscribe to a peer's channelchattor channels feed <channel-id> # View recent postsSettings
Section titled “Settings”chattor ephemeral <seconds> # Set ephemeral message TTL (0 to disable)chattor notifications on # Enable desktop notificationschattor notifications off # Disable desktop notificationsMCP Server
Section titled “MCP Server”chattor includes an MCP (Model Context Protocol) server for AI agent integration. This lets Claude and other MCP-compatible agents send and receive messages through chattor.
Add chattor to your MCP client configuration. For Claude Code, add to ~/.claude.json:
{ "mcpServers": { "chattor": { "command": "chattor", "args": ["mcp"] } }}The MCP server requires a running daemon — start one with chattor daemon before using MCP tools.
Available Tools
Section titled “Available Tools”| Tool | Description |
|---|---|
get_status | Daemon and Tor connection status |
get_identity | Your onion address and friend code |
list_friends | All friends with online status |
add_friend | Send a friend request |
accept_friend_request | Accept a pending request |
send_message | Send a message to a friend |
receive_messages | Fetch recent messages |
publish_channel_post | Publish to a broadcast channel |
list_channel_posts | View posts from a channel |
Example Agent Interaction
Section titled “Example Agent Interaction”Once configured, an AI agent can interact naturally:
“Send a message to alice saying I’ll be online at 8pm”
The agent calls send_message with Alice’s onion address and the text, routed through the daemon over Tor with full Signal Protocol encryption.
Architecture
Section titled “Architecture”┌─────────┐ ┌──────┐ ┌──────────┐│ CLI │ │ MCP │ │ Scripts ││ commands│ │server│ │ & bots │└────┬────┘ └──┬───┘ └────┬─────┘ │ │ │ └────┬─────┴────────────┘ │ JSON-RPC 2.0 │ Unix socket ┌────▼─────────────────┐ │ chattor daemon │ │ │ │ Tor ←→ Signal Proto │ │ Message Queue │ │ Connection Pool │ │ Presence System │ └──────────────────────┘The daemon owns the App state (database, Tor client, Signal sessions) behind an Arc<Mutex<App>>. The CLI and MCP server are thin clients that connect to the daemon’s Unix socket and issue JSON-RPC calls.
Data Paths
Section titled “Data Paths”| Platform | Socket | PID File |
|---|---|---|
| Linux | ~/.local/share/chattor/chattor.sock | ~/.local/share/chattor/chattor.pid |
| macOS | ~/Library/Application Support/chattor/chattor.sock | ~/Library/Application Support/chattor/chattor.pid |