Repository navigation
feat: manage MCP servers in Settings - #694
Merged
Merged
Conversation
This was referenced Oct 9, 2026
danyaberezun
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 9, 2026 06:58
819380b to
cbf815f
Compare
danyaberezun
marked this pull request as ready for review
October 9, 2026 08:01
danyaberezun
requested review from
Olga Lavrichenko (OLavrik),
Rustam Sadykov (SBOne-Kenobi) and
Rinat S (rsolmano)
as code owners
October 9, 2026 08:01
danyaberezun
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 9, 2026 10:51
cbf815f to
1281754
Compare
danyaberezun
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 9, 2026 11:08
1281754 to
312f5db
Compare
danyaberezun
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 9, 2026 11:25
312f5db to
53335e1
Compare
danyaberezun
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 9, 2026 11:43
53335e1 to
7ac5ef1
Compare
danyaberezun
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 9, 2026 11:52
7ac5ef1 to
e95a7ee
Compare
Rinat S (rsolmano)
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 13, 2026 11:56
ca4a11f to
0ba359d
Compare
Rinat S (rsolmano)
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 13, 2026 12:57
0ba359d to
9b5ba15
Compare
Rinat S (rsolmano)
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 13, 2026 13:04
9b5ba15 to
d732674
Compare
Rinat S (rsolmano)
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 13, 2026 13:19
d732674 to
a57bc8e
Compare
Rinat S (rsolmano)
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 13, 2026 13:26
a57bc8e to
71955b9
Compare
- Settings › MCP servers: per-workspace rows from configuration plus every live chat's status, with approve, enable, exposure, sign in, test, reconnect, reload, open a chat, show log, share with repo and remove. - Add from five pinned presets, a form or pasted JSON; references only for secrets; repository writes carry the rendered fingerprint. - The chat's attention marker and resource rows link to the section. - A managing-mcp-servers host skill tells the agent to edit mcp.json.
Settings kept the cached project-scope rows actionable until the mcp.list refresh landed; they are now filtered client-side while the project is untrusted. The MCP settings e2e waits for the auto-opened persisted chat before adding a server instead of racing it.
An open Edit, Review & approve or project-scope Remove dialog closes, and an open Add dialog falls back to User scope, so a stale dialog cannot act on repository entries Settings no longer lists.
… fingerprint, drop stale repository flows on revoke A user-server toggle sends just the changed field so two clients cannot overwrite each other's setting; a project-scope Remove carries the rendered fingerprint; a trust revoke also resets a project-scope Add review step and ignores an Edit/Review read that was still in flight.
…this workspace's MCP sign-in Edit and Remove build their target through mcpRenderedTarget, matching the host's McpRenderedTarget contract; the MCP login dialog mounts only for a sign-in started in the workspace Settings is showing.
…ated content is mcp.json
…nt and report blank rows
Rinat S (rsolmano)
force-pushed
the
mcp-stack/6-mcp-settings
branch
from
October 13, 2026 13:48
71955b9 to
7bf2afe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With the host service in place (#692) and the chat's server list (#693), every management step still
means editing
mcp.jsonby hand and having apiexecutable, which ThinkRail doesn't ship. That coversadding a server, approving a repository-defined one, signing in to an OAuth server, turning a server off
for one project, and reading its log.
Approach
Settings › MCP servers covers the active workspace's project. It is hidden below
MCP_PROTOCOL_VERSION.deriveMcpServerRows) from the configured entries plusevery live chat's status. A problem in any chat wins, and the row names the chats reporting it.
primary and one secondary action. The rest are in a menu: Sign in / Sign out, Test connection,
Reconnect, Reload now, Open a chat, Show log, Share with repo, Remove.
then sends
mcp.approveat that exact fingerprint.One write rule.
mcp.setProjectOverride, and theglobal
mcp.jsonis never written..pi/mcp.jsonthroughmcp.update, which carries therendered fingerprint as
expectedFingerprint. A stale row therefore never overwrites or approvesnewer content.
entry, so the edit could not be lossless.
Adding a server. There are three ways, and each shows what will run before it writes:
disabled user entry with a per-project opt-in.
Settings stores references only. Secrets must be
${VAR}or!command. Credentials in URLs and aplain
oauth.clientSecretare refused. A!commandthat is slow to resolve gets a warning, because piresolves it on every connect.
Sign-in and Test connection reuse
auth/LoginDialog. The login state keeps the push's MCPtarget, so only an MCP sign-in opens this section's dialog, and Providers ignores it.Chat links. The chat's MCP attention marker (sign-in, failure, approval) and the inspector's
Settings action open this section. Open a chat shares the workbench's
startChatInTab.Host skill.
managing-mcp-serverstells the agent to editmcp.json, never runpi mcp …, andpoint the user at this section. The server's own
skills/directory is wired into dev and thecompiled binary.
Changes
apps/web/src/panels/), each with tests:McpSettings.tsxandMcpServerDialogs.tsx: add, approve, details, log, remove;mcpServerView.ts: the status-table view model;mcpEntries.ts: form/JSON parsing and the reference rules;mcpPresets.ts.store/selectMcpServers.tsgainsderiveMcpServerRows/McpServerRow.selectChatResourceGroupsgainsmcpAttentionCount.transportbarrel exportsrequestMcpListfor mutations.SettingsDialog.tsx, plusSettingsSection.Mcp, adisabledstate for
ToggleSegment, and the logintargetinauth/loginState.tsandappStore.ResourcesAttentionin the chat header, and the Settings action on the inspector's MCProws.
panels/openChat.tsgainsstartChatInTab, andshell/WorkspaceWorkbench.tsxuses it.
packages/server/skills/managing-mcp-servers/SKILL.md;extensions.ts(dev) andbuildSupport.ts(binary);apps/cli/SPEC.md.goal-and-requirements.mdgain the MCP capability.UI-TERMINOLOGY.mdand thespecs are updated.
e2e/mcp-settings.spec.ts:approved.
Notes for reviewers:
skills/directory into dev and the compiled binary for the hostskill, and the server/contracts specs now name Settings as the client of the probe and approval paths.
panels/openChat.ts(startChatInTab) so Open a chat shares it; behaviouris unchanged.
deriveMcpServerRows, the starting-since bound), the attention count and the widerequestMcpListarrive here with their first callers.Screenshots
Captured with the e2e harness's hermetic fixture project, 1440×900 at 2×, dark theme; the same throwaway scenario ran on the base PR's tree (before) and on this PR's tree (after).
Settings sections
Settings › MCP servers — a connected user server and a repository server awaiting approval (new in this PR)
Add server (presets tier) (new in this PR)
Review & approve (new in this PR)
Chat header MCP attention marker (new in this PR)
Related issues
No tracked issue. This is part of the MCP support stack (milestone 1); review and merge in order:
Base: #693, so this diff shows only this layer. The branches remain stacked for merge order; checks on the current head are listed by GitHub.
Review hardening (2026-10-12)
Rebased onto
mainat9d6ad0b2, preserving Extensions Settings/reload integration. MCP uses protocol 83; the extension catalog retains 82. Existing MCP product policy and pi engine ownership are unchanged.Latest verification
These results supersede the earlier counts/environment limitations below. The latest combined stack tree was compared byte-for-byte with the locally verified canonical tree; each restacked layer also received focused tests and server/web typechecks.
check:deps, boundaries, seams, spec-surface, compiler, lint) and typecheck → green; all 20 packages, including desktop. Compiler baseline was not relaxed.bun run test, with isolated HOME/data/agent directories and no ambient provider credentials → all 20 package tasks plus root scripts passed. After the last UI-only preset correction, all 1,831 frontendsrctests were rerun successfully; other package inputs were unchanged.2451693b) complete no-agent browser suite → 552 passed, all four isolated shards, using the repository’s standard CI retry configuration. Earlier local repeats exposed the unchanged touch-momentum flake, reproduced on cleanmain3/8 times; no scroll code/assertion was changed or skipped. The final suite includes the preset opt-in recovery and JSON partial-add regressions.bun apps/cli/scripts/build-binary.ts) +bun run smoke:binary→ passed, including the shared MCP artifact probe; vanilla-pi package parity passed under Node 22.19.0.Stack status (2026-10-13): rebased onto
mainbf4da661on top of #723 (pi 1.2.0), which fixes the vanilla-pi parity gate broken by thepi-codemode1.2.0 release. #723 merges first; this stack then rebases to drop that commit. The branches remain stacked in the originalorder and merge one at a time through the merge queue.
Pi 1.2.0 (2026-10-13)
Every pi adaptation in this layer was re-checked against the installed 1.2.0 package (see
pi-compatibility.mdin #695): the publicMCP exports, loader/writer code, shutdown ordering and startup dispatch are unchanged, so nothing is removed. Pi 1.2 widens
structuredContentto any JSON value and stops listing resources on connect (connected · N tools · resources); the status parser nowcounts tools in that dotted wording (it previously read 0 for it) and both changes have fixtures.
Testing
bf4da661: fast gates +bun run typecheck20/20; isolatedbun run test20/20 packages;bun run check:pi-packagesOK (fresh npm install of pi 1.2.0 under Node 22.19);bun run e2e551 passed + the known touch-momentumflaky (passed on retry);
build-binary+smoke:binarypassed; focused liveagent/queue/chat-resources/tool-cards/subagentsspecs 11 passed; independent review of the upgrade and the new stack commits → no findings.
On this PR's tree:
bunx turbo run typecheck --filter='!@thinkrail/desktop'→ 19/19bun test packages/server packages/pi-delegation packages/pi-subagents packages/pi-background-commands packages/pi-todos packages/pi-dag packages/pi-thinkrail-workflow packages/contracts packages/shared packages/artifact-tests→ 2001 pass, 10 skip, 0 failcd apps/web && bun test→ 1635 passbun test ./scripts/→ 91 pass;bunx turbo run test --continuefor every other package (desktop excluded) → 17/17 tasksbun run lint→ clean, no warnings;check:deps,check:boundaries,check:seams,check:spec-surface→ OKbun run e2e→ all 8 shards passed (495 tests)bun run build:binary && bun run smoke:binary→ smoke OK. The binary carries the host skillDesktop:
@thinkrail/desktop's typecheck could not run as configured on this machine. Itselectrobun preparestep waits on a shared cache lock that another process holds. Run withoutprepare,cd apps/desktop && tsc --noEmitreports the same 18 electrobun-declaration errors (TS7016/TS7006/TS7031) as onorigin/mainand none from this change. Itsbun testpasses (123 pass, 1 skip, as onorigin/main). This change touches no desktop file.Checklist
bun run lint,bun run typecheck,bun run testbun run e2e, orbun run e2e:fullwhen touching agent behavior)SPEC.md/ top-level specs updated to reflect any boundary, contract, or behavior change