nanocoai/nanoclaw · warning
Dropping invalid stored MCP server
Error message
Dropping invalid stored MCP server
What it means
A container_config's stored MCP server entry failed validation and was dropped from the sanitized config. The agent will run without that MCP server; the bad entry remains in the DB until corrected.
Source
Thrown at src/container-config.ts:306
if (
server.type !== 'http' &&
typeof pluginRoot === 'string' &&
pluginRoot.startsWith(`${CONTAINER_PLUGINS_DIR}/`)
) {
server.pluginRoot = pluginRoot;
}
if (server.type !== 'http' && server.cwd && !server.pluginRoot) {
// cwd resolves against a plugin root; without provenance nothing can
// resolve it. This strip is the ONLY layer (the runtime passes
// provenance-less servers through untouched), and the breadcrumb
// lands in host logs instead of nowhere.
delete server.cwd;
log.warn('Stripping cwd from stored MCP server without plugin provenance', { group: groupName, server: name });
}
servers[name] = server;
// eslint-disable-next-line no-catch-all/no-catch-all -- validation failures are data errors, not bugs
} catch (err) {
log.warn('Dropping invalid stored MCP server', {
group: groupName,
server: name,
reason: err instanceof Error ? err.message : String(err),
});
}
}
return servers;
}
/**
* runtime_tier is an isolation control: dropping an unknown stored value would
* silently compose the group at the default tier — a weaker boundary than the
* one the value asked for. Fail closed instead: the group refuses to compose
* until the stored value is fixed. (A *declared* tier the driver cannot
* realize is refused separately by validateSpec, against the driver's
* capabilities.)
*/
function parseRuntimeTier(raw: string | null | undefined, groupName: string): 'container' | 'vm' | undefined {View on GitHub (pinned to 294ef2aee8)
Solutions
- Inspect `ncl groups config get --id <group>` and find the server named in the log
- Remove and re-add the server: `ncl groups config remove-mcp-server` then `add-mcp-server` with current syntax
- Never edit the DB row directly; use the CLI so validation runs
Example fix
// before
config.mcpServers['foo'] = { cmd: 'npx foo' } // hand-edited, invalid
// after
ncl groups config add-mcp-server --id <group> --name foo --command npx --args foo Defensive patterns
Strategy: validation
Validate before calling
ncl groups config get --id <group> // review mcpServers entries before upgrade
Type guard
function looksLikeMcpServer(x: unknown): boolean {
return !!x && typeof x === 'object' && typeof (x as any).command === 'string';
} Try / catch
try { sanitize(stored) } catch (e) { /* drop entry, re-add via CLI */ } Prevention
- Only add MCP servers via `ncl groups config add-mcp-server`
- Never hand-edit container_configs.mcp_servers JSON
- After upgrades, diff `config get` to spot dropped servers
When it happens
Trigger: `ncl groups config add-mcp-server` stored an entry whose shape later failed schema validation — invalid command/env shape, missing required fields, or an entry hand-edited in the DB.
Common situations: Version upgrades that tightened MCP server validation; hand-edited container.json or DB rows; entries created by older self-mod tooling.
Related errors
- server name must be 1-64 characters of letters, digits, "_"
- type must be "stdio", "http", or "streamable-http"
- Nothing to update — provide at least one of: --provider, --m
- --name is required
- unsupported transport "sse"
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/37a3eb68ff2ff6ea.
Report an issue: GitHub.