This guide is for Linux users who want the Rust server to run as a long-lived local service. MCP bridges can reach it over a Unix socket, while REST clients remain available over HTTP.
This is optional. The default npx -y @shodh/memory-mcp setup is still the
quickest path for Claude Code, Cursor, Claude Desktop, and other MCP clients.
Use direct server mode when you want:
- A single backend process supervised by systemd.
- Stable health checks and logs outside of any one MCP client.
- REST clients, shell helpers, or multiple local tools to share the same server.
- The backend lifecycle to be independent from the MCP bridge lifecycle.
shodh serverstarts the HTTP API and, by default, the local IPC listener.shodh servestarts the MCP stdio bridge, preferring local IPC and falling back toSHODH_API_URLwhen IPC is unavailable.@shodh/memory-mcpis the npm MCP wrapper used by MCP clients.
Direct server mode runs shodh server separately. MCP and REST clients can then
connect to that server instead of owning the backend process themselves.
First find the installed binary path:
command -v shodhCreate ~/.config/systemd/user/shodh-memory.service:
[Unit]
Description=Shodh Memory server
After=network.target
[Service]
Type=simple
Environment=SHODH_HOST=127.0.0.1
Environment=SHODH_PORT=3030
Environment=SHODH_MEMORY_PATH=%h/.local/share/shodh-memory
Environment=SHODH_IPC_ENABLED=true
Environment=SHODH_IPC_ENDPOINT=%h/.local/share/shodh/shodh-memory.sock
Environment=SHODH_IPC_REQUIRED=true
Environment=SHODH_DEV_API_KEY=local-dev-key
ExecStart=%h/.cargo/bin/shodh server
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.targetReplace ExecStart=%h/.cargo/bin/shodh server with the path returned by
command -v shodh if your binary is installed somewhere else.
Start the service:
systemctl --user daemon-reload
systemctl --user enable --now shodh-memory.service
systemctl --user status shodh-memory.serviceCheck the server directly:
curl -sS http://127.0.0.1:3030/healthAlso check the journal for Local IPC ready at .... With
SHODH_IPC_REQUIRED=true, a socket bind failure makes service activation fail;
without it, the server logs the failure and continues HTTP-only.
View logs:
journalctl --user -u shodh-memory.service -fRestart after configuration changes:
systemctl --user restart shodh-memory.serviceIf you want an MCP client to use this separately supervised server, point the native MCP bridge at the same Unix socket:
{
"mcpServers": {
"shodh-memory": {
"command": "shodh",
"args": ["serve"],
"env": {
"SHODH_IPC_ENDPOINT": "/home/you/.local/share/shodh/shodh-memory.sock",
"SHODH_API_URL": "http://127.0.0.1:3030",
"SHODH_API_KEY": "local-dev-key",
"SHODH_USER_ID": "local-agent"
}
}
}
}Use the full path to shodh if your MCP client does not inherit your shell
PATH. Replace /home/you with the service user's home directory and keep the
endpoint identical to the service value. The socket parent is mode 0700 and
the socket is mode 0600; Shodh refuses unsafe, foreign-owned, or live
replacement endpoints.
The user_id in API request bodies, and the SHODH_USER_ID environment
variable used by MCP and hook commands, identify the memory namespace for the
calling user or agent. This value is not an API key, password, or authentication
token.
Choose a stable user_id such as local-agent, alice, or robot-1, and keep
using the same value for that client if you want it to see the same memories.
All /api/* endpoints require the X-API-Key header.
export SHODH_API_URL=http://127.0.0.1:3030
export SHODH_API_KEY=local-dev-key
export SHODH_USER_ID=local-agent
curl -sS -X POST "$SHODH_API_URL/api/remember" \
-H "Content-Type: application/json" \
-H "X-API-Key: $SHODH_API_KEY" \
-d "{\"user_id\":\"$SHODH_USER_ID\",\"content\":\"Prefer direct server mode\",\"memory_type\":\"Decision\"}"
curl -sS -X POST "$SHODH_API_URL/api/recall" \
-H "Content-Type: application/json" \
-H "X-API-Key: $SHODH_API_KEY" \
-d "{\"user_id\":\"$SHODH_USER_ID\",\"query\":\"direct server mode\"}"For local-only use, keep SHODH_HOST=127.0.0.1.
Before binding to 0.0.0.0 or exposing the service to another machine:
- Use production mode with
SHODH_ENV=production. - Set strong values in
SHODH_API_KEYS. - Put the service behind TLS and normal network access controls.
- Avoid using development keys such as
local-dev-key.