feat(external-agent): one-click MCP connect for Qoder and 千问办公 - #146
Open
Alphaxiaoteng wants to merge 1 commit into
Open
feat(external-agent): one-click MCP connect for Qoder and 千问办公#146Alphaxiaoteng wants to merge 1 commit into
Alphaxiaoteng wants to merge 1 commit into
Conversation
Qoder keeps its MCP servers in a mergeable settings.json, so the guide can write it directly. It ships an international and a China build that hold the same file under ~/.qoder or ~/.qoder-cn, and only the installed one matters, so both existing homes are updated and an absent sibling is skipped. 千问办公 has no on-disk config for custom MCP servers - they live in its in-app connector store - so a file writer would only invent one. Its card copies the exact JSON its importer expects instead, and shows it so the text can still be selected when the clipboard is blocked.
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.
Why
The MCP guide already writes the endpoint + bearer token into Claude Code, Codex, Cursor and Antigravity. Two agents people actually run are missing, and they need different treatment — which is the point of this PR:
settings.jsonthat supportsheaders, so it can be a genuine one-click connect.Change
Server (
server/external-agent/client-connect.ts)CONNECT_CLIENTSgainsqoder.connectJsonClient→connectJsonClients(a client may now have more than one config file), and the per-client path table becomesjsonClientFiles().~/.qoderor~/.qoder-cn. Only the installed one is meaningful, so existing homes are both updated and an absent sibling is skipped; when neither exists yet the documented~/.qoderpath is created.Editor guide (
src/components/settings/McpGuide.tsx, newmcpClientConfig.ts)ClientSnippetgainsmode: 'connect' | 'paste'. Connect cards keep the existing button; paste cards get a copy button plus the JSON itself rendered, so it is still selectable when the clipboard is unavailable.qwenWorkConnectJson()holds the snippet shape in a pure module so it is testable without a DOM. Note itstypeisstreamable-http, which is what Qwen Work's importer expects — deliberately different from thehttpthe file writer emits.Docs —
### Qoderand### Qwen Work (千问办公)inREADME.md/README_ZH.md, including the dual-build paths and an explicit statement that OpenChatCut does not write into Qwen Work's store.Verification
Real end-to-end run on Node 24, with
HOMEpointed at a throwaway directory andOPENCHATCUT_MCP_TOKENset to a synthetic value, so nothing on the developer's machine was touched and no real credential appears anywhere:POST /api/external-agent/connect-client {client:'qoder'}→{"ok":true,"paths":["~/.qoder/settings.json"]}, and the file appears with the bearer header. First attempt withoutOrigin/Sec-Fetch-Sitecorrectly got403 invalid request originfrom the CSRF shape gate.~/.qoder-cnalso present → both paths written; a pre-existing{"theme":"dark","mcpServers":{"keepme":…}}survived intact.initialize→200+serverInfo {openchatcut},tools/list→200/ 31 tools,tools/call openchatcut_status→200. Same request without the bearer header →403, with a wrong token →403.已写入 ~/.qoder/settings.jsonand the file lands on disk; the 千问办公 card shows the JSON and its copy path was exercised through the failure branch (the automation context deniesclipboard-write), which is what the on-screen snippet covers.Suite, same branch:
npm test→ exit 0npm run build(tsc -b && vite build) → exit 0npm run lint→ 0 warnings / 0 errors on 1850 filesnpx tsc -b→ cleannpm run verify:i18n→ 通过, 2458 英文词条client-connect.verify.ts→ merges idempotent, broken JSON refused, codex CLI + env var syncedmcpClientConfig.verify.ts→ registered inverify:components,verify-registrationcleanNot included
No Qwen Work file write, because there is no public path to write to; if they add one this becomes a
mode: 'connect'card.