Repository navigation
feat: scope MCP connectors through mcp.json, Project Settings and This Session - #190
Merged
Merged
Conversation
…s Session
Stored connections are no longer attached to every session. A connector reaches
a session only through `{ "connector": "<id>" }` in `mcp.json`, or through the
Project Settings and This Session layers the host stores.
- mcp.json entries are a connector, a url or a command, used as written. The
project file replaces the user file's entry of the same name or connector,
like a `.env` file; partial entries, `auth` and `connection` are refused.
- The soft layers can switch off what the layer below has on, never switch on
what it has off, and add what no layer below names. One resolver in the
harness serves the runtime, the host RPCs and the CLI.
- A connector runs on the session's pick, else Project Settings', else the
vault's Default, from stored connections only. The account is pinned per run
and kept by a resumed run; a connection turned off mid-turn refuses as
disabled. Deleting the Default promotes the oldest remaining connection.
- Host RPCs `mcp.view` and `mcp.edit`; CLI `mcp add --connector`,
`mcp view|on|off|attach|detach|account|reset`, and `mcp list` checks
connector entries against the local vault.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…from A live suite against the real Linear MCP server and live models: Linear added by This Session, by Project Settings, named by the user mcp.json, by the project mcp.json, and by both. In each, `whoami` answers on the vault's Default, a session switched to a wrong key does not reach Linear at its next run, and a switched-off or removed connector is gone. It runs when `CODEWORK_LIVE_LINEAR_HOME` names a home with a working Linear connection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…enAI The live Linear suite asks for the last 10 issues through Linear's read-only `list_issues` instead of `whoami`, runs against Anthropic and OpenAI's API, and writes the replies to `CODEWORK_LIVE_LINEAR_REPLIES` when it is set, never into the artifact. A run cut off before its cleanup no longer blocks the next. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Stored connections are no longer attached to every session. A connector reaches a session only when an
mcp.jsonnames it ({ "connector": "app.linear" }), or when Project Settings or This Session adds it. Both soft layers are stored by the host that runs the session, never in a file. The desktop UI follows in a stacked PR.mcp.json
connector, aurlor acommand, used as written. The project file replaces the user file's entry of the same name or connector, like a.envfile. Nothing is merged.{ "enabled": false }over a user server),auth(replaced byconnector), aconnectionfield, and the same connector named twice in one file.Soft layers and accounts (harness)
mcp/layers.tsholds one resolver for the runtime, the host RPCs and the CLI. It also hasedit, which enforces the three rules: a layer can switch off what the layer below has on, can never switch on what it has off (a file's"enabled": falseincluded), and can add what no layer below names.mcp_account): a Make Default lands at the next run, and a run resumed after a restart keeps its account. A connection turned off mid-turn refuses that turn's remaining calls withMCP server "x" is disabled., not the sign-in hint.project_mcp,session_mcp,mcp_account.Plugin, schema and vault
ServerConfiggainsConnectorServer { connector, connection? }.HttpServer.authis removed, andMcpServer.overridebecomesfrom.listMcpConnections(auto-attach) is replaced bymcpConnections(): every stored MCP connection, enabled or not.mcp.viewandmcp.edittakeprojectId,sessionId, or adirectorythe host maps to a project without creating one.CLI
mcp add --connector <id>, plusmcp view|on|off|attach|detach|account|resetthrough the home's server.mcp listchecks connector entries against the local vault.mcp loginon a connector entry points toconnect login <connection>.Breaking, by design (no users yet):
authentries and partial project entries stop loading, and vault connections no longer appear in sessions until something adds them.Testing
New harness E2E suite
mcp.connector.test.ts, with a stub vault and a real MCP server over HTTP:Server E2E
server.mcp.layers.json: views, edits and every refusal, a turned-off connection, and promotion.CLI E2E
cli.mcp.layers.test.ts: a realserve, project resolved from the directory, and the next turn's declared tools following the layers.Updated suites (artifact diffs reviewed):
mcp.session,mcp.race,settings,db,server.settings,mcpcli,cli.mcp.oauthandconnector.Full harness run: 641 passed. The two live prompt suites that failed did so only because this worktree had no generated model catalog; with a fresh catalog they pass (4 passed, 6 skipped for keys not set).
vp run verifypasses.New live suite
cli.mcp.linear.live.test.tsruns against the real Linear MCP server, with Anthropicclaude-haiku-5-5and OpenAIgpt-6-luna, over five placements:~/.codework/mcp.json..codework/mcp.json.In each placement:
list_issueson the vault's Default;list_issuescall at its next run;All 30 checks passed (2 providers × 5 placements × 3 checks). The prompt suites also pass with these keys: 8 passed, 2 skipped (OpenRouter, key not set).
cli.mcp.oauthfailed once on timing while running alongside other suites, and passed alone (9 of 9).In a real session with a real model call, a switched-off server wasn't offered, and an account picked in Project Settings took effect at the next run.
Done by Claude Opus 5.5 in Claude Code; the CLI half was built by an Opus subagent and reviewed.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.