Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

agent: tool servers follow the default model, one naming rule, a dropped server is reported (T5, T6)

Niko1221034f2fdebe5c
diff --git a/apps/host/server/agent/agent-bridge.mjs b/apps/host/server/agent/agent-bridge.mjs
index 5ba219612..db9c1990f 100644
--- a/apps/host/server/agent/agent-bridge.mjs
+++ b/apps/host/server/agent/agent-bridge.mjs
@@ -111,11 +111,12 @@ const deferred = () => { let resolve; const promise = new Promise(r => { resolve
* @param {string|null} [options.componentsDir] where installed components live
* @param {() => Array} options.localInstances ready local instances (see profile.mjs)
* @param {() => Array} options.connections saved API connections WITH their keys (host-internal)
+ * @param {() => (string|null)} [options.defaultLocalId] the local instance the chat runs on: its tool servers are the agent's (T5)
* @param {NodeJS.ProcessEnv} [options.env]
* @param {string} [options.nodePath] the Node runtime that runs the Harness
* @param {(line:string)=>void} [options.log]
*/
-export function createAgentBridge({ dataDir, componentsDir = null, bundledDir = null, gate = true, localInstances, connections, tools = () => undefined, skillsDir = () => null, onGoal = () => {}, onPlan = () => {}, onQueue = () => {}, proxyBase = null, searchMock = null, expertSampling = () => null, stallMs = 4 * 60_000, stallToolMs = 20 * 60_000, env = process.env, nodePath = process.execPath, log = () => {}, startTimeoutMs = 120_000, sessionReadyMs = 60_000, sessionRetryMs = 1_500 }) {
+export function createAgentBridge({ dataDir, componentsDir = null, bundledDir = null, gate = true, localInstances, connections, tools = () => undefined, defaultLocalId = () => null, skillsDir = () => null, onGoal = () => {}, onPlan = () => {}, onQueue = () => {}, proxyBase = null, searchMock = null, expertSampling = () => null, stallMs = 4 * 60_000, stallToolMs = 20 * 60_000, env = process.env, nodePath = process.execPath, log = () => {}, startTimeoutMs = 120_000, sessionReadyMs = 60_000, sessionRetryMs = 1_500 }) {
const root = join(dataDir, 'agent');
const home = join(root, 'home');
const sessionsFile = join(root, 'sessions.json');
@@ -171,7 +172,7 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =
/** The agent's profile now, plus where its shaped routes really lead (read by the forwarding endpoint). */
let shapeTargets = {};
function buildProfileNow() {
- const profile = buildProfile({ local: localInstances(), connections: connections(), gate, tools: tools(), skillsDir: skillsDir(), proxyBase, searchMock });
+ const profile = buildProfile({ local: localInstances(), connections: connections(), gate, tools: tools(), skillsDir: skillsDir(), proxyBase, searchMock, defaultLocalId: defaultLocalId() });
shapeTargets = profile.shapeTargets ?? {};
return profile;
}
@@ -193,6 +194,8 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =
harness: { version: h.version },
runtime: rt?.hp.running ? { pid: rt.hp.pid, generation: rt.generation } : null,
routes: profile.routes.map(({ route, kind, modelId, name, contextWindow }) => ({ route, kind, modelId, name, contextWindow })),
+ // tool servers that could not be wired (a name the rule does not allow, no program or address): the chat says so
+ skippedServers: profile.mcpSkipped ?? [],
activeTurns: activeTurns(),
pendingApprovals: pending.size,
};
diff --git a/apps/host/server/agent/profile.mjs b/apps/host/server/agent/profile.mjs
index 2637b87fa..4b68eb8fc 100644
--- a/apps/host/server/agent/profile.mjs
+++ b/apps/host/server/agent/profile.mjs
@@ -20,6 +20,7 @@
import { createHash } from 'node:crypto';
import { fileURLToPath } from 'node:url';
import { standardPreset } from './preset.mjs';
+import { validMcpName } from '../mcp-names.mjs';
import { BUDGETS, isPrivateHost } from './llm-shape.mjs';
import { DDG_PROVIDER_ID } from '../web-search-ddg.mjs';
@@ -71,11 +72,17 @@ const NO_TOOLS_SETTINGS = Object.freeze({ off: new Set(), search: { provider: 'b
* `mcp__<server>__<tool>`. A command or URL goes into the patch as text; a secret (an env value or a header) never does: the row
* carries `!!js process.env.<NAME>` and the value travels in the agent process's environment (returned in `env`).
*/
-export function mcpRows(servers, env) {
+export function mcpRows(servers, env, skipped = []) {
const rows = [];
+ const ids = new Set();
let index = 0;
for (const [name, server] of Object.entries(servers ?? {})) {
- if (!server || server.disabled === true || !/^[A-Za-z0-9_-]{1,32}$/.test(name)) continue;
+ if (!server || server.disabled === true) continue; // switched off on purpose: not an error
+ // A server that cannot be wired is REPORTED (T6): the model never sees its tools, and a silent drop looked like "the tool does not work".
+ if (!validMcpName(name)) { skipped.push({ name, why: 'name' }); continue; }
+ if (!server.command && !server.url) { skipped.push({ name, why: 'address' }); continue; }
+ if (ids.has(`mcp-${slug(name)}`)) { skipped.push({ name, why: 'duplicate' }); continue; }
+ ids.add(`mcp-${slug(name)}`);
const token = (kind, key, value) => {
const variable = `STRATA_MCP_${index}_${kind}_${slug(key).replace(/-/g, '_').toUpperCase()}`;
env[variable] = String(value);
@@ -91,6 +98,24 @@ export function mcpRows(servers, env) {
return rows;
}
+/**
+ * What the chat says when a tool server was left out (one notice per reason). The sentences are interface copy: they are in every language's
+ * catalog (src/locales/tools-<lang>.json), and the {0} is the list of names exactly as the person wrote them.
+ */
+const SKIPPED_TEXT = {
+ name: 'These tool servers were left out because their names are not allowed: {0}. A name can have up to 32 letters, numbers, hyphens or underscores.',
+ address: 'These tool servers were left out because they have no program or web address: {0}.',
+ duplicate: 'These tool servers were left out because another one has almost the same name: {0}.',
+};
+export function mcpSkippedNotices(skipped) {
+ const out = [];
+ for (const why of Object.keys(SKIPPED_TEXT)) {
+ const names = (skipped ?? []).filter(s => s.why === why).map(s => String(s.name).slice(0, 40));
+ if (names.length) out.push({ code: `mcp-skipped-${why}-${names.join(',')}`.slice(0, 160), message: SKIPPED_TEXT[why].replace('{0}', names.join(', ')) });
+ }
+ return out;
+}
+
const slug = value => String(value).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 24) || 'x';
/** Identity of one route's wire configuration, secret included by hash only. */
@@ -166,7 +191,7 @@ export function outputBudget(context, maxOutput = null) {
/** What a local model, or an OpenAI-style server on this network, takes for the thinking level (see the comment where a local route is built). */
const THINKING_COMPAT = { supportsStore: false, thinkingFormat: 'chat-template', chatTemplateKwargs: { enable_thinking: { $var: 'thinking.enabled' }, reasoning_effort: { $var: 'thinking.effort', omitWhenOff: true } } };
-export function buildProfile({ local = [], connections = [], gate = true, tools = NO_TOOLS_SETTINGS, skillsDir = null, proxyBase = null, searchMock = null }) {
+export function buildProfile({ local = [], connections = [], gate = true, tools = NO_TOOLS_SETTINGS, skillsDir = null, proxyBase = null, searchMock = null, defaultLocalId = null }) {
const providers = {};
const env = {};
const routes = [];
@@ -257,9 +282,13 @@ export function buildProfile({ local = [], connections = [], gate = true, tools
for (const m of conn.models) routes.push({ route, fp, kind: 'api', connectionId: conn.id, connectionName: conn.name, modelId: m.id, name: m.name || m.id, contextWindow: m.contextMax ?? ASSUMED_API_CONTEXT, ...(shaped ? { shaped } : {}) });
});
- const defaultRoute = routes.find(r => r.kind === 'local') ?? null;
+ // The model the chat really runs on is the default instance, not whichever one was loaded first (T5: with two models loaded, the tool servers of the
+ // first one were wired to a chat on the second).
+ const defaultInstance = local.find(i => i.id === defaultLocalId) ?? local[0] ?? null;
+ const defaultRoute = routes.find(r => r.kind === 'local' && r.instanceId === defaultInstance?.id) ?? routes.find(r => r.kind === 'local') ?? null;
// One Harness, one set of tool servers: the default local model's.
- const mcp = mcpRows({ ...(local[0]?.mcpServers ?? {}), ...(tools.servers ?? {}) }, mcpEnv);
+ const mcpSkipped = [];
+ const mcp = mcpRows({ ...(defaultInstance?.mcpServers ?? {}), ...(tools.servers ?? {}) }, mcpEnv, mcpSkipped);
Object.assign(env, mcpEnv);
// The person's own instruction and command tools come from the app's tool server; a command tool asks in Manual like any connected tool.
const own = (kind, on) => on && tools.toolFile ? [{ id: `mcp-strata-${kind}`, name: '@deepseek-ai/dsh-mcp-client', config: { serverName: `strata-${kind}`, transport: 'stdio', command: process.execPath, args: [CUSTOM_TOOLS_SCRIPT, kind, tools.toolFile] } }] : [];
@@ -309,7 +338,7 @@ export function buildProfile({ local = [], connections = [], gate = true, tools
// What the agent is offered (tool groups, web search, tool servers, the person's own tools) decides whether a running agent must be
// restarted for the next message; the routes are compared separately (a changed context size alone does not restart it).
const toolsSignature = createHash('sha256').update(JSON.stringify([mcp, ownRows, webRows, entries.find(e => e.id === 'preset-standard'), env.STRATA_SEARCH_KEY ?? '', mcpEnv])).digest('hex').slice(0, 16);
- return { patch, env, routes, defaultRoute, signature, toolsSignature, shapeTargets };
+ return { patch, env, routes, defaultRoute, signature, toolsSignature, shapeTargets, mcpSkipped };
}
/** Find the route for a chat's model choice. */
diff --git a/apps/host/server/index.mjs b/apps/host/server/index.mjs
index f8d638ad7..68d69b605 100644
--- a/apps/host/server/index.mjs
+++ b/apps/host/server/index.mjs
@@ -15,6 +15,7 @@ import { materializeSkills, parseSkillFile, skillSlug, writeCreatedSkill } from
import { systemFonts } from './fonts.mjs';
import { tuningDir } from './platform-paths.mjs';
import { createAgentBridge, plainTurnFailure } from './agent/agent-bridge.mjs';
+import { mcpSkippedNotices } from './agent/profile.mjs';
import { createAgentTools } from './agent/tools-settings.mjs';
import { withPlainStatus } from './agent/status.mjs';
import { findBrowser, findPlaywrightMcp } from './agent/browser-probe.mjs';
@@ -180,6 +181,7 @@ const agent = createAgentBridge({
componentsDir: componentsDirectory(),
// The installer ships the Harness next to the host (<install>/host/server -> <install>/harness).
bundledDir: resolve(HERE, '..', '..', 'harness'),
+ defaultLocalId: () => native.defaultInstanceId(),
localInstances: () => native.readyInstances().map(i => ({
id: i.id, label: i.label, baseUrl: `http://127.0.0.1:${i.port}/v1`, modelId: i.apiModelId,
context: i.metrics?.engine?.max_context ?? i.context ?? undefined, key: i.key, vision: i.vision,
@@ -1934,6 +1936,8 @@ async function api(req, res, path, method, url) {
if (chatId && !agentSkip) {
const capability = agent.status();
if (capability.state !== 'unavailable') {
+ const skipped = mcpSkippedNotices(capability.skippedServers);
+ for (const notice of skipped) res.write(`${JSON.stringify({ type: 'notice', ...notice })}\n`);
await runAgentTurn({ res, controller, chatId, body, message, workspaceId, images });
res.end();
return undefined;
diff --git a/apps/host/server/mcp-names.mjs b/apps/host/server/mcp-names.mjs
new file mode 100644
index 000000000..a4776f520
--- /dev/null
+++ b/apps/host/server/mcp-names.mjs
@@ -0,0 +1,10 @@
+// The one rule for the name of a tool server (MCP), shared by the Settings editor (src/lib/mcp-names.ts keeps a copy; tests/mcp-rows.test.mjs
+// checks they agree), the save check (native-settings.mjs) and the agent profile (agent/profile.mjs).
+//
+// The model sees every tool as `mcp__<server>__<tool>`, and an OpenAI-style API takes at most 64 characters for that name, so the server's
+// part is limited to 32 (T6, tools and images review 2026-10-22). Before, the editor and the save check accepted 64 and the profile quietly
+// dropped everything over 32 (or with a dot): the model never saw the tool and nothing said why.
+export const MCP_NAME_MAX = 32;
+export const MCP_NAME_RE = /^[A-Za-z0-9_-]{1,32}$/;
+export const validMcpName = name => typeof name === 'string' && MCP_NAME_RE.test(name);
+export const MCP_NAME_HELP = 'Use a simple server name of up to 32 characters: letters, numbers, hyphens or underscores.';
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjs
index 0dab2c8dd..a4380e797 100644
--- a/apps/host/server/native-control.mjs
+++ b/apps/host/server/native-control.mjs
@@ -482,5 +482,5 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
// Remove nonserializable process references from public jobs.
const publicState=()=>{const value=state();value.jobs=value.jobs.map(({process,engineAbort,rawResult,...job})=>job);return value;};
async function localPreview(path){if(!packaged)throw new Error('Checking local model files is part of the Strata app.');if(typeof path!=='string'||!path.trim()||[...path].some(c=>c.charCodeAt(0)<32))throw new Error('Choose a folder.');return control.importPlan(path.trim());}
- return {state:publicState,tuneStatus,tuneEffective,tuneOff,tunePresets:{list:()=>autotuner.list(),action:(kind,id,extra)=>autotuner.action(kind,id,extra),undoFor:async args=>autotuner.undoFor(tuneConfig(args).path)},refresh,localPreview,configure,setDownloadDirectory,planModelsFolder,startModelsFolder,interruptedMove,finishInterruptedMove,leaveInterruptedMove,plan,settings,save,settingsFile,openSettingsFile,operation,cancel,unload,resolveInstance,poll,logs:()=>logs.slice(),benchmarkReport:()=>readJson(join(directory,'native-benchmark.json'),null),setDefault(id){defaultId=resolveInstance(id).id;emit();return publicState();},hasLive:()=>[...instances.values()].some(i=>i.status==='ready'),readyInstances:()=>[...instances.values()].filter(i=>i.status==='ready'),close};
+ return {state:publicState,tuneStatus,tuneEffective,tuneOff,tunePresets:{list:()=>autotuner.list(),action:(kind,id,extra)=>autotuner.action(kind,id,extra),undoFor:async args=>autotuner.undoFor(tuneConfig(args).path)},refresh,localPreview,configure,setDownloadDirectory,planModelsFolder,startModelsFolder,interruptedMove,finishInterruptedMove,leaveInterruptedMove,plan,settings,save,settingsFile,openSettingsFile,operation,cancel,unload,resolveInstance,poll,logs:()=>logs.slice(),benchmarkReport:()=>readJson(join(directory,'native-benchmark.json'),null),setDefault(id){defaultId=resolveInstance(id).id;emit();return publicState();},hasLive:()=>[...instances.values()].some(i=>i.status==='ready'),readyInstances:()=>[...instances.values()].filter(i=>i.status==='ready'),defaultInstanceId:()=>defaultId,close};
}
diff --git a/apps/host/server/native-settings.mjs b/apps/host/server/native-settings.mjs
index eebab7f97..f8b248da3 100644
--- a/apps/host/server/native-settings.mjs
+++ b/apps/host/server/native-settings.mjs
@@ -1,3 +1,4 @@
+import { validMcpName, MCP_NAME_HELP } from './mcp-names.mjs';
/** Editable native keys. Unknown config keys and program paths stay intact. */
export const NATIVE_FIELDS=[
{id:'reasoning_budget_tokens',label:'Thinking token budget',group:'Responses',type:'number',min:0,max:1048576,hint:'Leave blank for the model default.'},
@@ -56,7 +57,9 @@ export function publicMcpServers(servers){return Object.fromEntries(Object.entri
export function validateMcpServers(servers,previous={}){
if(!servers||typeof servers!=='object'||Array.isArray(servers)||Object.keys(servers).length>30)throw new Error('MCP servers must be an object with at most 30 entries.');
const out={};for(const [name,s] of Object.entries(servers)){
- if(!/^[a-z0-9_-]{1,64}$/i.test(name)||!s||typeof s!=='object'||Array.isArray(s))throw new Error('Give each tool server a simple, unique name.');
+ if(!s||typeof s!=='object'||Array.isArray(s))throw new Error('Give each tool server a simple, unique name.');
+ // a name that was saved before the 32-character rule stays saveable (unrelated settings must not be blocked); the agent reports it as left out
+ if(!validMcpName(name)&&!Object.hasOwn(previous??{},name))throw new Error(MCP_NAME_HELP);
if(!!s.command===!!s.url)throw new Error(`${name}: choose a command or HTTP URL.`);
for(const key of Object.keys(s))if(!['command','args','env','cwd','url','headers','disabled'].includes(key))throw new Error(`${name}: unsupported property ${key}.`);
if(s.command&&(typeof s.command!=='string'||s.command.length>1000||/[\n\r\0]/.test(s.command)))throw new Error(`${name}: choose a valid program.`);
diff --git a/apps/host/src/components/NativeMcpEditor.tsx b/apps/host/src/components/NativeMcpEditor.tsx
index 471c4118a..c3d086150 100644
--- a/apps/host/src/components/NativeMcpEditor.tsx
+++ b/apps/host/src/components/NativeMcpEditor.tsx
@@ -1,6 +1,7 @@
import { tr } from '../lib/i18n';
import { useState } from 'react';
import { Btn, Dialog, ErrorNotice, IconBtn, Select } from './ui';
+import { MCP_NAME_HELP, validMcpName } from '../lib/mcp-names';
export function NativeMcpEditor({ text, onChange }: {
text: string;
onChange: (text: string) => void;
@@ -19,8 +20,8 @@ export function NativeMcpEditor({ text, onChange }: {
function open(id: string) { const server = servers[id] ?? {}; setEditing(id); setName(id); setTransport(server.url ? 'url' : 'command'); setAddress(server.url ?? server.command ?? ''); setArgs((server.args ?? []).join('\n')); setAdvanced(JSON.stringify(Object.fromEntries(Object.entries(server).filter(([k]) => !['url', 'command', 'args', 'disabled'].includes(k))), null, 2)); setError(''); }
function save() {
try {
- if (!/^[a-z0-9_-]{1,64}$/i.test(name))
- throw new Error('Use a simple server name: letters, numbers, hyphens or underscores.');
+ if (!validMcpName(name))
+ throw new Error(MCP_NAME_HELP);
if (!address.trim())
throw new Error('Enter the server URL or program.');
if (name !== editing && servers[name])
diff --git a/apps/host/src/lib/i18n.ts b/apps/host/src/lib/i18n.ts
index 320d22135..b6d80683c 100644
--- a/apps/host/src/lib/i18n.ts
+++ b/apps/host/src/lib/i18n.ts
@@ -7,6 +7,14 @@ import tune_es from '../locales/tune-es.json';
import tune_ru from '../locales/tune-ru.json';
import tune_pt from '../locales/tune-pt.json';
import tune_ko from '../locales/tune-ko.json';
+import tools_en from '../locales/tools-en.json';
+import tools_zh from '../locales/tools-zh.json';
+import tools_ja from '../locales/tools-ja.json';
+import tools_de from '../locales/tools-de.json';
+import tools_es from '../locales/tools-es.json';
+import tools_ru from '../locales/tools-ru.json';
+import tools_pt from '../locales/tools-pt.json';
+import tools_ko from '../locales/tools-ko.json';
import base_zh from '../locales/zh.json';
import base_ja from '../locales/ja.json';
import base_de from '../locales/de.json';
@@ -18,8 +26,9 @@ import base_ko from '../locales/ko.json';
export const LANGUAGES=[{value:'en',label:'English'},{value:'zh',label:'中文(简体)'},{value:'ja',label:'日本語'},{value:'de',label:'Deutsch'},{value:'es',label:'Español'},{value:'ru',label:'Русский'},{value:'pt',label:'Português'},{value:'ko',label:'한국어'}] as const;
export type Language=typeof LANGUAGES[number]['value'];
/* The Tune model dialog's strings live in tune-<lang>.json (apps/host/scripts/make-tune-locales.py) so other interface work does not collide with them. */
-const english:Record<string,string>={...baseEnglish,...tune_en};
-const [zh,ja,de,es,ru,pt,ko]=[{...base_zh,...tune_zh},{...base_ja,...tune_ja},{...base_de,...tune_de},{...base_es,...tune_es},{...base_ru,...tune_ru},{...base_pt,...tune_pt},{...base_ko,...tune_ko}] as Record<string,string>[];
+/* The tool-server, picture and agent-result strings of the tools and images fixes live in tools-<lang>.json for the same reason. */
+const english:Record<string,string>={...baseEnglish,...tune_en,...tools_en};
+const [zh,ja,de,es,ru,pt,ko]=[{...base_zh,...tune_zh,...tools_zh},{...base_ja,...tune_ja,...tools_ja},{...base_de,...tune_de,...tools_de},{...base_es,...tune_es,...tools_es},{...base_ru,...tune_ru,...tools_ru},{...base_pt,...tune_pt,...tools_pt},{...base_ko,...tune_ko,...tools_ko}] as Record<string,string>[];
const catalogs:Record<Language,Record<string,string>>={en:english,zh,ja,de,es,ru,pt,ko};
const entities:Record<string,string>={amp:'&',lt:'<',gt:'>',quot:'"',apos:"'",nbsp:'\u00a0'};
const decode=(text:string)=>text.replace(/&(#x[\da-f]+|#\d+|amp|lt|gt|quot|apos|nbsp);/gi,(whole,key:string)=>key[0]==='#'?String.fromCodePoint(key[1].toLowerCase()==='x'?parseInt(key.slice(2),16):parseInt(key.slice(1),10)):entities[key]??whole);
diff --git a/apps/host/src/lib/mcp-names.ts b/apps/host/src/lib/mcp-names.ts
new file mode 100644
index 000000000..bbae40099
--- /dev/null
+++ b/apps/host/src/lib/mcp-names.ts
@@ -0,0 +1,5 @@
+/** The one rule for the name of a tool server. A copy of server/mcp-names.mjs (tests/mcp-rows.test.mjs checks that they agree). */
+export const MCP_NAME_MAX = 32;
+export const MCP_NAME_RE = /^[A-Za-z0-9_-]{1,32}$/;
+export const validMcpName = (name: string) => MCP_NAME_RE.test(name);
+export const MCP_NAME_HELP = 'Use a simple server name of up to 32 characters: letters, numbers, hyphens or underscores.';
diff --git a/apps/host/src/locales/tools-de.json b/apps/host/src/locales/tools-de.json
new file mode 100644
index 000000000..ff28a2dcc
--- /dev/null
+++ b/apps/host/src/locales/tools-de.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "Verwende einen einfachen Servernamen mit höchstens 32 Zeichen: Buchstaben, Zahlen, Bindestriche oder Unterstriche.",
+ "tl02": "Diese Tool-Server wurden weggelassen, weil ihre Namen nicht erlaubt sind: {0}. Ein Name darf bis zu 32 Buchstaben, Zahlen, Bindestriche oder Unterstriche enthalten.",
+ "tl03": "Diese Tool-Server wurden weggelassen, weil sie kein Programm und keine Webadresse haben: {0}.",
+ "tl04": "Diese Tool-Server wurden weggelassen, weil ein anderer fast den gleichen Namen hat: {0}."
+}
diff --git a/apps/host/src/locales/tools-en.json b/apps/host/src/locales/tools-en.json
new file mode 100644
index 000000000..d5b4d8468
--- /dev/null
+++ b/apps/host/src/locales/tools-en.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "Use a simple server name of up to 32 characters: letters, numbers, hyphens or underscores.",
+ "tl02": "These tool servers were left out because their names are not allowed: {0}. A name can have up to 32 letters, numbers, hyphens or underscores.",
+ "tl03": "These tool servers were left out because they have no program or web address: {0}.",
+ "tl04": "These tool servers were left out because another one has almost the same name: {0}."
+}
diff --git a/apps/host/src/locales/tools-es.json b/apps/host/src/locales/tools-es.json
new file mode 100644
index 000000000..7fb02da5d
--- /dev/null
+++ b/apps/host/src/locales/tools-es.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "Usa un nombre de servidor sencillo de hasta 32 caracteres: letras, números, guiones o guiones bajos.",
+ "tl02": "Estos servidores de herramientas se han omitido porque sus nombres no están permitidos: {0}. Un nombre puede tener hasta 32 letras, números, guiones o guiones bajos.",
+ "tl03": "Estos servidores de herramientas se han omitido porque no tienen programa ni dirección web: {0}.",
+ "tl04": "Estos servidores de herramientas se han omitido porque otro tiene casi el mismo nombre: {0}."
+}
diff --git a/apps/host/src/locales/tools-ja.json b/apps/host/src/locales/tools-ja.json
new file mode 100644
index 000000000..6896a5bae
--- /dev/null
+++ b/apps/host/src/locales/tools-ja.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "サーバー名は32文字以内で、英字、数字、ハイフン、アンダースコアを使ってください。",
+ "tl02": "名前が使えないため、次のツールサーバーは除外されました: {0}。名前には、英字、数字、ハイフン、アンダースコアを32文字まで使えます。",
+ "tl03": "プログラムまたはWebアドレスがないため、次のツールサーバーは除外されました: {0}。",
+ "tl04": "ほぼ同じ名前の別のサーバーがあるため、次のツールサーバーは除外されました: {0}。"
+}
diff --git a/apps/host/src/locales/tools-ko.json b/apps/host/src/locales/tools-ko.json
new file mode 100644
index 000000000..893ed5fda
--- /dev/null
+++ b/apps/host/src/locales/tools-ko.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "32자 이내의 간단한 서버 이름을 사용하세요. 영문자, 숫자, 하이픈, 밑줄을 쓸 수 있습니다.",
+ "tl02": "이름을 사용할 수 없어 다음 도구 서버를 제외했습니다: {0}. 이름은 영문자, 숫자, 하이픈, 밑줄로 최대 32자까지 지을 수 있습니다.",
+ "tl03": "프로그램이나 웹 주소가 없어 다음 도구 서버를 제외했습니다: {0}.",
+ "tl04": "이름이 거의 같은 다른 서버가 있어 다음 도구 서버를 제외했습니다: {0}."
+}
diff --git a/apps/host/src/locales/tools-pt.json b/apps/host/src/locales/tools-pt.json
new file mode 100644
index 000000000..3f89aff05
--- /dev/null
+++ b/apps/host/src/locales/tools-pt.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "Use um nome de servidor simples com até 32 caracteres: letras, números, hífens ou sublinhados.",
+ "tl02": "Estes servidores de ferramentas foram deixados de fora porque os nomes não são permitidos: {0}. Um nome pode ter até 32 letras, números, hífens ou sublinhados.",
+ "tl03": "Estes servidores de ferramentas foram deixados de fora porque não têm programa nem endereço web: {0}.",
+ "tl04": "Estes servidores de ferramentas foram deixados de fora porque outro tem quase o mesmo nome: {0}."
+}
diff --git a/apps/host/src/locales/tools-ru.json b/apps/host/src/locales/tools-ru.json
new file mode 100644
index 000000000..fc7b37e9e
--- /dev/null
+++ b/apps/host/src/locales/tools-ru.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "Используйте простое имя сервера не длиннее 32 символов: буквы, цифры, дефисы или подчёркивания.",
+ "tl02": "Эти серверы инструментов пропущены, потому что их имена недопустимы: {0}. Имя может содержать до 32 букв, цифр, дефисов или подчёркиваний.",
+ "tl03": "Эти серверы инструментов пропущены, потому что у них нет программы или веб-адреса: {0}.",
+ "tl04": "Эти серверы инструментов пропущены, потому что у другого почти такое же имя: {0}."
+}
diff --git a/apps/host/src/locales/tools-zh.json b/apps/host/src/locales/tools-zh.json
new file mode 100644
index 000000000..d881b95d8
--- /dev/null
+++ b/apps/host/src/locales/tools-zh.json
@@ -0,0 +1,6 @@
+{
+ "tl01": "请使用不超过 32 个字符的简单服务器名称:字母、数字、连字符或下划线。",
+ "tl02": "以下工具服务器已被忽略,因为名称不被允许:{0}。名称最多可包含 32 个字母、数字、连字符或下划线。",
+ "tl03": "以下工具服务器已被忽略,因为没有程序或网址:{0}。",
+ "tl04": "以下工具服务器已被忽略,因为另一个服务器的名称几乎相同:{0}。"
+}
diff --git a/apps/host/tests/mcp-rows.test.mjs b/apps/host/tests/mcp-rows.test.mjs
new file mode 100644
index 000000000..c44411ea4
--- /dev/null
+++ b/apps/host/tests/mcp-rows.test.mjs
@@ -0,0 +1,92 @@
+// T5 / T6 (tools and images review, 2026-10-22): the agent's tool servers are the default model's, one naming rule is shared by the editor, the
+// save check and the profile, and a server that is left out is reported instead of vanishing.
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFile } from 'node:fs/promises';
+import { mcpRows, mcpSkippedNotices, buildProfile } from '../server/agent/profile.mjs';
+import { MCP_NAME_MAX, MCP_NAME_RE, validMcpName, MCP_NAME_HELP } from '../server/mcp-names.mjs';
+import { validateMcpServers } from '../server/native-settings.mjs';
+
+const cmd = { command: 'node', args: ['x.js'] };
+
+test('one rule: 32 characters of letters, numbers, hyphens and underscores', () => {
+ assert.equal(MCP_NAME_MAX, 32);
+ for (const ok of ['files', 'my_server-1', 'A', 'x'.repeat(32)]) assert.ok(validMcpName(ok), ok);
+ for (const bad of ['', 'my.server', 'x'.repeat(33), 'x'.repeat(40), 'a b', 'ä', 'a/b']) assert.ok(!validMcpName(bad), bad);
+ assert.match(MCP_NAME_HELP, /up to 32/);
+});
+
+test('the editor keeps the same rule as the host (a copy in src/lib/mcp-names.ts)', async () => {
+ const text = await readFile(new URL('../src/lib/mcp-names.ts', import.meta.url), 'utf8');
+ assert.ok(text.includes(String(MCP_NAME_RE)), 'same regular expression');
+ assert.ok(text.includes(`MCP_NAME_MAX = ${MCP_NAME_MAX}`));
+ assert.ok(text.includes(MCP_NAME_HELP), 'same help sentence');
+ const editor = await readFile(new URL('../src/components/NativeMcpEditor.tsx', import.meta.url), 'utf8');
+ assert.ok(editor.includes('validMcpName(name)') && !editor.includes('{1,64}'));
+});
+
+test('the save check refuses a new name over 32 but does not block the other settings of a name saved before', () => {
+ const long = 'x'.repeat(40);
+ assert.throws(() => validateMcpServers({ [long]: cmd }, {}), /up to 32/);
+ assert.throws(() => validateMcpServers({ 'my.server': cmd }, {}), /up to 32/);
+ assert.deepEqual(Object.keys(validateMcpServers({ [long]: cmd }, { [long]: cmd })), [long]);
+ assert.deepEqual(Object.keys(validateMcpServers({ files: cmd }, {})), ['files']);
+});
+
+test('a server that cannot be wired is reported with its reason, not dropped silently', () => {
+ const skipped = [];
+ const rows = mcpRows({
+ files: cmd, [`${'y'.repeat(40)}`]: cmd, 'my.server': cmd, empty: {}, off: { ...cmd, disabled: true },
+ Files2: cmd, 'files2': cmd,
+ }, {}, skipped);
+ assert.deepEqual(rows.map(r => r.config.serverName), ['files', 'Files2']);
+ assert.deepEqual(skipped.map(s => [s.name.slice(0, 6), s.why]), [['yyyyyy', 'name'], ['my.ser', 'name'], ['empty', 'address'], ['files2', 'duplicate']]);
+ // switched off on purpose is not an error
+ assert.ok(!skipped.some(s => s.name === 'off'));
+});
+
+test('the notices name the servers, one sentence per reason, in the catalog wording', async () => {
+ const notices = mcpSkippedNotices([{ name: 'a.b', why: 'name' }, { name: 'c'.repeat(33), why: 'name' }, { name: 'e', why: 'address' }]);
+ assert.equal(notices.length, 2);
+ assert.match(notices[0].message, /^These tool servers were left out because their names are not allowed: a\.b, c{33}\./);
+ assert.match(notices[1].message, /no program or web address: e\.$/);
+ assert.notEqual(notices[0].code, notices[1].code);
+ assert.deepEqual(mcpSkippedNotices([]), []);
+ // every sentence is in the catalog of every language (src/locales/tools-<lang>.json)
+ for (const lang of ['en', 'de', 'es', 'pt', 'ru', 'ja', 'ko', 'zh']) {
+ const catalog = JSON.parse(await readFile(new URL(`../src/locales/tools-${lang}.json`, import.meta.url), 'utf8'));
+ const english = JSON.parse(await readFile(new URL('../src/locales/tools-en.json', import.meta.url), 'utf8'));
+ for (const text of ['These tool servers were left out because their names are not allowed: {0}. A name can have up to 32 letters, numbers, hyphens or underscores.',
+ 'These tool servers were left out because they have no program or web address: {0}.',
+ 'These tool servers were left out because another one has almost the same name: {0}.']) {
+ const id = Object.keys(english).find(k => english[k] === text);
+ assert.ok(id, text);
+ assert.ok(catalog[id]?.includes('{0}'), `${lang}:${id}`);
+ }
+ }
+});
+
+test('the agent gets the tool servers of the DEFAULT instance, not the first one loaded', () => {
+ const local = [
+ { id: 'first', modelId: 'm1', baseUrl: 'http://127.0.0.1:1/v1', mcpServers: { alpha: cmd } },
+ { id: 'second', modelId: 'm2', baseUrl: 'http://127.0.0.1:2/v1', mcpServers: { beta: cmd } },
+ ];
+ const names = profile => profile.patch.match(/"serverName": "([^"]+)"/g)?.map(s => s.slice(15, -1)) ?? [];
+ assert.deepEqual(names(buildProfile({ local, defaultLocalId: 'second' })), ['beta']);
+ assert.deepEqual(names(buildProfile({ local, defaultLocalId: 'first' })), ['alpha']);
+ assert.deepEqual(names(buildProfile({ local })), ['alpha'], 'no default named: the first, as before');
+ assert.deepEqual(names(buildProfile({ local, defaultLocalId: 'gone' })), ['alpha'], 'a default that is not loaded: the first');
+ // the agent's own default model follows the same instance, and a different default changes what a running agent must be restarted for
+ assert.equal(buildProfile({ local, defaultLocalId: 'second' }).defaultRoute.instanceId, 'second');
+ assert.notEqual(buildProfile({ local, defaultLocalId: 'second' }).toolsSignature, buildProfile({ local, defaultLocalId: 'first' }).toolsSignature);
+ // the Settings servers are added for every default
+ const withSettings = buildProfile({ local, defaultLocalId: 'second', tools: { off: new Set(), search: { provider: 'builtin', key: '' }, servers: { gamma: cmd } } });
+ assert.deepEqual(names(withSettings).sort(), ['beta', 'gamma']);
+});
+
+test('buildProfile hands the skipped servers on for the chat to report', () => {
+ const local = [{ id: 'a', modelId: 'm', baseUrl: 'http://127.0.0.1:1/v1', mcpServers: { ['z'.repeat(33)]: cmd, ok: cmd } }];
+ const profile = buildProfile({ local, defaultLocalId: 'a' });
+ assert.deepEqual(profile.mcpSkipped.map(s => s.why), ['name']);
+ assert.match(profile.patch, /"serverName": "ok"/);
+});
diff --git a/apps/host/tests/tools-locales.test.mjs b/apps/host/tests/tools-locales.test.mjs
new file mode 100644
index 000000000..294ddb7a4
--- /dev/null
+++ b/apps/host/tests/tools-locales.test.mjs
@@ -0,0 +1,42 @@
+// The strings of the tools and images fixes (src/locales/tools-<lang>.json) exist in every language with the same slots and no empty text,
+// do not collide with the main catalog, and translate through tr().
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFile } from 'node:fs/promises';
+import { build } from 'esbuild';
+
+const languages = ['en', 'zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko'];
+const catalogs = Object.fromEntries(await Promise.all(languages.map(async l => [l, JSON.parse(await readFile(`src/locales/tools-${l}.json`, 'utf8'))])));
+const main = JSON.parse(await readFile('src/locales/en.json', 'utf8'));
+const tune = JSON.parse(await readFile('src/locales/tune-en.json', 'utf8'));
+const slots = text => [...text.matchAll(/\{\d+\}/g)].map(m => m[0]).sort();
+const compiled = await build({ stdin: { contents: "export * from './src/lib/i18n';", resolveDir: process.cwd() }, bundle: true, write: false, format: 'esm', platform: 'node', loader: { '.json': 'json' } });
+const { tr, setTranslationLanguage } = await import(`data:text/javascript;base64,${Buffer.from(compiled.outputFiles[0].text).toString('base64')}`);
+
+test('every language has every tools string with the same slots and no empty text', () => {
+ for (const l of languages) {
+ assert.deepEqual(Object.keys(catalogs[l]), Object.keys(catalogs.en), l);
+ for (const [id, source] of Object.entries(catalogs.en)) {
+ assert.ok(catalogs[l][id].trim(), `${l}:${id} is empty`);
+ assert.deepEqual(slots(catalogs[l][id]), slots(source), `${l}:${id}`);
+ }
+ }
+});
+
+test('the ids and texts do not collide with the main or Tune catalogs, and translate through tr()', () => {
+ const seen = new Set([...Object.values(main), ...Object.values(tune)]);
+ for (const [id, text] of Object.entries(catalogs.en)) {
+ assert.ok(!(id in main) && !(id in tune), id);
+ assert.ok(!seen.has(text), `already in another catalog: ${text}`);
+ }
+ const first = Object.keys(catalogs.en)[0];
+ for (const l of languages) {
+ setTranslationLanguage(l);
+ assert.equal(tr(catalogs.en[first]), catalogs[l][first], l);
+ }
+ setTranslationLanguage('de');
+ const withName = Object.entries(catalogs.en).find(([, t]) => t.includes('{0}'));
+ const shown = tr(withName[1].replace('{0}', 'files, a.b'));
+ assert.equal(shown, catalogs.de[withName[0]].replace('{0}', 'files, a.b'));
+ setTranslationLanguage('en');
+});