Skip to content
dtoolkit

Configuration

Each dtoolkit service stores its configuration in a JSON file under the user’s home directory. Every config value can be overridden with an environment variable, and all services share the same conventions for ports, authentication, and data storage.

ServiceConfig fileData directory
dbrain~/.dbrain/config.json~/.dbrain/
dwork~/.dwork/config.json~/.dwork/
dops~/.dops/config.json~/.dops/
dcontext(per-CLI config)(none)
dproxy~/.dproxy/config.json~/.dproxy/

All config files are created automatically when you run the init command for each service. You can also edit them directly.

terminal
dbrain init # creates ~/.dbrain/config.json
dwork init # creates ~/.dwork/config.json
dops init # creates ~/.dops/config.json
dproxy init # creates ~/.dproxy/config.json

The dbrain config controls the memory server, its storage, networking, and federation connections.

~/.dbrain/config.json
{
"dataPath": "~/.dbrain",
"port": 7878,
"host": "127.0.0.1",
"token": "your-secret-token",
"brainType": "personal",
"connections": [
{
"name": "team-brain",
"url": "http://192.168.1.50:7878",
"token": "shared-brain-token"
}
]
}
FieldTypeDefaultDescription
dataPathstring~/.dbrainDirectory for SQLite database and data files
portnumber7878REST API and MCP server port
hoststring127.0.0.1Bind address
tokenstring(generated)Bearer token for API authentication
brainType"personal" | "shared"personalPersonal brains are single-user; shared brains accept connections from multiple clients
connectionsarray[]List of remote brains to federate with

Adding connections:

You can add connections via the CLI or by editing the config file directly.

terminal
dbrain connect --name team-brain --url http://192.168.1.50:7878 --token shared-token

Every config field can be overridden with an environment variable. Environment variables take precedence over values in the config file. The naming convention is {SERVICE}_{FIELD} in uppercase.

VariableOverridesExample
DBRAIN_DATA_PATHdataPath~/.dbrain
DBRAIN_PORTport7878
DBRAIN_HOSThost0.0.0.0
DBRAIN_TOKENtokenmy-secret-token
DBRAIN_BRAIN_TYPEbrainTypeshared
VariableOverridesExample
DWORK_DATA_PATHdataPath~/.dwork
DWORK_PORTport7881
DWORK_HOSThost0.0.0.0
DWORK_TOKENtokenmy-secret-token
VariableOverridesExample
DOPS_DATA_PATHdataPath~/.dops
DOPS_PORTport7883
DOPS_HOSThost0.0.0.0
DOPS_TOKENtokenmy-secret-token
VariableOverridesExample
DPROXY_PROVIDERprovidergemini
DPROXY_MODELmodelopus
DPROXY_PORTport7880
DPROXY_HOSThost0.0.0.0
DPROXY_TOKENtokenmy-secret-token
terminal
# Start dbrain on a custom port, bound to all interfaces
DBRAIN_PORT=9000 DBRAIN_HOST=0.0.0.0 dbrain start

All dtoolkit services use a pair of consecutive ports: one for the API (REST + MCP) and one for the web dashboard.

ServiceAPI portDashboard portProtocol
dbrain78787879REST + MCP (same port)
dproxy7880REST + SSE streaming
dwork78817882REST + MCP (same port)
dops78837884REST + MCP (same port)

dproxy is the exception: it provides a REST API with SSE streaming but does not have an MCP server or dashboard.

All dtoolkit services use Bearer token authentication. A token is generated automatically during init and stored in the config file.

Every HTTP request to a dtoolkit service must include the token in the Authorization header:

terminal
curl -H "Authorization: Bearer your-secret-token" http://localhost:7878/health

MCP clients also authenticate with the same token. When configuring an MCP client (such as Claude Code’s settings.json), pass the token as part of the connection URL or headers.

Tokens are generated automatically when you run init. To set a specific token:

terminal
# Set via the configure command
dbrain configure --token my-new-token
# Or edit the config file directly
# ~/.dbrain/config.json -> "token": "my-new-token"
# Or use an environment variable
DBRAIN_TOKEN=my-new-token dbrain start

To rotate a token, update it in the config file or via environment variable, then restart the service. Any connected clients (dcontext hooks, MCP integrations, SDK clients) must be updated with the new token.

terminal
# 1. Generate a new token
NEW_TOKEN=$(openssl rand -hex 32)
# 2. Update the config
dbrain configure --token "$NEW_TOKEN"
# 3. Restart the service
dbrain start
# 4. Update any clients that connect to this service

When using the @dtoolkit/sdk package to connect to services programmatically, pass the token when creating a client:

import { DBrainClient, DWorkClient } from '@dtoolkit/sdk';
const brain = new DBrainClient({
baseUrl: 'http://localhost:7878',
token: 'your-secret-token',
});
const work = new DWorkClient({
baseUrl: 'http://localhost:7881',
token: 'your-secret-token',
});

Shared brains support multiple API keys for team access control. This lets each team member or service authenticate independently, without sharing a single master token.

terminal
# List existing keys
dbrain keys list
# Create a new key for a team member
dbrain keys create --name "alice"
# Revoke a key
dbrain keys revoke --name "alice"

API keys provide the same access as the master token. The master token (in config.json) always works and cannot be revoked via the keys command.