email: align MCP email_db account with the API (first enabled)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 13:38:52 +00:00
co-authored by Claude Opus 4.8
parent 33a0bb4578
commit 85b6a381e8
+3 -2
View File
@@ -39,9 +39,10 @@ const homeDir =
dbUser.role === 'Super Admin' ? (process.env.HOME_DIR ?? homedir()) : join(DATA_PATH, email, 'home');
const globalToolsDir = join(DATA_PATH, 'tools');
// The email_db MCP tool reads one account's SQLite store; use the user's first configured account.
// The email_db MCP tool reads one account's SQLite store; match the API's choice (first enabled).
const emailAccounts = await getEmailAccounts(dbUser.id);
const emailDbRel = join('email_accounts', emailAccounts[0]?.email ?? 'none', 'emails.db');
const emailAccount = emailAccounts.find((a) => a.enabled) ?? emailAccounts[0];
const emailDbRel = join('email_accounts', emailAccount?.email ?? 'none', 'emails.db');
const userToolsDir = join(DATA_PATH, email, 'tools');
// ── Path setup ──