Skip to content

feat(config): start a project's MCP and LSP servers only after it is trusted - #528

Merged
mrnasil merged 2 commits into
mainfrom
feat/project-trust
Dec 2, 2026
Merged

mrnasil merged 2 commits into
mainfrom
feat/project-trust

Conversation

@mrnasil

@mrnasil mrnasil commented Dec 2, 2026

Copy link
Copy Markdown
Member

A project's .whycodes/config.toml comes with the repository. Its [mcp_servers] and [lsp.servers] tables name programs to start and endpoints to connect to, and they were merged into the config and started (TUI startup, whycodes serve) before the user approved anything. Opening a cloned repository was enough to run a program it chose.

What changes

  • The two tables are left out of the layered config until the user trusts the project. Servers in the global config are not affected.
  • whycodes trust records the trust in <data_dir>/trusted-projects.json together with the exact definitions (canonical JSON, sorted keys), so any change to them asks again. whycodes trust --revoke forgets it.
  • WHYCODES_TRUST_PROJECT=1 trusts every project config, for CI and containers.
  • The TUI lists the servers that were left out in the chat, with a toast; whycodes serve prints them to stderr; the log has a warning.

Behaviour change

Anyone who already has MCP or LSP servers in a project config has to run whycodes trust once in that project after upgrading.

Not in this PR

  • No in-TUI approval dialog: the notice points at the command, and the servers start on the next launch.
  • <project>/.whycodes/plugins is still loaded without a gate.
  • A project config can still tune a built-in LSP server only through a trusted [lsp.servers] entry (for example disabled = true now also needs trust).

Verification

  • New tests in config (trust, change detection, env switch, revoke, unwritable store), cli (trust report, notice, argument parsing) and tui (chat notice).
  • Linux line coverage of whycodes-config measured locally: no missed lines.
  • cli and tui test suites pass on Windows except the failures that also fail on main there (lockfile, upgrade, run_shell, two plain_repl integration tests, the clipboard image test).

🤖 Generated with Claude Code

mrnasil and others added 2 commits December 2, 2026 17:59
…trusted

A project config comes with the repository. Its [mcp_servers] and
[lsp.servers] tables name programs to start, and they were merged and
started before the user approved anything. They are now left out of the
layered config until the user runs `whycodes trust` in the project. The
trust is stored with the exact definitions, so a change asks again.
WHYCODES_TRUST_PROJECT=1 trusts every project config (CI, containers).

The TUI lists the servers that were left out in the chat; `whycodes serve`
prints them to stderr.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@mrnasil
mrnasil merged commit 166c395 into main Dec 2, 2026
7 checks passed
@mrnasil
mrnasil deleted the feat/project-trust branch December 2, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant