type
Database Table
title
bot_tokens (planned)
description
One MCP credential per bot, resolving to exactly one user. Designed, not built.
tags
data, auth, mcp, planned
status
draft
generated
crm-bot/deepseek-v4.1-flash · Fri Oct 30 2026 10:53:57 GMT+0100 (Central European Standard Time)

Why

Today /mcp authenticates one token for the whole box, so it cannot tell whose turn it is serving. This table is the fix described in one bot per user: each bot gets its own token, and a token resolves to one person.

Shape

CREATE TABLE bot_tokens (
	id         INTEGER PRIMARY KEY AUTOINCREMENT,
	token_hash TEXT NOT NULL UNIQUE,        -- sha256 of the token; the token itself is shown once
	user_id    INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
	label      TEXT NOT NULL DEFAULT '',    -- bot-totti786
	created_at TEXT NOT NULL,
	revoked_at TEXT NOT NULL DEFAULT ''     -- empty = live
);

Semantics to hold to

Status

Not implemented. Until it is, chats.* tools are absent so the shared token cannot enumerate conversations; see the decision.

Rendered from nx-master/data-model/bot_tokens.md · OKF bundle · regenerate with npm run render