Files
magpie/docs/subsystems
yetone 56900e4845 agent: Claude Desktop on magpie gets the MCP servers the user added signed in (aa86222 on Discord)
aa86222 on Discord: Claude Desktop on magpie's gateway (3p mode) didn't
sync its connectors. Two parts:

- A claude.ai account's connectors can't reach 3p mode. Desktop calls
  them through claude.ai with the signed-in account
  (/api/organizations/<org>/mcp/servers/<id>/tools/call in Desktop
  2.7032's main bundle, refused with no_active_org without an account),
  and 3p mode has none. Anthropic's 3p docs say "Made by Anthropic"
  connectors are only in standard Desktop; others reach 3p through
  managedMcpServers or plugins
  (claude.com/docs/third-party/claude-desktop/extensions). magpie doesn't
  answer or pass any of these: they never go to the inference gateway.
- What magpie can do: 3p mode reads its MCP servers from
  Claude-3p/claude_desktop_config.json, a file of its own, so the
  servers added signed in (Settings -> Developer, in
  Claude/claude_desktop_config.json) were gone from the list. Switching
  on now copies each mcpServers entry Claude-3p has none of the same
  name for (desktopCarryMCP). One already there (the user's, or the
  Library's, which writes both files) stays. Sync does it once for a
  Desktop already on magpie (stash mark claude-desktop.mcp-seen), so a
  server the user takes out in 3p isn't brought back. Off takes back
  each copy still as copied (stash claude-desktop.mcp); one the user
  changed stays. Claude's own file is never written.

Run, at this tree:
- go test -count=1 -timeout 45m ./internal/agent ./internal/library
  ./internal/desktopdir: ok
- gofmt -l internal/agent: clean; go vet ./internal/agent for darwin,
  GOOS=linux and GOOS=windows: ok
- the built binary in a sandbox HOME (macOS): `magpie claude-desktop
  provider magpie` copied a filesystem server into Claude-3p's
  claude_desktop_config.json with Claude's file byte for byte; `provider
  ""` removed Claude-3p again, Claude's file unchanged.

Broken by hand: desktopCarryMCP returning at once turns
TestClaudeDesktopCarriesTheMCPServers, TestClaudeDesktopMCPKeepsThe3pServers
and TestClaudeDesktopSyncCarriesTheMCPServersOnce red; desktopUncarryMCP
returning at once turns the first two red (off left the copies); Sync
carrying on every run turns the third red.

Not tried: a real Claude Desktop reading the carried servers in 3p mode
(it reads ~/Library, so the sandbox can't host it, and the live one is
not touched); Windows and Linux folders (same code path through
desktopSets); the reporter's own connectors, which weren't described
beyond "can't sync" and are most likely claude.ai ones, which this
cannot bring.
2026-10-26 15:46:02 +08:00
..

Subsystem design references

These pages describe current responsibilities, runtime paths, state, and contracts. Start with the subsystem relevant to your task, then follow its source links to verify the implementation you change.

Subsystem Reference
Built-in subscriptions moving to plugins Provider and plugin ownership
Built-in plugins: registry, lifecycle, plugins.yml, presets, settings schemas, the window's kernel (slots, error boundary, kit) Plugin runtime
Plugins that run on the gateway's requests and replies Gateway middleware
Tools that plugins give, offered to every agent as an MCP server Plugin tools
Plugins that await context recall and observe completed replies Asynchronous gateway request hooks
Claude subscription turns across Claude Code runs Claude subscription bridge
How the gateway picks a provider, key or account, and falls back Gateway routing and fallback
Gateway Session Aggregation Gateway Session Aggregation
Connecting an agent's config to the gateway, drift, disconnect, WSL twins Agent wiring
Providers, keys, subscription accounts, refresh and allowance Providers and accounts
Instructions, MCP servers, skills and RTK written into agents Library
Tray, panel, window, magpie web and the page's JSON API GUI app shell
Encrypted backups and setup synchronization over WebDAV, S3 or GitHub Sync and backup

A subsystem can span several packages or repositories. Its reference describes the behavior those parts provide together; it does not need to list every function.

Maintain a reference

Update the owning reference in the same PR when a change alters a documented responsibility, interface, state transition, runtime path, compatibility rule, or failure behavior. An internal refactor that preserves these contracts does not require a prose change.

Keep each fact in one reference and link to it from agent instructions or other pages. Link to source files and named symbols rather than copying implementation details that change frequently. Explain field meanings and constraints that signatures alone do not express.

For a new reference, include the responsibilities and boundaries, source of truth, main runtime paths, state transitions, important constraints, and existing verification commands. Include failure and compatibility behavior where relevant. Document current behavior separately from proposed changes; the proposal belongs in its issue or PR.

Describe a PR's semantic changes

For each affected subsystem, explain the observable change with its trigger and before/after behavior. Include changes to interfaces, state, compatibility, and failure behavior when relevant. Link the affected reference, implementation, and verification evidence. State when a refactor preserves the documented behavior.

For example, a change to plugin adoption should explain which migration state and account condition trigger it, which implementation handles requests before and after adoption, and which test exercises that transition.

This is an author-provided explanation that a reviewer verifies against the diff and surrounding code. It is not an automatically proven compatibility verdict.

Review a change

  1. Identify the affected subsystem and the actual runtime path, including plugin or built-in ownership.
  2. Compare the claimed before/after behavior with the base and head implementation. Trace relevant callers and state transitions beyond the changed lines.
  3. Check that changed contracts appear in the owning reference and that source links still resolve.
  4. Check that the cited tests or runtime evidence exercise the claimed behavior. Report checks that were not run.

A documentation update alone does not prove the implementation. Existing tests and runtime evidence remain necessary for behavior changes.