Skip to content

hoard serve

The hoard serve command starts the HTTP MCP server for AI tool connections.

Usage

Terminal window
hoard serve [options]

Options

OptionDescription
--daemonRun in background
--statusCheck if daemon is running
--stopStop running daemon
--install-autostartEnable autostart on login
--port <n>Override port (default: 19850)
--host <addr>Override bind address (default: 127.0.0.1)
--allow-remoteAllow non-loopback bind addresses
--no-migrateSkip schema migrations on startup

Examples

Start Server (Foreground)

Terminal window
hoard serve

Output:

Starting Hoard server on http://127.0.0.1:19850/mcp

Press Ctrl+C to stop the server.

Start as Daemon

Terminal window
hoard serve --daemon

Runs in background, survives terminal close.

Check Status

Terminal window
hoard serve --status

Output (when running):

Hoard server running (PID 12345)

Output (when not running):

Hoard server is not running.

Stop Daemon

Terminal window
hoard serve --stop

Install Autostart

Terminal window
hoard serve --install-autostart

Configures Hoard to start automatically on login.

macOS: Creates ~/Library/LaunchAgents/com.hoard.server.plist

Linux: Creates ~/.config/systemd/user/hoard.service

Server Configuration

In ${HOARD_DATA_DIR:-~/.hoard}/config.yaml:

server:
host: "127.0.0.1" # Bind address
port: 19850 # Port number
allow_remote: false # Require explicit opt-in for non-loopback binds

Background Sync and Watcher

When running hoard serve (or hoard mcp serve), Hoard starts the background scheduler and optional file watcher based on your sync configuration.

Scheduled sync runs every interval_minutes, and the watcher batches changes using watcher_debounce_seconds.

If the watcher is enabled but watchdog is not installed, Hoard logs a warning and continues without file watching.

Endpoints

EndpointDescription
POST /mcpMCP JSON-RPC endpoint
GET /healthUnauthenticated liveness + DB/schema readiness
GET /sync_statusGet connector sync status
POST /<tool>Direct tool invocation (e.g., /search)

Test Connection

Terminal window
curl -X POST http://127.0.0.1:19850/mcp -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_TOKEN" -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'

Authentication

All /mcp requests require Bearer token:

Authorization: Bearer hoard_sk_544e528b4b1ae6...

Tokens are configured in ${HOARD_DATA_DIR:-~/.hoard}/config.yaml:

security:
tokens:
- name: "claude-code"
token: "hoard_sk_544e528b..."
scopes: ["search", "get", "memory", "sync", "ingest"]

Runtime Paths

By default Hoard uses ~/.hoard. Set HOARD_DATA_DIR to move default runtime paths:

Terminal window
export HOARD_DATA_DIR=/var/lib/hoard

Logging

Server logs to stdout (foreground) or to ${HOARD_DATA_DIR:-~/.hoard}/hoard.log when running as daemon.

View logs:

Terminal window
tail -f "${HOARD_DATA_DIR:-$HOME/.hoard}/hoard.log"

Troubleshooting

Port Already in Use

Error: Address already in use (port 19850)

Solutions:

  1. Check for running instance: hoard serve --status
  2. Stop it: hoard serve --stop
  3. Or use different port: hoard serve --port 19851

Connection Refused

AI tool can’t connect:

  1. Ensure server is running: hoard serve --status
  2. Check URL matches config
  3. Test with curl (see Test Connection example above)

Daemon Won’t Start

Check logs for errors:

Terminal window
cat "${HOARD_DATA_DIR:-$HOME/.hoard}/hoard.log"

Common issues:

  • Config file errors
  • Port conflicts
  • Permission issues

See Also