Skip to content

Make nodespace mcp database-independent: remove external_tools_enabled and the database binding #3672

Closed

Description

@malibio

Overview

#3664 (ADR-095) made nodespace mcp depend on a database: it serves tools only when the routed database's external_tools_enabled is true, mcp install/uninstall set that flag in a selected database, and the server binds to one database id at start. That is wrong. NodeSpace works against one active database at a time, the daemon's default, and the user decides which. mcp is the app's passthrough to the CLI and must act on whichever database is active when a call is made, with no database dependency of its own.

Problem Statement

  • external_tools_enabled is a field of database-settings that does not belong there: enablement is a machine-level decision, not a database one.
  • mcp install/uninstall/status and the server need a running daemon and a selected database; uninstall cannot complete its disable step when the daemon is down.
  • The server pins a database id at start, so switching the active database does not move it, and a client enabled for one database is a different trust question from one enabled for another. The review of Move the daemon's settings into each database's settings node and delete daemon.toml (ADR-095) #3664 found a bypass here (a call naming another --database) and closed it by binding harder, which is the wrong direction.
  • The passthrough can run database use, letting a client change the active database, which is the user's decision.

Proposed Solution

  • Remove external_tools_enabled from the database-settings schema, wire type, typed update, generated TypeScript and the node-types.md sheet (node type sequence applies; reset the database, no migration).
  • Enablement is the client config nodespace mcp install writes: install writes it, uninstall removes it, status reports whether it is present. No flag is stored anywhere. install/uninstall/status and the server no longer connect to the daemon for settings, take no database, and print no database label.
  • The server does not bind a database. It forwards calls with the daemon socket it started with and lets the CLI route to the active (default) database as any other command does. A call cannot select a database: refuse --database (both spellings) and --socket naming anything other than the server's own daemon. Refuse the database subcommand in calls.
  • Delete the per-database refusal test coverage and the id-binding added in Move the daemon's settings into each database's settings node and delete daemon.toml (ADR-095) #3664; keep the refusal of --database/--socket in calls, now for the active-database rule.
  • Update the CLI reference (packages/skill/references/cli.md hand-written "Database settings" section and the generated mcp text) and regenerate with bun run skill:gen.

Documentation

  • ADR-095 §4 - amended 2026-10-06: external tools are not a database setting; mcp acts on the active database; enablement is mcp install; database registry commands are refused in the passthrough.
  • ADR-038 - Trust Boundary: explicit user enablement for mcp is nodespace mcp install, machine-level.
  • Node type sequence - mandatory: a field is removed from a core type.
  • Updates, pushed just before the merge: the database-settings sheet in Node Types (remove the external_tools_enabled row and its consumer bullet; the merge gate compares the sheet with the schema).

Architecture Impact

Amends ADR-095 §4 and the ADR-038 trust-boundary note. Both are already amended in nodespace-docs (2026-10-06); no further decision change is needed. This reverses the external_tools_enabled field and the mcp database binding that #3664 shipped.

Acceptance Criteria

  • database-settings no longer declares external_tools_enabled; schema, DatabaseSettingsFields, the typed update, TS (bun run gen:types) and the sheet agree; bun run node-types:check passes. A flat node update naming the field is rejected as an undeclared key.
  • nodespace mcp install, uninstall and status make no daemon connection and take no database; status reports whether a client config is present; uninstall works with the daemon stopped.
  • The server starts without reading any settings node and serves with the daemon down at start; each call acts on the active database at that moment: after nodespace database use <other>, the next call operates on <other>.
  • A call naming --database (either spelling) or a --socket other than the server's own is refused; a call to the database subcommand is refused; a printed delete confirm_command still replays.
  • The routing-header binding, database label and id-resolution added to commands/mcp.rs in Move the daemon's settings into each database's settings node and delete daemon.toml (ADR-095) #3664 are gone, with their tests replaced by the active-database tests above.
  • CLI guidance describes mcp as enabled by install, acting on the active database; SKILL.md drift check passes.
  • bun run test:changed passes; code passes bun run quality:fix.

Technical Specifications

Reference Files

  • packages/cli/src/commands/mcp.rs: connect_settings_target, read_settings, set_external_tools_enabled, enforce_enabled, run_server, build_child_args, install, uninstall, status.
  • packages/cli/tests/it/mcp_integration.rs: the per-database tests added in Move the daemon's settings into each database's settings node and delete daemon.toml (ADR-095) #3664.
  • packages/nodespace-types/src/database_settings.rs, packages/nodespace-types/src/convert.rs: field, update, promoted fields.
  • packages/core/src/models/core_schemas.rs: the database-settings schema and its test.
  • packages/core/tests/it/database_settings_fields_test.rs, packages/daemon/tests/it/per_db_settings.rs, packages/core/src/services/node_service/mod.rs (seed test), packages/desktop-app/app-lib/tests/it/adapter_contract_test.rs: expectations naming the field.
  • packages/skill/references/cli.md, packages/skill/src/mcp-installer.ts (comments).

Implementation Details

  • Following the project's no-migration rule: change the shape and reset the database; no code reads or removes an existing external_tools_enabled value.
  • Whether a client config is present is what the installer's mcp-status already reports; reuse it.

Related Issues

Non-Goals

  • Selecting or switching the active database from the passthrough.
  • Per-client or per-database trust levels.

Activity

  1. self-assigned this
    on Oct 6, 2026
  2. mstomar125 commented on Oct 6, 2026

    @mstomar125
    Contributor

    Picking this up now, following the proposed solution in the issue. If this is already in progress on your side, comment here and I'll stop and hand it over. I'll check this issue and the open PRs again before pushing anything.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions