xaq-cli 0.1.0-nightly.75 → 0.1.0-nightly.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/README.md +6 -4
  2. package/dist/cli.js +2 -2
  3. package/dist/{commands-DsKEU8Pe.js → commands-CyntHgEq.js} +9 -8
  4. package/dist/commands-CyntHgEq.js.map +1 -0
  5. package/dist/{import-CjXjx6hA.js → import-BgRQ4ohM.js} +8 -3
  6. package/dist/import-BgRQ4ohM.js.map +1 -0
  7. package/dist/{manage-BlGiqPRV.js → manage-D3eTpw6R.js} +28 -7
  8. package/dist/manage-D3eTpw6R.js.map +1 -0
  9. package/dist/{manage-Dx5Ok81O.js → manage-RJqfnHBq.js} +1 -1
  10. package/dist/{server-W9kGk9Jl.js → server-DLhj6g0y.js} +8797 -8790
  11. package/dist/server-DLhj6g0y.js.map +1 -0
  12. package/dist/types-BhJDbSzE.js.map +1 -1
  13. package/dist/user-server-huynScXf.js +454 -0
  14. package/dist/user-server-huynScXf.js.map +1 -0
  15. package/dist/web/assets/_agentId-B4iPsyc1.js +1 -0
  16. package/dist/web/assets/_app-AYuHHl4Q.js +1 -0
  17. package/dist/web/assets/{_app-DwRF-8UM.js → _app-BfXHcLKy.js} +15 -15
  18. package/dist/web/assets/_connectionId-D7FTuDOg.js +1 -0
  19. package/dist/web/assets/{_webhookId-CyJq1ex_.js → _webhookId-CjTMJxRv.js} +1 -1
  20. package/dist/web/assets/{account-status-BrI33qHO.js → account-status-QCMDrdBO.js} +1 -1
  21. package/dist/web/assets/{accounts-CtbNxDYa.js → accounts-HUFqTHdu.js} +1 -1
  22. package/dist/web/assets/accounts-list-_aD4kKJh.js +1 -0
  23. package/dist/web/assets/{activity-5HloXw1J.js → activity-BSfUSncq.js} +1 -1
  24. package/dist/web/assets/add-connection-DRfieiRB.js +1 -0
  25. package/dist/web/assets/{agent-create-form-DvoQ8zk8.js → agent-create-form-Ds_D6gJJ.js} +1 -1
  26. package/dist/web/assets/{agents-DDfJUZiR.js → agents-DthLT7ob.js} +1 -1
  27. package/dist/web/assets/approvals-m47m5VY5.js +1 -0
  28. package/dist/web/assets/approve._id-BjrI8Mrq.js +1 -0
  29. package/dist/web/assets/{arrow-left-hEWj9kVI.js → arrow-left-Dn41Ca3s.js} +1 -1
  30. package/dist/web/assets/{arrow-right-BEX9zqlZ.js → arrow-right-D0-bRtm8.js} +1 -1
  31. package/dist/web/assets/{attention-DxIYpy30.js → attention-C7d_TmAO.js} +1 -1
  32. package/dist/web/assets/{audit-BX0zWXAZ.js → audit-CuwpvW4-.js} +1 -1
  33. package/dist/web/assets/{audit-bits-Do9LM2uY.js → audit-bits-DLeCrh-b.js} +1 -1
  34. package/dist/web/assets/{bell-ring-Dio7hQe2.js → bell-ring-BZanlAe0.js} +1 -1
  35. package/dist/web/assets/{bot-DZvchThv.js → bot-DOhWCb5p.js} +1 -1
  36. package/dist/web/assets/calendar-notice-CnDqFS6A.js +1 -0
  37. package/dist/web/assets/{calendar-plus-B4tRXTSf.js → calendar-plus-DfYRzTtC.js} +1 -1
  38. package/dist/web/assets/{calendar-setup-CBtKgisk.js → calendar-setup-Csge9Rlc.js} +2 -2
  39. package/dist/web/assets/{card-BafVKmUQ.js → card-OoDU0z7Y.js} +1 -1
  40. package/dist/web/assets/{check-check-ByPkearG.js → check-check-D7XF6Qx9.js} +1 -1
  41. package/dist/web/assets/checkbox-C3enYRr3.js +1 -0
  42. package/dist/web/assets/chevron-right-BMre7-G3.js +1 -0
  43. package/dist/web/assets/chips-input-CptCIGMo.js +1 -0
  44. package/dist/web/assets/choice-cards-cdUaM-_t.js +1 -0
  45. package/dist/web/assets/{circle-x-BgjeHqFg.js → circle-x-CK5aOMT2.js} +1 -1
  46. package/dist/web/assets/command-DNnLWG72.js +1 -0
  47. package/dist/web/assets/{common-DyzW6XHZ.js → common-5hhe1SeG.js} +1 -1
  48. package/dist/web/assets/{connect-agent-guide-BFwR-Ktv.js → connect-agent-guide-C5ClCF7N.js} +1 -1
  49. package/dist/web/assets/{connect-host-BSdhx8Mf.js → connect-host-BW9ZCk0-.js} +2 -2
  50. package/dist/web/assets/{connection-row-DxiW2ihZ.js → connection-row-CNqLBR1i.js} +1 -1
  51. package/dist/web/assets/connections-C1IpAcWR.js +1 -0
  52. package/dist/web/assets/{data-table-r8CYhCoC.js → data-table-BvxYQlKG.js} +1 -1
  53. package/dist/web/assets/{empty-CMTUeOtP.js → empty-S0yBUx1s.js} +1 -1
  54. package/dist/web/assets/events-DfpBS1R8.js +1 -0
  55. package/dist/web/assets/{eye-dgyFMt2X.js → eye-CBBY6TzG.js} +1 -1
  56. package/dist/web/assets/{eye-off-Dqjd8vH5.js → eye-off-C6FSE-OI.js} +1 -1
  57. package/dist/web/assets/{field-YgyXnSJq.js → field-D3og-MC2.js} +1 -1
  58. package/dist/web/assets/{get-started-C0qSiXVI.js → get-started-Bjn6yh4e.js} +2 -2
  59. package/dist/web/assets/{hidden-chars-C9ApeGqc.js → hidden-chars-1_7Oycp7.js} +1 -1
  60. package/dist/web/assets/index-DZpRTT5Y.js +11 -0
  61. package/dist/web/assets/{input-Cc_xnlxT.js → input-C742dYRC.js} +1 -1
  62. package/dist/web/assets/{input-group-pUr4oVx8.js → input-group-Cl_miHC9.js} +1 -1
  63. package/dist/web/assets/label-multi-select-Dsp3ZtIH.js +1 -0
  64. package/dist/web/assets/{labels-B7I1pGV-.js → labels-DtDR-Bvf.js} +1 -1
  65. package/dist/web/assets/{laptop-CDlw2qRK.js → laptop-Bh9Fe3mg.js} +1 -1
  66. package/dist/web/assets/{last-call-DWZSstxl.js → last-call-CrjwObrP.js} +1 -1
  67. package/dist/web/assets/{listener-handled-_1JR7i0-.js → listener-handled-o8k-teN1.js} +1 -1
  68. package/dist/web/assets/login-BGxHAaO3.js +1 -0
  69. package/dist/web/assets/{mail-C1sJjv_g.js → mail-BHYjZxbc.js} +1 -1
  70. package/dist/web/assets/mcp-call-card-DNX07Ywo.js +3 -0
  71. package/dist/web/assets/{message-square-quote-DZ0468t4.js → message-square-quote-BwFfaN6r.js} +1 -1
  72. package/dist/web/assets/mutations-B9VxIGUu.js +1 -0
  73. package/dist/web/assets/{network-BruufyeY.js → network-n8OwNmxr.js} +1 -1
  74. package/dist/web/assets/{pairing-BM7P3m4E.js → pairing-QdgK5aKC.js} +1 -1
  75. package/dist/web/assets/{pairing-notifier-D_pN7Oqp.js → pairing-notifier-BhE_iSwW.js} +1 -1
  76. package/dist/web/assets/{paperclip-B6A8HRMb.js → paperclip-CXvffYnq.js} +1 -1
  77. package/dist/web/assets/{password-input-BJDsiP3o.js → password-input-LfWzs6e3.js} +1 -1
  78. package/dist/web/assets/{pause-CODF88Yo.js → pause-C0554OzA.js} +1 -1
  79. package/dist/web/assets/{pencil-BJpilI3p.js → pencil-BDWpYBnN.js} +1 -1
  80. package/dist/web/assets/{play-x6-8X3Kt.js → play-rDra2Uck.js} +1 -1
  81. package/dist/web/assets/{plug-DkmrHlD0.js → plug-23cBZTdR.js} +1 -1
  82. package/dist/web/assets/{plug-zap-BBY_UzfP.js → plug-zap-0lKlk0E6.js} +1 -1
  83. package/dist/web/assets/plus-DgbEC-TH.js +1 -0
  84. package/dist/web/assets/{preload-helper-BLaPE9uF.js → preload-helper-j0EKW2si.js} +1 -1
  85. package/dist/web/assets/{public-url-BTMfSn9y.js → public-url-BxwAe3ba.js} +1 -1
  86. package/dist/web/assets/{queries-CB1guBkM.js → queries-Bj56TfoQ.js} +1 -1
  87. package/dist/web/assets/{refresh-cw-DLHNfQAr.js → refresh-cw-B_zNQl2p.js} +1 -1
  88. package/dist/web/assets/{revealed-keys-Crwan_Ge.js → revealed-keys-BsJnyIy3.js} +1 -1
  89. package/dist/web/assets/{rotate-ccw-BSIBBSIr.js → rotate-ccw-UmvMSyOX.js} +1 -1
  90. package/dist/web/assets/{search-_FwJ7zPJ.js → search-D0qVIdHx.js} +1 -1
  91. package/dist/web/assets/select-ItccDGGy.js +1 -0
  92. package/dist/web/assets/{send-CMwtbuuP.js → send-CmOZjqoc.js} +1 -1
  93. package/dist/web/assets/{settings-SiwMHnpM.js → settings-DNvv2DG9.js} +1 -1
  94. package/dist/web/assets/{setup-BJFzNXoH.js → setup-Epgx31vR.js} +1 -1
  95. package/dist/web/assets/{sheet-gk49trYs.js → sheet-xUEO77dN.js} +1 -1
  96. package/dist/web/assets/{shield-alert-BY8kDPfb.js → shield-alert-K214ggzY.js} +1 -1
  97. package/dist/web/assets/{shield-check-BBsCZ5UG.js → shield-check-D-5FsaOb.js} +1 -1
  98. package/dist/web/assets/{sparkles-BDkS9XlA.js → sparkles-BOtlLkbU.js} +1 -1
  99. package/dist/web/assets/{stamp-Cp2QXu24.js → stamp-HT0B-mKD.js} +1 -1
  100. package/dist/web/assets/{step-url-Dc554JOM.js → step-url-BXJXsJ4i.js} +1 -1
  101. package/dist/web/assets/{stream-ujzoo-JH.js → stream-CGDIebb7.js} +1 -1
  102. package/dist/web/assets/{tag-6-LZsW72.js → tag-DfHTkXXr.js} +1 -1
  103. package/dist/web/assets/{terminal-D46pEiJl.js → terminal-BI4_kJe-.js} +1 -1
  104. package/dist/web/assets/{test-email-button-DHLZl2vZ.js → test-email-button-DU4JRc5A.js} +1 -1
  105. package/dist/web/assets/toggle-group-CAK1N7Uk.js +1 -0
  106. package/dist/web/assets/{trash-DTYsgeJY.js → trash-D6uvctV9.js} +1 -1
  107. package/dist/web/assets/{use-delivery-speed-Byr_ASvB.js → use-delivery-speed-Cz7wwlsF.js} +1 -1
  108. package/dist/web/assets/{use-label-names-BGbSyz4r.js → use-label-names-jiPWM-Lg.js} +1 -1
  109. package/dist/web/assets/{use-sign-out-Bc7uFp-A.js → use-sign-out-DjrTXR4G.js} +1 -1
  110. package/dist/web/assets/{useInfiniteQuery-BMG2NU-Q.js → useInfiniteQuery-BpUrBg-y.js} +1 -1
  111. package/dist/web/assets/{useQuery-6iC3scCF.js → useQuery-mLIt8a3j.js} +1 -1
  112. package/dist/web/assets/useRouterState-BPAVcV8T.js +1 -0
  113. package/dist/web/assets/{webhook-BgWBopPN.js → webhook-DMnUEIeQ.js} +1 -1
  114. package/dist/web/assets/webhook-bits-CWEcMHDk.js +1 -0
  115. package/dist/web/assets/{webhook-sheet-MMZXrVA4.js → webhook-sheet-CfC2QnNk.js} +2 -2
  116. package/dist/web/assets/{webhooks-CmK_pm2A.js → webhooks-Gnqbma_F.js} +1 -1
  117. package/dist/web/assets/{x-ChPOraw0.js → x-BKiZ2rOt.js} +1 -1
  118. package/dist/web/index.html +4 -4
  119. package/package.json +1 -1
  120. package/dist/commands-DsKEU8Pe.js.map +0 -1
  121. package/dist/import-CjXjx6hA.js.map +0 -1
  122. package/dist/manage-BlGiqPRV.js.map +0 -1
  123. package/dist/server-W9kGk9Jl.js.map +0 -1
  124. package/dist/ssrf-BlVpGZ7C.js +0 -181
  125. package/dist/ssrf-BlVpGZ7C.js.map +0 -1
  126. package/dist/web/assets/_agentId-CzDPPzI9.js +0 -1
  127. package/dist/web/assets/_app-CUHQ4lt-.js +0 -1
  128. package/dist/web/assets/_connectionId-Bytsf1s4.js +0 -1
  129. package/dist/web/assets/accounts-list-DMVQW73C.js +0 -1
  130. package/dist/web/assets/add-connection-D_xU8Bs7.js +0 -1
  131. package/dist/web/assets/approvals-CgidTfXl.js +0 -1
  132. package/dist/web/assets/approve._id-D8B03Cm1.js +0 -1
  133. package/dist/web/assets/calendar-notice-BwPSpDUE.js +0 -1
  134. package/dist/web/assets/checkbox-BVmgUwsC.js +0 -1
  135. package/dist/web/assets/chevron-right-BIcES4fV.js +0 -1
  136. package/dist/web/assets/chips-input-DFeNsKwp.js +0 -1
  137. package/dist/web/assets/choice-cards-nixEe9y6.js +0 -1
  138. package/dist/web/assets/command-B3_qWyNm.js +0 -1
  139. package/dist/web/assets/connections-cMUsnxYf.js +0 -1
  140. package/dist/web/assets/events-PfrvkK0M.js +0 -1
  141. package/dist/web/assets/index-DlwjDobb.js +0 -11
  142. package/dist/web/assets/label-multi-select-23SFetjr.js +0 -1
  143. package/dist/web/assets/login-BaE2JuVt.js +0 -1
  144. package/dist/web/assets/mcp-call-card-Dxlb5yPL.js +0 -3
  145. package/dist/web/assets/mutations-eDLDZNIB.js +0 -1
  146. package/dist/web/assets/plus-BdMlQV2O.js +0 -1
  147. package/dist/web/assets/select-BKebY75t.js +0 -1
  148. package/dist/web/assets/toggle-group-BR5I8zPO.js +0 -1
  149. package/dist/web/assets/useRouterState-_3MPjKI3.js +0 -1
  150. package/dist/web/assets/webhook-bits-Cffr1ZuA.js +0 -1
package/README.md CHANGED
@@ -4,19 +4,21 @@
4
4
  [![npm](https://img.shields.io/npm/v/xaq-cli)](https://www.npmjs.com/package/xaq-cli)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
6
6
 
7
- A self-hosted MCP broker for AI agents (formerly agentinbox, see [Upgrading from agentinbox](#upgrading-from-agentinbox)). One small server holds all your credentials (Notion, WHOOP, any MCP server,
8
- Gmail and Google Calendar) and gives each agent a single MCP endpoint with only the tools it's allowed. Risky actions
7
+ A self-hosted MCP broker for AI agents (formerly agentinbox, see [Upgrading from agentinbox](#upgrading-from-agentinbox)). One small server holds all your credentials (Notion, WHOOP, T3 Code, any MCP
8
+ server, Gmail and Google Calendar) and gives each agent a single MCP endpoint with only the tools it's allowed. Risky actions
9
9
  (deleting, sending, publishing, payments) can wait for your one-tap approval, and every call is audited.
10
10
 
11
11
  ```sh
12
12
  npx xaq-cli
13
13
  ```
14
14
 
15
- Open the link it prints and pick what to connect first: Notion, WHOOP, another MCP server, or Gmail and Calendar.
15
+ Open the link it prints and pick what to connect first: Notion, WHOOP, T3 Code, another MCP server, or Gmail and
16
+ Calendar.
16
17
  Only Gmail and Calendar need a Google Cloud project; everything else is a few clicks. The console then connects your
17
18
  first agent. Requires Node.js 22.13 or newer.
18
19
 
19
- From the terminal on the same machine: `npx xaq-cli connections add notion` (or `whoop`, or an MCP server URL),
20
+ From the terminal on the same machine: `npx xaq-cli connections add notion` (or `whoop`, `t3code --url
21
+ http://<your T3 server>:3773`, or an MCP server URL),
20
22
  and `npx xaq-cli import --from hermes` (also `claude-code`, `cursor`, `codex`) to move an agent's existing MCP
21
23
  servers behind the broker. Details: [Connections](docs/reference.md#connections-mcp-broker).
22
24
 
package/dist/cli.js CHANGED
@@ -59,7 +59,7 @@ const SERVER_GROUP = "Run xaq:";
59
59
  const AGENT_GROUP = "On an agent's machine:";
60
60
  withServerOptions(program.command("start", { isDefault: true }).description("run xaq in this terminal and print the setup link (the default command)").summary("run it in this terminal (the default command)").helpGroup(SERVER_GROUP)).option("--no-open", "don't open a browser on first run").option("--dev", "development: API only, the console runs on Vite (:5173)").allowExcessArguments().action(async (o, cmd) => {
61
61
  if (cmd.args.length) throw new Error(unknownCommand(cmd.args[0]));
62
- const { runForeground } = await import("./server-W9kGk9Jl.js");
62
+ const { runForeground } = await import("./server-DLhj6g0y.js");
63
63
  await runForeground({
64
64
  ...configInput(o),
65
65
  dev: !!o.dev,
@@ -140,7 +140,7 @@ program.command("reset-password").description("forgot the console password? Remo
140
140
  });
141
141
  const { registerListenCommands } = await import("./commands-tyhvFqiJ.js");
142
142
  registerListenCommands(program);
143
- const { registerConnectionsCommands } = await import("./commands-DsKEU8Pe.js");
143
+ const { registerConnectionsCommands } = await import("./commands-CyntHgEq.js");
144
144
  registerConnectionsCommands(program);
145
145
  const AGENT_SUMMARIES = {
146
146
  connect: "pair an agent; you approve it in the console",
@@ -45,28 +45,29 @@ async function selfOrigins(dataDir) {
45
45
  }
46
46
  function registerConnectionsCommands(program) {
47
47
  const connections = program.command("connections", { hidden: false }).description("the MCP servers xaq connects agents to (Notion, WHOOP, any MCP URL); run on xaq's machine").summary("add, list, reconnect or remove connected MCP servers").helpGroup(GROUP);
48
- dataOption(connections.command("add").description("connect an integration (notion, whoop) or any MCP server URL, interactively").argument("<integration-or-url>", "notion, whoop, or an MCP server URL such as https://mcp.example.com/mcp")).option("--slug <name>", "its name: agents see its tools as <name>__<tool>").option("--access <level>", "full, ask (ask before risky actions; the default) or read").option("--agent <name>", "an agent that gets it (repeatable; default: all agents; \"all\")", collect).option("--header <name>", "header for a server that wants a static key (default Authorization)").option("--paste", "paste the address the browser lands on after signing in, instead of waiting for the redirect (automatic over SSH)").option("--allow-private <origin>", "allow this exact scheme://host:port on this machine or a private network without asking (--yes never does)").option("-y, --yes", "answer yes to confirmations and take the defaults (never to a private-network allow)").addHelpText("after", `
48
+ dataOption(connections.command("add").description("connect an integration (notion, whoop, t3code) or any MCP server URL, interactively").argument("<integration-or-url>", "notion, whoop, t3code, or an MCP server URL such as https://mcp.example.com/mcp")).option("--url <address>", "t3code: your T3 Code server's address, e.g. http://100.101.102.103:3773 (asked when omitted)").option("--slug <name>", "its short name: agents see its tools as <name>__<tool>").option("--name <name>", "its display name (unique; default: the server's host, or the integration's name)").option("--access <level>", "full, ask (ask before risky actions; the default) or read").option("--agent <name>", "an agent that gets it (repeatable; default: all agents; \"all\")", collect).option("--header <name>", "header for a server that wants a static key (default Authorization)").option("--paste", "paste the address the browser lands on after signing in, instead of waiting for the redirect (automatic over SSH)").option("--allow-private <origin>", "allow this exact scheme://host:port on this machine or a private network without asking (--yes never does)").option("-y, --yes", "answer yes to confirmations and take the defaults (never to a private-network allow)").addHelpText("after", `
49
49
  Examples:
50
50
  ${NPX} connections add notion
51
+ ${NPX} connections add t3code --url http://100.101.102.103:3773 # one per T3 server; have a T3 pairing code ready
51
52
  ${NPX} connections add https://mcp.example.com/mcp --access read
52
53
  ${NPX} connections add http://127.0.0.1:8787/mcp # asks before allowing a server on this machine`).action(async (target, o) => {
53
- const { addConnection } = await import("./manage-Dx5Ok81O.js");
54
+ const { addConnection } = await import("./manage-RJqfnHBq.js");
54
55
  process.exitCode = await withApi(o, (deps) => addConnection(target, o, deps));
55
56
  });
56
57
  dataOption(connections.command("list").description("list connections with their status and access")).action(async (o) => {
57
- const { listConnections } = await import("./manage-Dx5Ok81O.js");
58
+ const { listConnections } = await import("./manage-RJqfnHBq.js");
58
59
  process.exitCode = await withApi(o, (deps) => listConnections(deps));
59
60
  });
60
61
  dataOption(connections.command("reconnect").description("sign in again (OAuth) or replace the key (header)").argument("<name>", "the connection's name")).option("--paste", "paste the address the browser lands on (automatic over SSH)").option("--header <name>", "header connections: the header's name (default: asks, Authorization)").action(async (slug, o) => {
61
- const { reconnectConnection } = await import("./manage-Dx5Ok81O.js");
62
+ const { reconnectConnection } = await import("./manage-RJqfnHBq.js");
62
63
  process.exitCode = await withApi(o, (deps) => reconnectConnection(slug, o, deps));
63
64
  });
64
65
  dataOption(connections.command("disable").description("turn a connection off at once (the kill switch); turn it back on in the console").argument("<name>", "the connection's name")).option("-y, --yes", "don't ask").action(async (slug, o) => {
65
- const { disableConnection } = await import("./manage-Dx5Ok81O.js");
66
+ const { disableConnection } = await import("./manage-RJqfnHBq.js");
66
67
  process.exitCode = await withApi(o, (deps) => disableConnection(slug, deps));
67
68
  });
68
69
  dataOption(connections.command("remove").description("remove a connection and delete its credentials").argument("<name>", "the connection's name")).option("-y, --yes", "don't ask").action(async (slug, o) => {
69
- const { removeConnection } = await import("./manage-Dx5Ok81O.js");
70
+ const { removeConnection } = await import("./manage-RJqfnHBq.js");
70
71
  process.exitCode = await withApi(o, (deps) => removeConnection(slug, deps));
71
72
  });
72
73
  dataOption(program.command("import", { hidden: false }).description("move an agent tool's MCP servers into xaq: one connection each, credentials moved into xaq").summary("import MCP servers from Hermes, Claude Code, Cursor or Codex").helpGroup(GROUP).requiredOption("--from <client>", "hermes, claude-code, cursor or codex")).option("--dry-run", "print exactly what would be created and changed, and change nothing").option("--access <level>", "for every imported connection: full, ask (the default) or read").option("--agent <name>", "an agent that gets them (repeatable; default: all agents; \"all\")", collect).option("--profile <name>", "the agent profile setup-mcp uses for the single xaq entry (default \"default\")").option("--allow-private <origin>", "allow this exact scheme://host:port on this machine or a private network without asking (repeatable; --yes never does)", collect).option("-y, --yes", "answer yes to the confirmations (scripts); never to a private-network allow or a project's .mcp.json servers").addHelpText("after", `
@@ -81,7 +82,7 @@ with the single xaq entry, after a timestamped backup. The entry keeps the name
81
82
  Examples:
82
83
  ${NPX} import --from hermes --dry-run
83
84
  ${NPX} import --from hermes`).action(async (o) => {
84
- const { runImport } = await import("./import-CjXjx6hA.js");
85
+ const { runImport } = await import("./import-BgRQ4ohM.js");
85
86
  const self = await selfOrigins(dataDirOf(o));
86
87
  if (o.dryRun) {
87
88
  const { TerminalPrompter } = await import("./prompt-CKMQx_MJ.js");
@@ -109,4 +110,4 @@ Examples:
109
110
  //#endregion
110
111
  export { registerConnectionsCommands };
111
112
 
112
- //# sourceMappingURL=commands-DsKEU8Pe.js.map
113
+ //# sourceMappingURL=commands-CyntHgEq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands-CyntHgEq.js","names":[],"sources":["../server/connections-cli/commands.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { NPX } from \"../listen/version.ts\";\nimport { LEGACY_PRODUCT } from \"../brand.ts\";\nimport { resolveDataDir } from \"../config.ts\";\n\n/**\n * `connections …` and `import --from …`: run on the daemon's machine, talking to its admin API through the\n * one-time local admin session (admin.ts). Listed in --help since the console (#65) shipped; while the daemon's\n * `brokerUpstreams` setting is off they say so (CONNECTIONS_VISIBLE).\n */\nexport const CONNECTIONS_VISIBLE = true;\nconst GROUP = \"MCP connections (on xaq's machine):\";\n\nconst collect = (value: string, previous: string[] | undefined) => [...(previous ?? []), value];\n// --data, else XAQ_DATA (AGENTINBOX_DATA), else ~/.xaq or an existing pre-rename ~/.agentinbox (config.ts; rename-xaq: keep).\nconst dataDirOf = (o: { data?: string }) => resolveDataDir(o.data, { quiet: true });\nconst dataOption = (cmd: Command) => cmd.option(\"-d, --data <dir>\", `xaq's data directory (default ~/.xaq, or an existing ~/.${LEGACY_PRODUCT}; env XAQ_DATA)`);\n\nasync function withApi<T>(o: { data?: string; yes?: boolean }, run: (deps: { api: import(\"./api.ts\").ConnectionsApi; prompter: import(\"./prompt.ts\").Prompter }) => Promise<T>): Promise<T> {\n const { CLEANUP_SIGNALS, openAdminChannel } = await import(\"./admin.ts\");\n const { ConnectionsApi } = await import(\"./api.ts\");\n const { TerminalPrompter } = await import(\"./prompt.ts\");\n const channel = openAdminChannel({ dataDir: dataDirOf(o) });\n const handlers = CLEANUP_SIGNALS.map((sig) => {\n const h = () => {\n channel.close();\n process.exit(sig === \"SIGINT\" ? 130 : 128 + (sig === \"SIGTERM\" ? 15 : 1));\n };\n process.once(sig, h);\n return [sig, h] as const;\n });\n try {\n return await run({ api: new ConnectionsApi(channel), prompter: new TerminalPrompter(!!o.yes) });\n } finally {\n for (const [sig, h] of handlers) process.removeListener(sig, h);\n channel.close();\n }\n}\n\n/** This xaq's own MCP origins, so `import` never imports its own entry. */\nasync function selfOrigins(dataDir: string): Promise<string[]> {\n const { runningInstance } = await import(\"../instance.ts\");\n const { daemonOrigin } = await import(\"./admin.ts\");\n const running = runningInstance(dataDir);\n if (!running) return [];\n return [daemonOrigin(running), `http://localhost:${running.port}`, `http://127.0.0.1:${running.port}`, `http://[::1]:${running.port}`];\n}\n\nexport function registerConnectionsCommands(program: Command): void {\n const connections = program\n .command(\"connections\", { hidden: !CONNECTIONS_VISIBLE })\n .description(\"the MCP servers xaq connects agents to (Notion, WHOOP, any MCP URL); run on xaq's machine\")\n .summary(\"add, list, reconnect or remove connected MCP servers\")\n .helpGroup(GROUP);\n\n dataOption(\n connections\n .command(\"add\")\n .description(\"connect an integration (notion, whoop, t3code) or any MCP server URL, interactively\")\n .argument(\"<integration-or-url>\", \"notion, whoop, t3code, or an MCP server URL such as https://mcp.example.com/mcp\"),\n )\n .option(\"--url <address>\", \"t3code: your T3 Code server's address, e.g. http://100.101.102.103:3773 (asked when omitted)\")\n .option(\"--slug <name>\", \"its short name: agents see its tools as <name>__<tool>\")\n .option(\"--name <name>\", \"its display name (unique; default: the server's host, or the integration's name)\")\n .option(\"--access <level>\", \"full, ask (ask before risky actions; the default) or read\")\n .option(\"--agent <name>\", 'an agent that gets it (repeatable; default: all agents; \"all\")', collect)\n .option(\"--header <name>\", \"header for a server that wants a static key (default Authorization)\")\n .option(\"--paste\", \"paste the address the browser lands on after signing in, instead of waiting for the redirect (automatic over SSH)\")\n .option(\"--allow-private <origin>\", \"allow this exact scheme://host:port on this machine or a private network without asking (--yes never does)\")\n .option(\"-y, --yes\", \"answer yes to confirmations and take the defaults (never to a private-network allow)\")\n .addHelpText(\n \"after\",\n `\nExamples:\n ${NPX} connections add notion\n ${NPX} connections add t3code --url http://100.101.102.103:3773 # one per T3 server; have a T3 pairing code ready\n ${NPX} connections add https://mcp.example.com/mcp --access read\n ${NPX} connections add http://127.0.0.1:8787/mcp # asks before allowing a server on this machine`,\n )\n .action(async (target: string, o: import(\"./manage.ts\").AddFlags & { data?: string }) => {\n const { addConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => addConnection(target, o, deps));\n });\n\n dataOption(connections.command(\"list\").description(\"list connections with their status and access\")).action(async (o: { data?: string }) => {\n const { listConnections } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => listConnections(deps));\n });\n\n dataOption(connections.command(\"reconnect\").description(\"sign in again (OAuth) or replace the key (header)\").argument(\"<name>\", \"the connection's name\"))\n .option(\"--paste\", \"paste the address the browser lands on (automatic over SSH)\")\n .option(\"--header <name>\", \"header connections: the header's name (default: asks, Authorization)\")\n .action(async (slug: string, o: { data?: string; paste?: boolean; header?: string }) => {\n const { reconnectConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => reconnectConnection(slug, o, deps));\n });\n\n dataOption(connections.command(\"disable\").description(\"turn a connection off at once (the kill switch); turn it back on in the console\").argument(\"<name>\", \"the connection's name\"))\n .option(\"-y, --yes\", \"don't ask\")\n .action(async (slug: string, o: { data?: string; yes?: boolean }) => {\n const { disableConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => disableConnection(slug, deps));\n });\n\n dataOption(connections.command(\"remove\").description(\"remove a connection and delete its credentials\").argument(\"<name>\", \"the connection's name\"))\n .option(\"-y, --yes\", \"don't ask\")\n .action(async (slug: string, o: { data?: string; yes?: boolean }) => {\n const { removeConnection } = await import(\"./manage.ts\");\n process.exitCode = await withApi(o, (deps) => removeConnection(slug, deps));\n });\n\n dataOption(\n program\n .command(\"import\", { hidden: !CONNECTIONS_VISIBLE })\n .description(\"move an agent tool's MCP servers into xaq: one connection each, credentials moved into xaq\")\n .summary(\"import MCP servers from Hermes, Claude Code, Cursor or Codex\")\n .helpGroup(GROUP)\n .requiredOption(\"--from <client>\", \"hermes, claude-code, cursor or codex\"),\n )\n .option(\"--dry-run\", \"print exactly what would be created and changed, and change nothing\")\n .option(\"--access <level>\", \"for every imported connection: full, ask (the default) or read\")\n .option(\"--agent <name>\", 'an agent that gets them (repeatable; default: all agents; \"all\")', collect)\n .option(\"--profile <name>\", \"the agent profile setup-mcp uses for the single xaq entry (default \\\"default\\\")\")\n .option(\"--allow-private <origin>\", \"allow this exact scheme://host:port on this machine or a private network without asking (repeatable; --yes never does)\", collect)\n .option(\"-y, --yes\", \"answer yes to the confirmations (scripts); never to a private-network allow or a project's .mcp.json servers\")\n .addHelpText(\n \"after\",\n `\nReads: hermes ~/.hermes/config.yaml mcp_servers (+ ~/.hermes/.env) · claude-code ~/.claude.json and ./.mcp.json ·\ncursor ~/.cursor/mcp.json · codex ~/.codex/config.toml. Static headers move into xaq (encrypted); OAuth\nservers are created needing Connect (their tokens stay in the client); local (stdio) servers aren't supported yet\nand stay where they are. Servers on this machine or a private network are created only after you confirm the exact\nhost:port. Then it offers setup-mcp --tool <client>, which replaces the entries that now work through xaq\nwith the single xaq entry, after a timestamped backup. The entry keeps the name the profile already uses (\"xaq\", or\n\"${LEGACY_PRODUCT}\" for a profile set up before the rename), so Hermes routes and cron jobs confined to it keep working.\n\nExamples:\n ${NPX} import --from hermes --dry-run\n ${NPX} import --from hermes`,\n )\n .action(async (o: import(\"./import.ts\").ImportFlags & { data?: string }) => {\n const { runImport } = await import(\"./import.ts\");\n const self = await selfOrigins(dataDirOf(o));\n if (o.dryRun) {\n // Read-only: the admin channel (when the daemon runs) only lists existing connections.\n const { TerminalPrompter } = await import(\"./prompt.ts\");\n const { openAdminChannel } = await import(\"./admin.ts\");\n const { ConnectionsApi } = await import(\"./api.ts\");\n let channel: import(\"./admin.ts\").AdminChannel | null = null;\n try {\n process.exitCode = await runImport(o, {\n prompter: new TerminalPrompter(!!o.yes),\n openApi: () => new ConnectionsApi((channel = openAdminChannel({ dataDir: dataDirOf(o) }))),\n selfOrigins: self,\n });\n } finally {\n (channel as import(\"./admin.ts\").AdminChannel | null)?.close();\n }\n return;\n }\n process.exitCode = await withApi(o, (deps) => runImport(o, { prompter: deps.prompter, openApi: () => deps.api, selfOrigins: self }));\n });\n}\n"],"mappings":";;;;;AAWA,MAAM,QAAQ;AAEd,MAAM,WAAW,OAAe,aAAmC,CAAC,GAAI,YAAY,CAAC,GAAI,KAAK;AAE9F,MAAM,aAAa,MAAyB,eAAe,EAAE,MAAM,EAAE,OAAO,KAAK,CAAC;AAClF,MAAM,cAAc,QAAiB,IAAI,OAAO,oBAAoB,2DAA2D,eAAe,gBAAgB;AAE9J,eAAe,QAAW,GAAqC,KAA6H;CAC1L,MAAM,EAAE,iBAAiB,qBAAqB,MAAM,OAAO;CAC3D,MAAM,EAAE,mBAAmB,MAAM,OAAO;CACxC,MAAM,EAAE,qBAAqB,MAAM,OAAO;CAC1C,MAAM,UAAU,iBAAiB,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC;CAC1D,MAAM,WAAW,gBAAgB,KAAK,QAAQ;EAC5C,MAAM,UAAU;GACd,QAAQ,MAAM;GACd,QAAQ,KAAK,QAAQ,WAAW,MAAM,OAAO,QAAQ,YAAY,KAAK,EAAE;EAC1E;EACA,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO,CAAC,KAAK,CAAC;CAChB,CAAC;CACD,IAAI;EACF,OAAO,MAAM,IAAI;GAAE,KAAK,IAAI,eAA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,CAAC,CACnD,YAAY,4FAA4F,CAAC,CACzG,QAAQ,8DAA8D,CAAC,CACvE,UAAU,KAAK,CAAC,CAChB,eAAe,mBAAmB,sCAAsC,CAC7E,CAAC,CACE,OAAO,aAAa,qEAAqE,CAAC,CAC1F,OAAO,oBAAoB,gEAAgE,CAAC,CAC5F,OAAO,kBAAkB,sEAAoE,OAAO,CAAC,CACrG,OAAO,oBAAoB,iFAAiF,CAAC,CAC7G,OAAO,4BAA4B,0HAA0H,OAAO,CAAC,CACrK,OAAO,aAAa,8GAA8G,CAAC,CACnI,YACC,SACA;;;;;;;GAOH,eAAe;;;IAGd,IAAI;IACJ,IAAI,sBACJ,CAAC,CACA,OAAO,OAAO,MAA6D;EAC1E,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,MAAM,OAAO,MAAM,YAAY,UAAU,CAAC,CAAC;EAC3C,IAAI,EAAE,QAAQ;GAEZ,MAAM,EAAE,qBAAqB,MAAM,OAAO;GAC1C,MAAM,EAAE,qBAAqB,MAAM,OAAO;GAC1C,MAAM,EAAE,mBAAmB,MAAM,OAAO;GACxC,IAAI,UAAoD;GACxD,IAAI;IACF,QAAQ,WAAW,MAAM,UAAU,GAAG;KACpC,UAAU,IAAI,iBAAiB,CAAC,CAAC,EAAE,GAAG;KACtC,eAAe,IAAI,eAAgB,UAAU,iBAAiB,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC,CAAE;KACzF,aAAa;IACf,CAAC;GACH,UAAU;IACR,SAAuD,MAAM;GAC/D;GACA;EACF;EACA,QAAQ,WAAW,MAAM,QAAQ,IAAI,SAAS,UAAU,GAAG;GAAE,UAAU,KAAK;GAAU,eAAe,KAAK;GAAK,aAAa;EAAK,CAAC,CAAC;CACrI,CAAC;AACL"}
@@ -5,7 +5,7 @@ import { a as mcpServerName, n as loadProfile, r as profileExists } from "./prof
5
5
  import "./recipes-D_quZbpA.js";
6
6
  import { i as safeText } from "./ui-B8Sd4Y7Y.js";
7
7
  import { _ as readTomlMcpServers, a as cursorConfigFile, c as mcpTarget, g as UNREADABLE$1, h as readTopMap, i as codexConfigFile, m as readMcpServers, n as claudeConfigFile, p as UNREADABLE, s as hermesHome, u as setupMcp } from "./mcpsetup-DjMhHnJo.js";
8
- import { _ as chooseAccess, a as isWorking, d as waitWorking, f as reconnectHint, g as agentsLabel, h as accessLabel, m as checkTarget, p as slugify, v as chooseAgents, y as parseAccess } from "./manage-BlGiqPRV.js";
8
+ import { _ as chooseAccess, a as isWorking, d as waitWorking, f as reconnectHint, g as agentsLabel, h as accessLabel, m as checkTarget, p as slugify, v as chooseAgents, y as parseAccess } from "./manage-D3eTpw6R.js";
9
9
  import { existsSync, readFileSync } from "node:fs";
10
10
  import { join } from "node:path";
11
11
  import pc from "picocolors";
@@ -487,6 +487,7 @@ const sameUrl = (a, b) => {
487
487
  async function planImport(config, ctx = {}) {
488
488
  const label = CLIENT_LABELS[config.client];
489
489
  const taken = new Set((ctx.existing ?? []).map((c) => c.slug));
490
+ const takenNames = new Set((ctx.existing ?? []).map((c) => c.name.toLowerCase()));
490
491
  const items = [];
491
492
  for (const entry of config.entries) {
492
493
  if (isSelf(entry, ctx.selfOrigins ?? [])) {
@@ -569,6 +570,9 @@ async function planImport(config, ctx = {}) {
569
570
  let slug = slugify(entry.name);
570
571
  for (let n = 2; taken.has(slug); n++) slug = `${slugify(entry.name).slice(0, 21)}-${n}`;
571
572
  taken.add(slug);
573
+ let name = entry.name;
574
+ for (let n = 2; takenNames.has(name.toLowerCase()); n++) name = `${entry.name} (${n})`;
575
+ takenNames.add(name.toLowerCase());
572
576
  const auth = headerNames.length ? {
573
577
  type: "header",
574
578
  name: headerNames[0],
@@ -578,6 +582,7 @@ async function planImport(config, ctx = {}) {
578
582
  action: "create",
579
583
  entry,
580
584
  slug,
585
+ name,
581
586
  url: entry.url.trim(),
582
587
  auth,
583
588
  privateTarget: target.kind === "private" ? target.origin : null
@@ -768,7 +773,7 @@ async function runImport(flags, deps) {
768
773
  try {
769
774
  created = await api.create({
770
775
  slug: item.slug,
771
- name: item.entry.name,
776
+ name: item.name,
772
777
  url: item.url,
773
778
  levelDefault: level,
774
779
  ...agents === "all" ? {} : { agentIds: agents }
@@ -907,4 +912,4 @@ async function offerSetup(deps, api, client, who, working, pending, code) {
907
912
  //#endregion
908
913
  export { runImport };
909
914
 
910
- //# sourceMappingURL=import-CjXjx6hA.js.map
915
+ //# sourceMappingURL=import-BgRQ4ohM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-BgRQ4ohM.js","names":["YAML_UNREADABLE","TOML_UNREADABLE"],"sources":["../server/connections-cli/routes.ts","../server/connections-cli/clients.ts","../server/connections-cli/import.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { hermesHome } from \"../listen/mcpsetup.ts\";\nimport type { ImportClient } from \"./clients.ts\";\nimport { readTopMap, UNREADABLE, type YamlValue } from \"./yaml.ts\";\n\n/**\n * Places in a client's config that confine something to the xaq MCP server alone: Hermes platform toolsets,\n * webhook routes (`toolsets: [\"mcp-<server>\", …]`) and cron jobs (`enabled_toolsets: [\"<server>\"]`). Once the\n * imported servers are served through xaq, each of these also sees their tools, so `import` warns before\n * replacing anything (docs/listen.md: an email-triggered route confined to xaq).\n */\nexport function confinedRoutes(client: ImportClient, serverName: string, env: NodeJS.ProcessEnv = process.env): string[] {\n if (client !== \"hermes\") return [];\n const home = hermesHome(env);\n const names = new Set([serverName, `mcp-${serverName}`]);\n const confines = (v: unknown) => Array.isArray(v) && v.some((x) => typeof x === \"string\" && names.has(x));\n const out: string[] = [];\n const read = (file: string): unknown => {\n try {\n return existsSync(file) ? JSON.parse(readFileSync(file, \"utf8\").replace(/^/, \"\")) : null;\n } catch {\n return null;\n }\n };\n try {\n const config = join(home, \"config.yaml\");\n if (existsSync(config)) {\n const yaml = readFileSync(config, \"utf8\");\n const platforms = readTopMap(yaml, \"platform_toolsets\") ?? {};\n for (const [platform, toolsets] of Object.entries(platforms)) if (confines(toolsets)) out.push(`platform_toolsets.${platform} (config.yaml)`);\n // Static webhook routes: platforms.webhook.extra.routes, a map of name → route or a list of routes.\n const get = (v: YamlValue | undefined, k: string): YamlValue | undefined => (v && typeof v === \"object\" && !Array.isArray(v) ? (v as Record<string, YamlValue>)[k] : undefined);\n const routes = get(get(get(readTopMap(yaml, \"platforms\") ?? undefined, \"webhook\"), \"extra\"), \"routes\");\n if (routes === UNREADABLE || (Array.isArray(routes) && routes.some((r) => r === UNREADABLE))) {\n out.push(\"webhook routes in config.yaml (platforms.webhook.extra.routes: couldn't be read, so check their toolsets)\");\n } else if (Array.isArray(routes)) {\n routes.forEach((r, i) => {\n if (confines(get(r, \"toolsets\"))) out.push(`webhook route ${String(get(r, \"name\") ?? `#${i + 1}`)} (config.yaml)`);\n });\n } else if (routes && typeof routes === \"object\") {\n for (const [name, r] of Object.entries(routes as Record<string, YamlValue>)) if (confines(get(r, \"toolsets\"))) out.push(`webhook route ${name} (config.yaml)`);\n }\n }\n } catch {\n // Unreadable: nothing to warn about from it.\n }\n const subs = read(join(home, \"webhook_subscriptions.json\"));\n if (subs && typeof subs === \"object\" && !Array.isArray(subs)) {\n for (const [route, r] of Object.entries(subs as Record<string, { toolsets?: unknown }>)) if (confines(r?.toolsets)) out.push(`webhook route ${route}`);\n }\n const cron = read(join(home, \"cron\", \"jobs.json\"));\n const jobs = (Array.isArray(cron) ? cron : ((cron as { jobs?: unknown } | null)?.jobs ?? [])) as { id?: unknown; name?: unknown; enabled_toolsets?: unknown }[];\n if (Array.isArray(jobs)) for (const j of jobs) if (confines(j?.enabled_toolsets)) out.push(`cron job ${String(j.name ?? j.id ?? \"?\")}`);\n return out;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { claudeConfigFile, codexConfigFile, cursorConfigFile, hermesHome } from \"../listen/mcpsetup.ts\";\nimport { readTomlMcpServers, type TomlTable, UNREADABLE as TOML_UNREADABLE } from \"./toml.ts\";\nimport { readMcpServers, UNREADABLE as YAML_UNREADABLE, type YamlMap } from \"./yaml.ts\";\n\n/** Reads the MCP servers an agent's own tool is configured with (for `import --from`). */\n\nexport const IMPORT_CLIENTS = [\"hermes\", \"claude-code\", \"cursor\", \"codex\"] as const;\nexport type ImportClient = (typeof IMPORT_CLIENTS)[number];\n\nexport const CLIENT_LABELS: Record<ImportClient, string> = { hermes: \"Hermes\", \"claude-code\": \"Claude Code\", cursor: \"Cursor\", codex: \"Codex\" };\n\nexport interface ClientEntry {\n name: string;\n /** The file it's defined in. */\n file: string;\n /** Claude Code: which scope (user: ~/.claude.json; local: its projects[cwd]; project: ./.mcp.json). */\n scope?: \"user\" | \"local\" | \"project\";\n /** Claude Code local/project scope: the project directory (where `claude mcp remove` must run). */\n projectDir?: string;\n transport: \"http\" | \"sse\" | \"stdio\";\n url?: string;\n /** Static headers, with ${VAR} references resolved. Secret: never printed. */\n headers: Record<string, string>;\n /** Names of environment variables the headers came from (for the \"you can remove it from .env\" note). */\n headerVars: string[];\n /** Per header: the environment variables its value was built from (shown in the plan next to the destination). */\n headerSources: Record<string, string[]>;\n /**\n * Defined in a file the project ships (Claude Code's ./.mcp.json), not by the user: anyone who can commit to the\n * repository wrote it. Imported only when Claude Code approved it, and only after its own confirmation.\n */\n fromProject?: boolean;\n /** Client-side settings the broker doesn't carry over: tool filters and timeouts. */\n dropped?: DroppedSettings;\n /** The client says it uses OAuth (Hermes `auth: oauth`, an oauth block). Its tokens stay in the client. */\n oauth: boolean;\n enabled: boolean;\n /** Why it can't be imported as it is. */\n problem?: string;\n /** stdio: the command line, for the listing. */\n command?: string;\n}\n\nexport interface DroppedSettings {\n /** Tools the client hides from its agent (Hermes tools.exclude, Codex disabled_tools). */\n exclude?: string[];\n /** The only tools the client shows (Hermes tools.include, Codex enabled_tools). */\n include?: string[];\n /** Other settings by name, e.g. timeout, connect_timeout. */\n settings: string[];\n}\n\nconst strings = (v: unknown) => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : undefined);\n\nfunction droppedFrom(e: Record<string, unknown>, filters: { include: unknown; exclude: unknown }, settingKeys: string[]): DroppedSettings | undefined {\n const d: DroppedSettings = { settings: settingKeys.filter((k) => e[k] !== undefined && e[k] !== null) };\n const inc = strings(filters.include);\n const exc = strings(filters.exclude);\n if (inc?.length) d.include = inc;\n if (exc?.length) d.exclude = exc;\n return d.include || d.exclude || d.settings.length ? d : undefined;\n}\n\nexport interface ClientConfig {\n client: ImportClient;\n files: string[];\n entries: ClientEntry[];\n}\n\nexport interface ReadOptions {\n env?: NodeJS.ProcessEnv;\n cwd?: string;\n}\n\n/** Parses a dotenv file (KEY=VALUE, optional `export`, quotes). */\nexport function parseDotenv(text: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const raw of text.split(\"\\n\")) {\n const m = /^\\s*(?:export\\s+)?([A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*(.*?)\\s*$/.exec(raw);\n if (!m) continue;\n let v = m[2]!;\n if ((v.startsWith('\"') && v.endsWith('\"') && v.length >= 2) || (v.startsWith(\"'\") && v.endsWith(\"'\") && v.length >= 2)) v = v.slice(1, -1);\n else v = v.replace(/\\s+#.*$/, \"\");\n out[m[1]!] = v;\n }\n return out;\n}\n\ntype Expanded = { value: string; vars: string[] } | { missing: string };\n\n/** `${VAR}` (and `${VAR:-default}`, `${env:VAR}`) from `vars`. */\nexport function expandVars(value: string, vars: Record<string, string | undefined>): Expanded {\n const used: string[] = [];\n let missing: string | null = null;\n const out = value.replace(/\\$\\{(?:env:)?([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\\}/g, (_m, name: string, def: string | undefined) => {\n const v = vars[name];\n if (v !== undefined && v !== \"\") {\n used.push(name);\n return v;\n }\n if (def !== undefined) return def;\n missing ??= name;\n return \"\";\n });\n return missing ? { missing } : { value: out, vars: used };\n}\n\nconst isObj = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst readJson = (file: string): Record<string, unknown> | null => {\n if (!existsSync(file)) return null;\n const text = readFileSync(file, \"utf8\");\n if (!text.trim()) return {};\n try {\n const doc = JSON.parse(text) as unknown;\n if (!isObj(doc)) throw new Error(\"not an object\");\n return doc;\n } catch {\n throw new Error(`${file} isn't plain JSON (comments?), so it can't be read automatically.`);\n }\n};\n\n/** Shared by the JSON-shaped clients (Claude Code, Cursor): one `mcpServers` entry. */\nfunction jsonEntry(name: string, raw: unknown, file: string, vars: Record<string, string | undefined>, extra: Partial<ClientEntry> = {}): ClientEntry {\n const base: ClientEntry = { name, file, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true, ...extra };\n if (!isObj(raw)) return { ...base, problem: \"this entry isn't an object\" };\n if (raw.disabled === true || raw.enabled === false) base.enabled = false;\n const type = typeof raw.type === \"string\" ? raw.type.toLowerCase() : null;\n if (type === \"stdio\" || (typeof raw.command === \"string\" && !raw.url)) {\n const args = Array.isArray(raw.args) ? raw.args.map(String) : [];\n return { ...base, transport: \"stdio\", command: [String(raw.command ?? \"\"), ...args].join(\" \").trim() };\n }\n if (typeof raw.url !== \"string\") return { ...base, problem: \"no url\" };\n const url = expandVars(raw.url, vars);\n if (\"missing\" in url) return { ...base, problem: `its url uses \\${${url.missing}}, which isn't set here` };\n const entry: ClientEntry = { ...base, url: url.value, transport: type === \"sse\" ? \"sse\" : \"http\" };\n if (raw.headersHelper !== undefined || raw.headers_helper !== undefined) return { ...entry, problem: \"it gets its headers from a helper command, which the broker can't run\" };\n if (raw.oauth !== undefined || raw.auth !== undefined) entry.oauth = true;\n return withHeaders(entry, raw.headers, vars);\n}\n\nfunction withHeaders(entry: ClientEntry, headers: unknown, vars: Record<string, string | undefined>): ClientEntry {\n if (headers === undefined || headers === null) return entry;\n if (!isObj(headers)) return { ...entry, problem: \"its headers can't be read\" };\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v !== \"string\") return { ...entry, problem: `its ${k} header can't be read` };\n const x = expandVars(v, vars);\n if (\"missing\" in x) return { ...entry, problem: `its ${k} header uses \\${${x.missing}}, which isn't set here` };\n entry.headers[k] = x.value;\n entry.headerVars.push(...x.vars);\n entry.headerSources[k] = x.vars;\n }\n return entry;\n}\n\n// ───────────── Hermes ─────────────\n\nexport function hermesFiles(env: NodeJS.ProcessEnv = process.env): { config: string; env: string } {\n const home = hermesHome(env);\n return { config: join(home, \"config.yaml\"), env: join(home, \".env\") };\n}\n\nfunction readHermes(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const files = hermesFiles(env);\n const result: ClientConfig = { client: \"hermes\", files: [files.config], entries: [] };\n if (!existsSync(files.config)) return result;\n const servers = readMcpServers(readFileSync(files.config, \"utf8\"));\n if (!servers) throw new Error(`${files.config} has an mcp_servers layout this can't read (flow style, several blocks, or tabs). Nothing was changed.`);\n // Hermes loads ~/.hermes/.env into its environment: the secrets its ${VAR} headers name live there.\n const vars = { ...env, ...(existsSync(files.env) ? parseDotenv(readFileSync(files.env, \"utf8\")) : {}) };\n for (const [name, raw] of Object.entries(servers)) {\n if (name.startsWith(\"\\u0000\")) continue;\n const base: ClientEntry = { name, file: files.config, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true };\n if (!raw || raw === YAML_UNREADABLE || typeof raw !== \"object\" || Array.isArray(raw)) {\n result.entries.push({ ...base, problem: \"this entry can't be read\" });\n continue;\n }\n const e = raw as YamlMap;\n const unreadable = [\"url\", \"headers\", \"command\", \"auth\", \"transport\", \"enabled\"].find((k) => e[k] === YAML_UNREADABLE);\n if (unreadable) {\n result.entries.push({ ...base, problem: `its ${unreadable} can't be read` });\n continue;\n }\n if (e.enabled === false || (typeof e.enabled === \"string\" && [\"false\", \"no\", \"off\", \"0\"].includes(e.enabled.toLowerCase()))) base.enabled = false;\n if (typeof e.command === \"string\") {\n const args = Array.isArray(e.args) ? e.args.filter((a) => typeof a === \"string\") : [];\n result.entries.push({ ...base, transport: \"stdio\", command: [e.command, ...args].join(\" \") });\n continue;\n }\n if (typeof e.url !== \"string\") {\n result.entries.push({ ...base, problem: \"no url\" });\n continue;\n }\n const url = expandVars(e.url, vars);\n if (\"missing\" in url) {\n result.entries.push({ ...base, problem: `its url uses \\${${url.missing}}, which isn't set in ${files.env}` });\n continue;\n }\n const tools = isObj(e.tools) ? (e.tools as Record<string, unknown>) : {};\n const entry: ClientEntry = {\n ...base,\n url: url.value,\n transport: e.transport === \"sse\" ? \"sse\" : \"http\",\n oauth: e.auth === \"oauth\" || isObj(e.oauth),\n dropped: droppedFrom(e as Record<string, unknown>, { include: tools.include, exclude: tools.exclude }, [\"timeout\", \"connect_timeout\"]),\n };\n if (e.client_cert !== undefined || e.identity_header !== undefined) {\n result.entries.push({ ...entry, problem: \"it uses a client certificate or identity header, which the broker doesn't support yet\" });\n continue;\n }\n result.entries.push(withHeaders(entry, e.headers ?? undefined, vars));\n }\n return result;\n}\n\n// ───────────── Claude Code ─────────────\n\nfunction readClaude(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const cwd = opts.cwd ?? process.cwd();\n const userFile = claudeConfigFile();\n const projectFile = join(cwd, \".mcp.json\");\n const result: ClientConfig = { client: \"claude-code\", files: [userFile, projectFile].filter(existsSync), entries: [] };\n const seen = new Set<string>();\n const add = (e: ClientEntry) => {\n // Claude Code's precedence: local, then project, then user. A shadowed one isn't what the agent uses.\n if (seen.has(e.name)) return;\n seen.add(e.name);\n result.entries.push(e);\n };\n const doc = readJson(userFile);\n const proj = doc && isObj(doc.projects) && isObj(doc.projects[cwd]) ? (doc.projects[cwd] as Record<string, unknown>) : {};\n const local = proj.mcpServers;\n if (isObj(local)) for (const [n, raw] of Object.entries(local)) add(jsonEntry(n, raw, userFile, env, { scope: \"local\", projectDir: cwd }));\n const project = readJson(projectFile);\n if (project && isObj(project.mcpServers)) {\n // ./.mcp.json comes with the repository. Claude Code itself only uses the servers the user approved for this\n // project (kept in ~/.claude.json, which the repository can't write); a project's own .claude/settings*.json\n // isn't trusted for this.\n const list = (v: unknown) => (Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : []);\n const enabled = new Set(list(proj.enabledMcpjsonServers));\n const disabled = new Set(list(proj.disabledMcpjsonServers));\n const all = proj.enableAllProjectMcpServers === true;\n for (const [n, raw] of Object.entries(project.mcpServers)) {\n const e = jsonEntry(n, raw, projectFile, env, { scope: \"project\", projectDir: cwd, fromProject: true });\n const why = disabled.has(n) ? \"turned off for this project in Claude Code\" : !all && !enabled.has(n) ? \"not approved in Claude Code\" : null;\n // An unapproved one isn't what Claude Code uses, so it doesn't shadow a user-scope server of the same name.\n if (why) result.entries.push({ ...e, problem: why });\n else add(e);\n }\n }\n if (doc && isObj(doc.mcpServers)) for (const [n, raw] of Object.entries(doc.mcpServers)) add(jsonEntry(n, raw, userFile, env, { scope: \"user\" }));\n return result;\n}\n\n// ───────────── Cursor ─────────────\n\nfunction readCursor(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const file = cursorConfigFile();\n const result: ClientConfig = { client: \"cursor\", files: [file], entries: [] };\n const doc = readJson(file);\n if (doc && isObj(doc.mcpServers)) for (const [n, raw] of Object.entries(doc.mcpServers)) result.entries.push(jsonEntry(n, raw, file, env));\n return result;\n}\n\n// ───────────── Codex ─────────────\n\nfunction readCodex(opts: ReadOptions): ClientConfig {\n const env = opts.env ?? process.env;\n const file = codexConfigFile();\n const result: ClientConfig = { client: \"codex\", files: [file], entries: [] };\n if (!existsSync(file)) return result;\n for (const [name, raw] of Object.entries(readTomlMcpServers(readFileSync(file, \"utf8\")))) {\n const base: ClientEntry = { name, file, transport: \"http\", headers: {}, headerVars: [], headerSources: {}, oauth: false, enabled: true };\n if (raw === TOML_UNREADABLE) {\n result.entries.push({ ...base, problem: \"this entry can't be read\" });\n continue;\n }\n const e = raw as TomlTable;\n if (e.enabled === false) base.enabled = false;\n if (typeof e.command === \"string\") {\n const args = Array.isArray(e.args) ? e.args.filter((a): a is string => typeof a === \"string\") : [];\n result.entries.push({ ...base, transport: \"stdio\", command: [e.command, ...args].join(\" \") });\n continue;\n }\n if (typeof e.url !== \"string\") {\n result.entries.push({ ...base, problem: \"no url\" });\n continue;\n }\n const entry: ClientEntry = {\n ...base,\n url: e.url,\n oauth: isObj(e.oauth) || e.auth === \"oauth\",\n dropped: droppedFrom(e, { include: e.enabled_tools, exclude: e.disabled_tools }, [\"tool_timeout_sec\", \"startup_timeout_sec\"]),\n };\n if (e.http_headers_helper !== undefined) {\n result.entries.push({ ...entry, problem: \"it gets its headers from a helper command, which the broker can't run\" });\n continue;\n }\n // Codex has no ${VAR} expansion: env_http_headers and bearer_token_env_var name variables instead.\n const headers: Record<string, string> = {};\n let problem: string | undefined;\n if (e.http_headers !== undefined) {\n if (!isObj(e.http_headers) || Object.values(e.http_headers).some((v) => typeof v !== \"string\")) problem = \"its http_headers can't be read\";\n else {\n Object.assign(headers, e.http_headers);\n for (const h of Object.keys(e.http_headers)) entry.headerSources[h] = [];\n }\n }\n const fromEnv: Record<string, unknown> = isObj(e.env_http_headers) ? { ...e.env_http_headers } : {};\n if (e.bearer_token_env_var !== undefined) fromEnv.Authorization = e.bearer_token_env_var;\n for (const [h, varName] of Object.entries(fromEnv)) {\n if (typeof varName !== \"string\") problem ??= `its ${h} header can't be read`;\n else if (!env[varName]) problem ??= `its ${h} header comes from $${varName}, which isn't set here`;\n else {\n headers[h] = h === \"Authorization\" && e.bearer_token_env_var === varName ? `Bearer ${env[varName]}` : env[varName]!;\n entry.headerVars.push(varName);\n entry.headerSources[h] = [varName];\n }\n }\n entry.headers = headers;\n result.entries.push(problem ? { ...entry, problem } : entry);\n }\n return result;\n}\n\nexport function readClientConfig(client: ImportClient, opts: ReadOptions = {}): ClientConfig {\n switch (client) {\n case \"hermes\":\n return readHermes(opts);\n case \"claude-code\":\n return readClaude(opts);\n case \"cursor\":\n return readCursor(opts);\n case \"codex\":\n return readCodex(opts);\n }\n}\n\nexport function parseImportClient(value: string): ImportClient {\n const v = value.trim().toLowerCase().replace(/^claude$/, \"claude-code\");\n if (!(IMPORT_CLIENTS as readonly string[]).includes(v)) throw new Error(`Unknown --from \"${value}\". Choose one of: ${IMPORT_CLIENTS.join(\", \")}.`);\n return v as ImportClient;\n}\n","import pc from \"picocolors\";\nimport type { Agent } from \"../../shared/types.ts\";\nimport type { AccessLevel } from \"../broker/types.ts\";\nimport { mcpTarget, type McpSetupResult, type RemoveServer, setupMcp } from \"../listen/mcpsetup.ts\";\nimport { DEFAULT_PROFILE, profilePath } from \"../listen/paths.ts\";\nimport { loadProfile, type Profile, profileExists } from \"../listen/profile.ts\";\nimport { safeText } from \"../listen/ui.ts\";\nimport { NPX } from \"../listen/version.ts\";\nimport type { LookupFn } from \"../webhooks/ssrf.ts\";\nimport { accessLabel, agentsLabel, chooseAccess, chooseAgents, parseAccess } from \"./access.ts\";\nimport { isWorking, waitWorking } from \"./manage.ts\";\nimport { confinedRoutes } from \"./routes.ts\";\nimport { mcpServerName } from \"../listen/recipes.ts\";\nimport type { ConnectionsApi, ConnectionView } from \"./api.ts\";\nimport { CLIENT_LABELS, type ClientConfig, type ClientEntry, type ImportClient, parseImportClient, readClientConfig } from \"./clients.ts\";\nimport { checkTarget } from \"./private.ts\";\nimport type { Prompter } from \"./prompt.ts\";\nimport { reconnectHint, slugify } from \"./util.ts\";\n\n/**\n * `import --from <client>`: one connection per remote MCP server in that client's config, with its static header\n * moved into the broker. OAuth servers are created needing Connect (their tokens stay in the client); stdio ones\n * aren't supported yet (M4) and stay where they are. Nothing is written without a confirmation (or --yes), and\n * the client's config is only touched by the optional setup-mcp step at the end, which removes just the entries\n * whose connection works.\n */\n\nexport interface ImportFlags {\n from: string;\n dryRun?: boolean;\n yes?: boolean;\n access?: string;\n agent?: string[];\n profile?: string;\n /** Exact `scheme://host:port` origins allowed without asking (--yes never allows one). */\n allowPrivate?: string[];\n}\n\nexport interface ImportDeps {\n prompter: Prompter;\n /** Opens the admin channel (not called for --dry-run). */\n openApi: () => ConnectionsApi;\n lookup?: LookupFn;\n env?: NodeJS.ProcessEnv;\n cwd?: string;\n /** This xaq's own MCP origins (loopback with its port), so its entry is never imported. */\n selfOrigins?: string[];\n /** How long to wait for a connected server's first tool sync (default 10 s), and how often to look. */\n verifyMs?: number;\n pollMs?: number;\n}\n\nexport type PlanItem =\n | { action: \"self\"; entry: ClientEntry }\n | { action: \"stdio\"; entry: ClientEntry }\n | { action: \"skip\"; entry: ClientEntry; reason: string }\n | { action: \"exists\"; entry: ClientEntry; connection: ConnectionView }\n | {\n action: \"create\";\n entry: ClientEntry;\n slug: string;\n /** The connection's name: the entry's, with \" (2)\", \" (3)\"… when an existing connection or an earlier item has it. */\n name: string;\n url: string;\n /** header: moved into the broker; oauth: the client says so; none: no credential (the connect finds out). */\n auth: { type: \"header\"; name: string; value: string } | { type: \"oauth\" } | { type: \"none\" };\n /** The exact origin a private-target allow would cover, when the URL is on this machine or a private network. */\n privateTarget: string | null;\n };\n\n// Our own entry under its name, or under the one a profile from before the rename registered: never imported.\nconst SELF_NAME = /^(?:xaq|agentinbox)(?:-[a-z0-9][a-z0-9_-]*)?$/; // rename-xaq: keep\n\nfunction isSelf(e: ClientEntry, selfOrigins: string[]): boolean {\n if (SELF_NAME.test(e.name)) return true;\n if (Object.values(e.headers).some((v) => /^Bearer\\s+aib_/i.test(v.trim()))) return true;\n if (!e.url) return false;\n try {\n const u = new URL(e.url);\n return u.pathname.replace(/\\/+$/, \"\").endsWith(\"/mcp\") && selfOrigins.includes(u.origin);\n } catch {\n return false;\n }\n}\n\nconst sameUrl = (a: string | null | undefined, b: string) => {\n try {\n return !!a && new URL(a).href.replace(/\\/+$/, \"\") === new URL(b).href.replace(/\\/+$/, \"\");\n } catch {\n return false;\n }\n};\n\nexport async function planImport(config: ClientConfig, ctx: { existing?: ConnectionView[]; lookup?: LookupFn; selfOrigins?: string[] } = {}): Promise<PlanItem[]> {\n const label = CLIENT_LABELS[config.client];\n const taken = new Set((ctx.existing ?? []).map((c) => c.slug));\n // Connection names are unique per owner (case-insensitive), like slugs: de-dupe before anything is created.\n const takenNames = new Set((ctx.existing ?? []).map((c) => c.name.toLowerCase()));\n const items: PlanItem[] = [];\n for (const entry of config.entries) {\n if (isSelf(entry, ctx.selfOrigins ?? [])) {\n items.push({ action: \"self\", entry });\n continue;\n }\n if (entry.transport === \"stdio\") {\n items.push({ action: \"stdio\", entry });\n continue;\n }\n if (entry.problem) {\n items.push({ action: \"skip\", entry, reason: entry.problem });\n continue;\n }\n if (!entry.enabled) {\n items.push({ action: \"skip\", entry, reason: `it's turned off in ${label}` });\n continue;\n }\n let url: URL;\n try {\n url = new URL(entry.url!);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") throw new Error(\"scheme\");\n } catch {\n items.push({ action: \"skip\", entry, reason: \"its url isn't an http(s) URL\" });\n continue;\n }\n const headerNames = Object.keys(entry.headers);\n if (headerNames.length > 1) {\n items.push({ action: \"skip\", entry, reason: `it sends ${headerNames.length} headers (${headerNames.join(\", \")}); a connection keeps one (not supported yet)` });\n continue;\n }\n const existing = (ctx.existing ?? []).find((c) => sameUrl(c.url, url.href));\n if (existing) {\n items.push({ action: \"exists\", entry, connection: existing });\n continue;\n }\n const target = await checkTarget(url, ctx.lookup);\n if (target.kind === \"never\") {\n items.push({\n action: \"skip\",\n entry,\n reason:\n target.why === \"ipv6_literal\"\n ? `the private-network allow takes a hostname or an IPv4 address, not ${target.address}`\n : `it's on ${target.address}, a link-local or cloud metadata address, which is never allowed`,\n });\n continue;\n }\n if (target.kind === \"public\" && url.protocol === \"http:\") {\n items.push({ action: \"skip\", entry, reason: \"plain http to a public host isn't allowed; use its https URL\" });\n continue;\n }\n let slug = slugify(entry.name);\n for (let n = 2; taken.has(slug); n++) slug = `${slugify(entry.name).slice(0, 21)}-${n}`;\n taken.add(slug);\n let name = entry.name;\n for (let n = 2; takenNames.has(name.toLowerCase()); n++) name = `${entry.name} (${n})`;\n takenNames.add(name.toLowerCase());\n const auth = headerNames.length\n ? { type: \"header\" as const, name: headerNames[0]!, value: entry.headers[headerNames[0]!]! }\n : entry.oauth\n ? { type: \"oauth\" as const }\n : { type: \"none\" as const };\n items.push({ action: \"create\", entry, slug, name, url: entry.url!.trim(), auth, privateTarget: target.kind === \"private\" ? target.origin : null });\n }\n return items;\n}\n\nconst where = (e: ClientEntry) => (e.scope ? ` (${e.scope} scope)` : \"\");\nconst hostOf = (url: string) => {\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n};\n\n/** \"its Authorization header (from $GITHUB_TOKEN) is sent to mcp.example.com\": where each secret ends up. */\nfunction headerLine(i: Extract<PlanItem, { action: \"create\" }>): string | null {\n if (i.auth.type !== \"header\") return null;\n const vars = i.entry.headerSources[i.auth.name] ?? [];\n const from = vars.length ? ` (from ${vars.map((v) => `$${v}`).join(\", \")})` : \"\";\n return `its ${i.auth.name} header${from} moves into xaq (encrypted; never shown) and is sent to ${safeText(hostOf(i.url), 120)}`;\n}\n\n/** The plan in plain words. Never prints a header value. */\nexport function renderPlan(config: ClientConfig, items: PlanItem[]): string[] {\n const label = CLIENT_LABELS[config.client];\n const out: string[] = [];\n const width = Math.min(24, Math.max(4, ...items.map((i) => i.entry.name.length)));\n const pad = (s: string) => s.padEnd(width);\n const cont = \" \".repeat(width + 4);\n out.push(`${label}: ${config.files.join(\", \") || \"no config file\"} lists ${items.length} MCP server${items.length === 1 ? \"\" : \"s\"}.`);\n for (const i of items) {\n const name = ` ${pad(safeText(i.entry.name, 40))} `;\n switch (i.action) {\n case \"self\":\n out.push(`${name}${pc.dim(\"skip: this is xaq itself\")}`);\n break;\n case \"stdio\":\n out.push(`${name}${pc.yellow(\"not supported yet (M4)\")}: a local command (${safeText(i.entry.command ?? \"\", 60)}); it stays in ${label}`);\n break;\n case \"skip\":\n out.push(`${name}${pc.yellow(\"skip\")}: ${i.reason}; it stays in ${label}`);\n break;\n case \"exists\":\n if (isWorking(i.connection)) out.push(`${name}already connected: \"${i.connection.slug}\" (${i.connection.tools.total} tools)`);\n else {\n const why =\n i.entry.oauth || i.connection.authType === \"oauth\" || i.connection.status === \"needs_reauth\" ? \"needs Connect\" : `${i.connection.status}, ${i.connection.tools.total} tools`;\n out.push(`${name}already a connection: \"${i.connection.slug}\", ${why}; it stays in ${label} until it works`);\n out.push(`${cont}${reconnectHint(i.connection)}`);\n }\n out.push(...droppedLines(i.entry, cont));\n break;\n case \"create\": {\n out.push(`${name}${pc.green(\"create\")} connection \"${i.slug}\" → ${safeText(i.url, 120)}${where(i.entry)}`);\n if (i.entry.fromProject) out.push(`${cont}${pc.yellow(\"from the project's .mcp.json\")}: asked separately (--yes doesn't answer it)`);\n const h = headerLine(i);\n if (h) out.push(`${cont}${h}`);\n else if (i.auth.type === \"oauth\") out.push(`${cont}OAuth: created needing Connect (${label} keeps its own tokens); sign in once with the link it prints`);\n else out.push(`${cont}no credential in ${label}: connected as it is (if it turns out to use OAuth, it needs Connect)`);\n if (i.privateTarget) out.push(`${cont}${pc.yellow(\"private network\")}: needs the allow for exactly ${i.privateTarget}`);\n out.push(...droppedLines(i.entry, cont));\n break;\n }\n }\n }\n return out;\n}\n\n/** What the client did for this server that the broker doesn't: said in the plan, never silently dropped. */\nfunction droppedLines(e: ClientEntry, cont: string): string[] {\n const d = e.dropped;\n if (!d) return [];\n const out: string[] = [];\n const list = (xs: string[]) => xs.map((x) => safeText(x, 64)).join(\", \");\n if (d.exclude) out.push(`${cont}${pc.yellow(\"not carried over\")}: its tool filter hides ${list(d.exclude)}; through xaq every tool is listed (subject to the access level)`);\n if (d.include) out.push(`${cont}${pc.yellow(\"not carried over\")}: its tool filter shows only ${list(d.include)}; through xaq every tool is listed (subject to the access level)`);\n if (d.settings.length) out.push(`${cont}${pc.yellow(\"not carried over\")}: ${d.settings.join(\", \")} (xaq uses its own 60 s per call)`);\n return out;\n}\n\ntype CreateItem = Extract<PlanItem, { action: \"create\" }>;\n\ninterface Outcome {\n item: CreateItem;\n /** connected: works now; unverified: created, but not working (yet); authorize: needs a sign-in; failed: nothing kept. */\n status: \"connected\" | \"unverified\" | \"authorize\" | \"failed\";\n connection?: ConnectionView;\n authorizeUrl?: string;\n error?: string;\n}\n\nconst works = isWorking;\n\nfunction setupLines(r: McpSetupResult): string[] {\n const out = [r.ok ? `${r.dryRun ? pc.cyan(\"○\") : pc.green(\"✔\")} ${r.message}` : `${pc.yellow(\"!\")} ${r.message}`];\n for (const l of r.changes ?? []) out.push(l.startsWith(\" \") ? pc.gray(` ${l}`) : ` - ${l}`);\n if (r.backup) out.push(pc.gray(` Backup: ${r.backup}`));\n if (!r.ok) for (const l of r.manual ?? []) out.push(` ${l}`);\n for (const n of r.notes ?? []) out.push(pc.dim(` ${n}`));\n if (r.ok && r.verify?.length) out.push(` ${r.dryRun ? \"Afterwards, check it with\" : \"Check it with\"}: ${r.verify.map((v) => pc.cyan(v)).join(\"; \")}`);\n return out;\n}\n\nconst toRemove = (e: ClientEntry): RemoveServer => ({ name: e.name, scope: e.scope, projectDir: e.scope === \"user\" ? undefined : e.projectDir });\n\n/** The agent this machine's client uses (its xaq profile), if that agent is on this daemon. */\ninterface ClientAgent {\n profileName: string;\n profile: Profile | null;\n agent: Agent | null;\n}\n\nexport async function runImport(flags: ImportFlags, deps: ImportDeps): Promise<number> {\n const p = deps.prompter;\n const client: ImportClient = parseImportClient(flags.from);\n const label = CLIENT_LABELS[client];\n const access: AccessLevel | undefined = flags.access ? parseAccess(flags.access) : undefined;\n const config = readClientConfig(client, { env: deps.env, cwd: deps.cwd });\n if (!config.entries.length) {\n p.print(`${label} has no MCP servers configured (${config.files.join(\", \") || \"no config file\"}). Nothing to import.`);\n return 0;\n }\n const profileName = flags.profile ?? DEFAULT_PROFILE;\n\n if (flags.dryRun) {\n // Existing connections from the daemon when it's reachable, so a re-run's plan is the real one.\n let existing: ConnectionView[] | undefined;\n try {\n existing = await deps.openApi().list();\n } catch {\n existing = undefined;\n }\n const items = await planImport(config, { existing, lookup: deps.lookup, selfOrigins: deps.selfOrigins });\n p.print(pc.bold(\"Dry run: nothing is created or changed.\"));\n for (const l of renderPlan(config, items)) p.print(l);\n const creates = items.filter((i): i is CreateItem => i.action === \"create\");\n const priv = creates.filter((i) => i.privateTarget);\n p.print(\"\");\n p.print(`Would create ${creates.length} connection${creates.length === 1 ? \"\" : \"s\"} with ${access ? accessLabel(access) : \"the access you choose (default: Ask before risky actions)\"}.`);\n if (priv.length) p.print(`Would ask before allowing ${priv.map((i) => i.privateTarget).join(\", \")} (--yes never does; --allow-private <origin> does for that origin).`);\n if (!existing) p.print(pc.dim(\"xaq wasn't reachable, so existing connections weren't checked (the real run does: nothing is created twice).\"));\n const removable = [\n ...items.filter((i): i is Extract<PlanItem, { action: \"exists\" }> => i.action === \"exists\" && works(i.connection)).map((i) => toRemove(i.entry)),\n ...creates.filter((i) => i.auth.type !== \"oauth\").map((i) => toRemove(i.entry)),\n ];\n p.print(\"\");\n if (!removable.length) p.print(`${label}'s config isn't changed.`);\n else if (!profileExists(profileName)) {\n p.print(`Afterwards it offers to replace the imported entries in ${label} with the single xaq entry, once this machine's ${label} is paired (${NPX} connect <xaq-url> --tool ${client}).`);\n } else {\n p.print(`Afterwards it offers setup-mcp --tool ${client}, which would (for the entries whose connection works and that ${label}'s agent can use; OAuth ones after you Reconnect them):`);\n const r = setupMcp(client, mcpTarget(profileName, loadProfile(profileName)), profilePath(profileName), { dryRun: true, removeServers: removable });\n for (const l of setupLines(r)) p.print(l);\n }\n return 0;\n }\n\n const api = deps.openApi();\n const existing = await api.list();\n const items = await planImport(config, { existing, lookup: deps.lookup, selfOrigins: deps.selfOrigins });\n for (const l of renderPlan(config, items)) p.print(l);\n let creates = items.filter((i): i is CreateItem => i.action === \"create\");\n const already = items.filter((i): i is Extract<PlanItem, { action: \"exists\" }> => i.action === \"exists\");\n p.print(\"\");\n\n // A project's .mcp.json was written by whoever can commit to the repository: its own confirmation, never --yes.\n const fromProject = creates.filter((i) => i.entry.fromProject);\n if (fromProject.length) {\n p.print(pc.yellow(`These come from ${fromProject[0]!.entry.file}, which ships with the project (anyone who can commit to it wrote them):`));\n for (const i of fromProject) p.print(` ${safeText(i.entry.name, 40)} → ${safeText(i.url, 120)}${headerLine(i) ? `; ${headerLine(i)}` : \"\"}`);\n if (!(await p.confirmExplicit(`Import ${fromProject.length === 1 ? \"it\" : `these ${fromProject.length}`} into xaq?`, \"they stay in Claude Code\"))) {\n creates = creates.filter((i) => !i.entry.fromProject);\n }\n }\n\n // The private-target allow: only a person at the terminal (or --allow-private naming the exact origin) gives it.\n const preAllowed = new Set(flags.allowPrivate ?? []);\n const priv = creates.filter((i) => i.privateTarget && !preAllowed.has(i.privateTarget));\n for (const i of creates.filter((x) => x.privateTarget && preAllowed.has(x.privateTarget))) p.print(`Allowing ${i.privateTarget} (${safeText(i.entry.name, 40)}): --allow-private.`);\n if (priv.length) {\n p.print(pc.yellow(\"These servers are on this machine or your private network:\"));\n for (const i of priv) p.print(` ${i.privateTarget} (${safeText(i.entry.name, 40)})`);\n p.print(\n pc.dim(\"A connection to such a server can reach other services there too. Each allow covers exactly that scheme://host:port, for that connection only.\"),\n );\n const names = priv.map((i) => i.entry.name).join(\", \");\n if (!(await p.confirmExplicit(`Allow xaq to connect to ${priv.length === 1 ? \"it\" : `these ${priv.length}`}?`, `skipping ${names} (pass --allow-private <origin> to allow one)`))) {\n creates = creates.filter((i) => !priv.includes(i));\n }\n }\n\n const who = await clientAgent(api, profileName);\n if (!creates.length) {\n p.print(\"Nothing to create.\");\n return offerSetup(\n deps,\n api,\n client,\n who,\n already.filter((a) => works(a.connection)).map((a) => ({ entry: a.entry, connection: a.connection })),\n already.filter((a) => !works(a.connection)).map((a) => a.entry.name),\n 0,\n );\n }\n\n const level = await chooseAccess(p, access);\n let agents = await chooseAgents(p, api, flags.agent);\n if (agents !== \"all\" && who.agent && !agents.includes(who.agent.id)) {\n p.print(pc.yellow(`${safeText(who.agent.name, 60)} (the agent ${label} on this machine uses) isn't among them, so ${label} couldn't use these through xaq.`));\n if (await p.confirm(`Include ${safeText(who.agent.name, 60)}?`, true)) agents = [...agents, who.agent.id];\n }\n if (!(await p.confirm(`Create ${creates.length} connection${creates.length === 1 ? \"\" : \"s\"} (${accessLabel(level)}, ${agentsLabel(agents)})?`, true))) {\n p.print(\"Nothing was created.\");\n return 0;\n }\n\n const outcomes: Outcome[] = [];\n for (const item of creates) {\n let created: ConnectionView | null = null;\n try {\n created = await api.create({ slug: item.slug, name: item.name, url: item.url, levelDefault: level, ...(agents === \"all\" ? {} : { agentIds: agents }) });\n if (item.privateTarget) await api.allowPrivateTarget(created.id, true);\n const r = await api.connect(created.id, item.auth.type === \"header\" ? { header: { name: item.auth.name, value: item.auth.value } } : {});\n if (r.status === \"connected\") {\n // \"connected\" means stored, not tested (a header connect doesn't call the server): wait for the first tool sync.\n const after = await waitWorking(api, r.connection, { pollMs: deps.pollMs, ms: deps.verifyMs });\n outcomes.push({ item, status: works(after) ? \"connected\" : \"unverified\", connection: after });\n } else if (r.status === \"authorize\") outcomes.push({ item, status: \"authorize\", connection: created, authorizeUrl: r.authorizeUrl });\n else throw new Error(r.message);\n } catch (err) {\n // Nothing half-made stays behind: running the import again retries it cleanly.\n if (created) await api.remove(created.id).catch(() => {});\n outcomes.push({ item, status: \"failed\", error: err instanceof Error ? err.message : String(err) });\n }\n }\n\n p.print(\"\");\n for (const o of outcomes) {\n const name = safeText(o.item.entry.name, 40);\n if (o.status === \"failed\") p.print(`${pc.red(\"✘\")} ${name}: ${safeText(o.error!, 300)} (it stays in ${label})`);\n else if (o.status === \"connected\") p.print(`${pc.green(\"✔\")} ${name} → \"${o.connection!.slug}\", ${o.connection!.tools.total} tools`);\n else if (o.status === \"unverified\") {\n const c = o.connection!;\n p.print(`${pc.yellow(\"○\")} ${name} → \"${c.slug}\": not working (${c.status}${c.statusReason ? `: ${safeText(c.statusReason, 200)}` : \"\"}, ${c.tools.total} tools), so it stays in ${label}.`);\n p.print(` ${reconnectHint(c)} then run this import again.`);\n }\n else {\n p.print(`${pc.yellow(\"○\")} ${name} → \"${o.connection!.slug}\": needs Connect. Sign in (link valid 15 minutes):`);\n p.print(` ${pc.cyan(o.authorizeUrl!)}`);\n p.print(` ${reconnectHint(o.connection!)}`);\n }\n }\n const failed = outcomes.filter((o) => o.status === \"failed\").length;\n const working = [\n ...already.filter((a) => works(a.connection)).map((a) => ({ entry: a.entry, connection: a.connection })),\n ...outcomes.filter((o) => o.status === \"connected\").map((o) => ({ entry: o.item.entry, connection: o.connection! })),\n ];\n const pending = [\n ...already.filter((a) => !works(a.connection)).map((a) => a.entry.name),\n ...outcomes.filter((o) => o.status === \"authorize\" || o.status === \"unverified\").map((o) => o.item.entry.name),\n ];\n return offerSetup(deps, api, client, who, working, pending, failed ? 1 : 0);\n}\n\nasync function clientAgent(api: ConnectionsApi, profileName: string): Promise<ClientAgent> {\n if (!profileExists(profileName)) return { profileName, profile: null, agent: null };\n const profile = loadProfile(profileName);\n const agent = (await api.agents()).find((a) => a.id === profile.agentId && !a.disabled) ?? null;\n return { profileName, profile, agent };\n}\n\n/**\n * Step 2: replace the entries now served by the broker with the single xaq entry (setup-mcp). Only entries\n * the client's own agent can use through xaq go: the profile's agent must be on this daemon and have a grant\n * on the connection (offered when it has none).\n */\nasync function offerSetup(\n deps: ImportDeps,\n api: ConnectionsApi,\n client: ImportClient,\n who: ClientAgent,\n working: { entry: ClientEntry; connection: ConnectionView }[],\n pending: string[],\n code: number,\n): Promise<number> {\n const p = deps.prompter;\n const label = CLIENT_LABELS[client];\n if (pending.length) p.print(pc.dim(`${pending.join(\", \")} stay${pending.length === 1 ? \"s\" : \"\"} in ${label} until ${pending.length === 1 ? \"it works\" : \"they work\"} through xaq (Reconnect); then run this import again to replace ${pending.length === 1 ? \"it\" : \"them\"}.`));\n if (!working.length) return code;\n if (!who.profile) {\n p.print(\n `To replace ${working.map((w) => w.entry.name).join(\", \")} in ${label} with the single xaq entry, pair it first ` +\n `(${NPX} connect <xaq-url> --tool ${client}) and run this import again.`,\n );\n return code;\n }\n if (!who.agent) {\n p.print(\n pc.yellow(\n `The agent in your \"${who.profileName}\" profile (${safeText(who.profile.agentId, 40)}) isn't an agent of this xaq (or is disabled), so ${label} ` +\n `couldn't use these through it. Not replacing anything in ${label}. Pair it with this xaq (${NPX} connect <xaq-url> --tool ${client} --force), then run this import again.`,\n ),\n );\n return code;\n }\n const agentName = safeText(who.agent.name, 60);\n const usable: ClientEntry[] = [];\n for (const w of working) {\n if (w.entry.fromProject) {\n // ./.mcp.json is the project's file (often committed): left for its owners to change.\n p.print(pc.dim(` \"${w.entry.name}\" stays in ${w.entry.file}: it ships with the project. Remove it there if the project no longer needs it.`));\n continue;\n }\n const grants = await api.grants(w.connection.id);\n if (grants.some((g) => g.agentId === who.agent!.id)) {\n usable.push(w.entry);\n continue;\n }\n if (await p.confirm(`${agentName} (the agent ${label} uses) has no access to \"${w.connection.slug}\". Give it ${accessLabel(w.connection.levelDefault)}?`, true)) {\n await api.setGrants(w.connection.id, [...grants.map((g) => ({ agentId: g.agentId, level: g.level })), { agentId: who.agent.id, level: w.connection.levelDefault }]);\n usable.push(w.entry);\n } else p.print(pc.dim(` \"${w.entry.name}\" stays in ${label}: its agent couldn't use \"${w.connection.slug}\".`));\n }\n if (!usable.length) return code;\n p.print(\"\");\n const question = `Replace ${usable.map((e) => `\"${e.name}\"`).join(\", \")} in ${label} with the single xaq entry (setup-mcp --tool ${client}, with a backup)?`;\n const routes = confinedRoutes(client, mcpServerName(who.profileName), deps.env);\n let ok: boolean;\n if (routes.length) {\n const slugs = working.filter((w) => usable.includes(w.entry)).map((w) => w.connection.slug);\n p.print(pc.yellow(`These ${label} settings are limited to the xaq server only:`));\n for (const r of routes) p.print(` ${safeText(r, 120)}`);\n p.print(\n pc.yellow(\n `Through xaq they now also see the tools of ${slugs.map((s) => `\"${s}\"`).join(\", \")} (as <name>__<tool>), which ${routes.length === 1 ? \"it\" : \"they\"} couldn't reach before. ` +\n `If one is triggered by email or webhooks, those tools become reachable from that content. Give ${agentName} less access on those connections, or keep them out, if that's not what you want.`,\n ),\n );\n ok = await p.confirmExplicit(question, `${label}'s config wasn't changed; decide in a terminal`);\n } else ok = await p.confirm(question, true);\n if (!ok) {\n p.print(`${label}'s config wasn't changed. Run this import again any time to do it.`);\n return code;\n }\n const r = setupMcp(client, mcpTarget(who.profileName, who.profile), profilePath(who.profileName), { removeServers: usable.map(toRemove) });\n for (const l of setupLines(r)) p.print(l);\n const vars = [...new Set(usable.flatMap((e) => ((r.removed ?? []).includes(e.name) ? e.headerVars : [])))];\n if (r.ok && vars.length) {\n p.print(pc.dim(` ${vars.join(\", \")} ${vars.length === 1 ? \"is\" : \"are\"} no longer needed by the removed entries; delete ${vars.length === 1 ? \"it\" : \"them\"} from your environment${client === \"hermes\" ? \" (~/.hermes/.env)\" : \"\"} once everything works through xaq.`));\n }\n return r.ok ? code : 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAYA,SAAgB,eAAe,QAAsB,YAAoB,MAAyB,QAAQ,KAAe;CACvH,IAAI,WAAW,UAAU,OAAO,CAAC;CACjC,MAAM,OAAO,WAAW,GAAG;CAC3B,MAAM,wBAAQ,IAAI,IAAI,CAAC,YAAY,OAAO,YAAY,CAAC;CACvD,MAAM,YAAY,MAAe,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,OAAO,MAAM,YAAY,MAAM,IAAI,CAAC,CAAC;CACxG,MAAM,MAAgB,CAAC;CACvB,MAAM,QAAQ,SAA0B;EACtC,IAAI;GACF,OAAO,WAAW,IAAI,IAAI,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,IAAI;EACvF,QAAQ;GACN,OAAO;EACT;CACF;CACA,IAAI;EACF,MAAM,SAAS,KAAK,MAAM,aAAa;EACvC,IAAI,WAAW,MAAM,GAAG;GACtB,MAAM,OAAO,aAAa,QAAQ,MAAM;GACxC,MAAM,YAAY,WAAW,MAAM,mBAAmB,KAAK,CAAC;GAC5D,KAAK,MAAM,CAAC,UAAU,aAAa,OAAO,QAAQ,SAAS,GAAG,IAAI,SAAS,QA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AI,IAAI,EAAE,aAAa,CAAC,CAAE,CAAC,CAAC;CACzG,IAAI,EAAE,MAAM,KAAK,QACf,EAAE,MAAM,GAAG,IAAI,KAAK,KAAK,KAAK,IAAI,EAAE,GAAG,KAAK,WAAW,IAAI,OAAO,MAAM,mDAAmD,KAAK,WAAW,IAAI,OAAO,OAAO,wBAAwB,WAAW,WAAW,sBAAsB,GAAG,oCAAoC,CAAC;CAE3Q,OAAO,EAAE,KAAK,OAAO;AACvB"}
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as NPX } from "./version-BxH7OuWD.js";
3
3
  import { i as safeText } from "./ui-B8Sd4Y7Y.js";
4
- import { a as urlHost, r as normalizeIp } from "./ssrf-BlVpGZ7C.js";
4
+ import { h as urlHost, n as presetServerUrl, p as normalizeIp, t as presetServerSlug } from "./user-server-huynScXf.js";
5
5
  import { BlockList, isIP } from "node:net";
6
6
  import pc from "picocolors";
7
7
  import { lookup } from "node:dns/promises";
@@ -352,7 +352,7 @@ async function addPreset(preset, flags, deps, taken) {
352
352
  };
353
353
  return createThen({
354
354
  slug,
355
- name: preset.displayName,
355
+ ...flags.name ? { name: flags.name } : {},
356
356
  preset: preset.id
357
357
  }, flags, deps, (c) => connectNow(c, input, deps, flags));
358
358
  }
@@ -375,14 +375,21 @@ function describeProbe(p, probe) {
375
375
  else p.print(safeText(probe.message, 200));
376
376
  }
377
377
  const MANUAL_CLIENT = "It needs a client ID from the provider; finish it in the console's Connections page.";
378
- async function addUrl(raw, flags, deps, taken) {
378
+ /** `preset`: an integration whose server you name (t3code): its steps first, then the same check as a custom URL. */
379
+ async function addUrl(raw, flags, deps, taken, preset = null) {
379
380
  const { api, prompter: p } = deps;
380
381
  let url;
381
382
  try {
382
- url = new URL(raw.trim());
383
+ url = new URL(preset?.userServer ? presetServerUrl(raw, preset.userServer.defaultPath) : raw.trim());
383
384
  } catch {
384
385
  throw new Error(`"${raw}" isn't a URL. Use the server's full MCP address, e.g. https://mcp.example.com/mcp.`);
385
386
  }
387
+ if (preset) {
388
+ p.print(pc.bold(`Connect ${safeText(preset.displayName, 60)}`));
389
+ preset.setupSteps.forEach((step, i) => {
390
+ for (const l of renderStep(step, i + 1)) p.print(l);
391
+ });
392
+ }
386
393
  p.print(`Checking ${pc.cyan(url.href)}…`);
387
394
  const probe = await api.probe(url.href);
388
395
  let allowPrivate = false;
@@ -402,15 +409,18 @@ async function addUrl(raw, flags, deps, taken) {
402
409
  if (probe.auth === "oauth" && probe.registration === "manual") throw new Error(MANUAL_CLIENT);
403
410
  if (probe.auth === "header") header = await headerFor(p, flags);
404
411
  }
412
+ if (preset && !allowPrivate && probe.auth !== "oauth") throw new Error(`${url.host} doesn't look like a ${preset.displayName} server: it doesn't ask for a sign-in.`);
405
413
  return createThen({
406
- slug: await askSlug(p, flags.slug, slugFromUrl(url), taken),
407
- name: url.hostname,
414
+ slug: await askSlug(p, flags.slug, preset ? presetServerSlug(preset.slug, url.href) : slugFromUrl(url), taken),
415
+ ...flags.name ? { name: flags.name } : {},
416
+ ...preset ? { preset: preset.id } : {},
408
417
  url: url.href
409
418
  }, flags, deps, async (c) => {
410
419
  if (allowPrivate) {
411
420
  await api.allowPrivateTarget(c.id, true);
412
421
  const again = await api.probe(url.href, c.id);
413
422
  if (again.blocked || !again.reachable) throw new Error(again.message);
423
+ if (preset && again.auth !== "oauth") throw new Error(`${url.host} doesn't look like a ${preset.displayName} server: it doesn't ask for a sign-in.`);
414
424
  describeProbe(p, again);
415
425
  if (again.auth === "oauth" && again.registration === "manual") throw new Error(MANUAL_CLIENT);
416
426
  if (again.auth === "header") header = await headerFor(p, flags);
@@ -421,10 +431,21 @@ async function addUrl(raw, flags, deps, taken) {
421
431
  async function addConnection(target, flags, deps) {
422
432
  const existing = await deps.api.list();
423
433
  const taken = new Set(existing.map((c) => c.slug));
434
+ if (flags.name !== void 0) {
435
+ const name = flags.name.trim();
436
+ if (!name) throw new Error("--name can't be empty.");
437
+ const clash = existing.find((c) => c.name.toLowerCase() === name.toLowerCase());
438
+ if (clash) throw new Error(`You already have a connection named "${safeText(clash.name, 100)}" ("${clash.slug}"). Pick another --name, or leave it out.`);
439
+ flags = {
440
+ ...flags,
441
+ name
442
+ };
443
+ }
424
444
  if (isUrl(target)) return addUrl(target, flags, deps, taken);
425
445
  const presets = await deps.api.presets();
426
446
  const preset = presets.find((x) => x.id === target.trim().toLowerCase());
427
447
  if (!preset) throw new Error(`Unknown integration "${target}". Use ${[...presets.map((x) => x.id), "<an MCP server URL>"].join(", ")}.`);
448
+ if (preset.userServer) return addUrl(flags.url ?? await deps.prompter.ask(`Address of your ${preset.displayName} server (e.g. http://100.101.102.103:3773)`), flags, deps, taken, preset);
428
449
  return addPreset(preset, flags, deps, taken);
429
450
  }
430
451
  async function listConnections(deps) {
@@ -473,4 +494,4 @@ async function removeConnection(slug, deps) {
473
494
  //#endregion
474
495
  export { chooseAccess as _, isWorking as a, removeConnection as c, waitWorking as d, reconnectHint as f, agentsLabel as g, accessLabel as h, disableConnection as i, renderStep as l, checkTarget as m, authorize as n, listConnections as o, slugify as p, connectNow as r, reconnectConnection as s, addConnection as t, slugFromUrl as u, chooseAgents as v, parseAccess as y };
475
496
 
476
- //# sourceMappingURL=manage-BlGiqPRV.js.map
497
+ //# sourceMappingURL=manage-D3eTpw6R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manage-D3eTpw6R.js","names":["dnsLookup"],"sources":["../server/connections-cli/access.ts","../server/connections-cli/private.ts","../server/connections-cli/util.ts","../server/connections-cli/manage.ts"],"sourcesContent":["import pc from \"picocolors\";\nimport type { AccessLevel } from \"../broker/types.ts\";\nimport type { ConnectionsApi } from \"./api.ts\";\nimport type { Prompter } from \"./prompt.ts\";\nimport { safeText } from \"../listen/ui.ts\";\n\n/** The one access question (docs/MCP-BROKER.md \"Access and approvals\") and which agents get it. */\n\nexport const ACCESS_LEVELS: { value: AccessLevel; label: string; short: string }[] = [\n { value: \"full\", label: \"Full access: every tool, never asks\", short: \"Full access\" },\n { value: \"ask\", label: \"Ask before risky actions: deleting, sending, publishing and payments wait for your approval\", short: \"Ask before risky actions\" },\n { value: \"read\", label: \"Read only: only tools that read; the rest aren't listed\", short: \"Read only\" },\n];\n\nexport const accessLabel = (level: AccessLevel) => ACCESS_LEVELS.find((l) => l.value === level)?.short ?? level;\n\nexport function parseAccess(value: string): AccessLevel {\n const v = value.trim().toLowerCase();\n const map: Record<string, AccessLevel> = { full: \"full\", ask: \"ask\", risky: \"ask\", read: \"read\", \"read-only\": \"read\", readonly: \"read\" };\n if (!map[v]) throw new Error(`Unknown --access \"${value}\". Use full, ask or read.`);\n return map[v];\n}\n\nexport async function chooseAccess(p: Prompter, flag: AccessLevel | undefined): Promise<AccessLevel> {\n if (flag) return flag;\n return p.choose(\n \"What can agents do with it?\",\n ACCESS_LEVELS.map((l) => ({ value: l.value, label: l.label })),\n \"ask\",\n );\n}\n\n/** Agent ids, or \"all\". `--agent` takes names or ids. */\nexport async function chooseAgents(p: Prompter, api: ConnectionsApi, flags: string[] | undefined): Promise<string[] | \"all\"> {\n const agents = (await api.agents()).filter((a) => !a.disabled);\n if (flags?.length) {\n if (flags.length === 1 && flags[0] === \"all\") return \"all\";\n return flags.map((f) => {\n const hit = agents.find((a) => a.id === f || a.name.toLowerCase() === f.toLowerCase());\n if (!hit) throw new Error(`No agent \"${f}\". Agents: ${agents.map((a) => a.name).join(\", \") || \"none yet\"}.`);\n return hit.id;\n });\n }\n if (agents.length <= 1 || p.assumeYes || !p.interactive) return \"all\";\n const all = await p.confirm(`Give it to all ${agents.length} agents (${agents.map((a) => safeText(a.name, 40)).join(\", \")})?`, true);\n if (all) return \"all\";\n const picked: string[] = [];\n for (const a of agents) if (await p.confirm(` ${safeText(a.name, 60)}?`, false)) picked.push(a.id);\n if (!picked.length) p.print(pc.yellow(\"No agent gets it for now: give access on an agent's page in the console.\"));\n return picked;\n}\n\nexport const agentsLabel = (agents: string[] | \"all\") => (agents === \"all\" ? \"all agents\" : `${agents.length} agent${agents.length === 1 ? \"\" : \"s\"}`);\n","import { lookup as dnsLookup } from \"node:dns/promises\";\nimport { BlockList, isIP } from \"node:net\";\nimport { type LookupFn, normalizeIp, urlHost } from \"../webhooks/ssrf.ts\";\n\n/**\n * Which upstream URLs need the private-target allow (docs/MCP-BROKER.md#private-targets), decided on the CLI side\n * so the admin can confirm the exact origins before anything is created. The daemon's guard still decides; this\n * only knows what to ask.\n */\n\n/** The ranges a private-target allow may cover: loopback, RFC 1918, CGNAT (Tailscale), ULA. */\nconst ALLOWABLE = new BlockList();\nfor (const [net, prefix] of [\n [\"127.0.0.0\", 8],\n [\"10.0.0.0\", 8],\n [\"172.16.0.0\", 12],\n [\"192.168.0.0\", 16],\n [\"100.64.0.0\", 10],\n] as const) {\n ALLOWABLE.addSubnet(net, prefix, \"ipv4\");\n}\nALLOWABLE.addAddress(\"::1\", \"ipv6\");\nALLOWABLE.addSubnet(\"fc00::\", 7, \"ipv6\");\n\n/** Never allowed, even by an admin: link-local and cloud metadata. */\nconst NEVER = new BlockList();\nNEVER.addSubnet(\"169.254.0.0\", 16, \"ipv4\");\nNEVER.addSubnet(\"fe80::\", 10, \"ipv6\");\nNEVER.addAddress(\"fd00:ec2::254\", \"ipv6\");\nNEVER.addAddress(\"100.100.100.200\", \"ipv4\");\n\nexport type AddressClass = \"public\" | \"private\" | \"never\";\n\nexport function classifyAddress(ip: string): AddressClass {\n const a = normalizeIp(ip);\n const family = isIP(a) === 6 ? \"ipv6\" : \"ipv4\";\n if (NEVER.check(a, family)) return \"never\";\n if (ALLOWABLE.check(a, family)) return \"private\";\n return \"public\";\n}\n\n/** `scheme://host:port` with the port always spelled out: exactly what a private-target allow pins. */\nexport function exactOrigin(url: URL): string {\n const port = url.port || (url.protocol === \"https:\" ? \"443\" : \"80\");\n return `${url.protocol}//${url.hostname}:${port}`;\n}\n\nexport type TargetCheck =\n | { kind: \"public\" }\n | { kind: \"private\"; origin: string; addresses: string[] }\n /** link_local: link-local or cloud metadata; ipv6_literal: the allow takes hostnames and IPv4 only. */\n | { kind: \"never\"; address: string; why: \"link_local\" | \"ipv6_literal\" };\n\nconst defaultLookup: LookupFn = (hostname) => dnsLookup(hostname, { all: true, verbatim: true });\n\n/** Whether `url` is on this machine or a private network (resolving names the way the daemon on this host will). */\nexport async function checkTarget(url: URL, lookup: LookupFn = defaultLookup): Promise<TargetCheck> {\n const host = urlHost(url);\n let addresses: string[];\n if (isIP(host)) addresses = [host];\n else if (host === \"localhost\" || host.endsWith(\".localhost\")) addresses = [\"127.0.0.1\"];\n else {\n try {\n addresses = (await lookup(host)).map((a) => a.address);\n } catch {\n // Unresolvable here: the daemon's probe reports it.\n return { kind: \"public\" };\n }\n }\n const never = addresses.find((a) => classifyAddress(a) === \"never\");\n if (never) return { kind: \"never\", address: never, why: \"link_local\" };\n const priv = addresses.filter((a) => classifyAddress(a) === \"private\");\n if (priv.length && isIP(host) === 6) return { kind: \"never\", address: host, why: \"ipv6_literal\" };\n return priv.length ? { kind: \"private\", origin: exactOrigin(url), addresses: priv } : { kind: \"public\" };\n}\n","import { NPX } from \"../listen/version.ts\";\n\n/** A connection slug (`[a-z0-9-]{1,24}`, like the presets') from a client's server name or a host. */\nexport function slugify(name: string): string {\n const s = name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 24)\n .replace(/-+$/, \"\");\n return s || \"server\";\n}\n\nexport const validSlug = (s: string) => /^[a-z0-9-]{1,24}$/.test(s);\n\n/** How to reconnect it later. */\nexport function reconnectHint(c: { slug: string }): string {\n return `Reconnect: ${NPX} connections reconnect ${c.slug} (or Connections → Reconnect in the console)`;\n}\n","import pc from \"picocolors\";\nimport type { SetupStepView, StartConnectInput } from \"../../shared/types.ts\";\nimport { safeText } from \"../listen/ui.ts\";\nimport { NPX } from \"../listen/version.ts\";\nimport { accessLabel, agentsLabel, chooseAccess, chooseAgents, parseAccess } from \"./access.ts\";\nimport type { ConnectionProbe, ConnectionsApi, ConnectionView, PresetView } from \"./api.ts\";\nimport { presetServerSlug, presetServerUrl } from \"../integrations/user-server.ts\";\nimport { exactOrigin } from \"./private.ts\";\nimport type { Prompter } from \"./prompt.ts\";\nimport { reconnectHint, slugify, validSlug } from \"./util.ts\";\n\n/** `connections add | list | reconnect | disable | remove`. */\n\nexport interface AddFlags {\n slug?: string;\n access?: string;\n agent?: string[];\n /** Header name for a server that wants a static key (default Authorization). */\n header?: string;\n /** Always paste the address the browser lands on, instead of waiting for the redirect. */\n paste?: boolean;\n /** The exact `scheme://host:port` to allow without asking (--yes never allows one). */\n allowPrivate?: string;\n yes?: boolean;\n /** The server's address, for an integration whose server you name (t3code). */\n url?: string;\n /** The connection's name (unique per owner); without it the server picks one (host or preset name, \" (2)\" when taken). */\n name?: string;\n}\n\nexport interface ManageDeps {\n prompter: Prompter;\n api: ConnectionsApi;\n openBrowser?: (url: string) => Promise<unknown>;\n env?: NodeJS.ProcessEnv;\n /** Tests: poll faster. */\n pollMs?: number;\n timeoutMs?: number;\n}\n\nconst isUrl = (s: string) => /^https?:\\/\\//i.test(s.trim());\n\n/** Renders a preset's setup step in the terminal (the console renders the same steps). */\nexport function renderStep(step: SetupStepView, n: number): string[] {\n const out = [pc.bold(`${n}. ${safeText(step.title, 120)}`)];\n for (const para of step.body.split(/\\n{2,}/)) out.push(` ${para.replace(/\\s*\\n\\s*/g, \" \").replace(/`([^`]+)`/g, (_m, c: string) => pc.cyan(c))}`);\n if (step.link) out.push(` ${step.link.label}: ${pc.cyan(step.link.url)}`);\n if (step.copy) out.push(` ${step.copy.label}: ${pc.cyan(step.copy.value)}`);\n return out;\n}\n\nasync function askInput(p: Prompter, input: NonNullable<SetupStepView[\"input\"]>): Promise<string> {\n for (;;) {\n const v = input.secret ? await p.secret(input.label) : await p.ask(input.label);\n if (!v) {\n p.print(pc.yellow(\" This is needed to continue.\"));\n continue;\n }\n if (input.pattern && !new RegExp(input.pattern).test(v)) {\n p.print(pc.yellow(` That doesn't look right${input.placeholder ? ` (it looks like ${input.placeholder})` : \"\"}.`));\n continue;\n }\n return v;\n }\n}\n\nasync function askSlug(p: Prompter, flag: string | undefined, def: string, taken: Set<string>): Promise<string> {\n if (flag) {\n if (!validSlug(flag)) throw new Error(`--slug \"${flag}\": use 1-24 lowercase letters, digits and dashes.`);\n if (taken.has(flag)) throw new Error(`There's already a connection \"${flag}\".`);\n return flag;\n }\n let suggestion = def;\n for (let n = 2; taken.has(suggestion); n++) suggestion = `${def.slice(0, 21)}-${n}`;\n for (;;) {\n const s = (await p.ask(\"Name it (agents see its tools as <name>__<tool>)\", suggestion)).toLowerCase();\n if (!validSlug(s)) p.print(pc.yellow(\" Use 1-24 lowercase letters, digits and dashes.\"));\n else if (taken.has(s)) p.print(pc.yellow(` There's already a connection \"${s}\".`));\n else return s;\n }\n}\n\n/** A slug from a URL: the host's first label that says something (mcp.notion.com → notion). */\nexport function slugFromUrl(url: URL): string {\n const labels = url.hostname.split(\".\").filter((l) => ![\"mcp\", \"api\", \"www\"].includes(l));\n const first = /^\\d/.test(url.hostname) || url.hostname.includes(\":\") ? `${url.hostname}-${url.port || \"mcp\"}` : (labels[0] ?? url.hostname);\n return slugify(first);\n}\n\nconst registrationWords: Record<string, string> = {\n preregistered: \"with a registered client\",\n metadata_document: \"registers itself automatically (client metadata document)\",\n dcr: \"registers itself automatically (dynamic client registration)\",\n manual: \"needs a client ID you get from the provider\",\n};\n\nconst overSsh = (env: NodeJS.ProcessEnv) => !!(env.SSH_CONNECTION || env.SSH_TTY || env.SSH_CLIENT);\nconst isLoopbackHost = (h: string) => h === \"localhost\" || h === \"127.0.0.1\" || h === \"[::1]\" || h === \"::1\";\n\n/** Where the provider sends the browser after consent: the authorize URL's redirect_uri. */\nfunction redirectOf(authorizeUrl: string): URL | null {\n try {\n const r = new URL(authorizeUrl).searchParams.get(\"redirect_uri\");\n return r ? new URL(r) : null;\n } catch {\n return null;\n }\n}\n\n/**\n * OAuth: open the browser and wait for the callback, or paste the address the browser lands on: over SSH when the\n * redirect goes to localhost (the browser isn't on this machine), and always for an https://localhost redirect\n * (providers that refuse http, where nothing listens).\n */\nexport async function authorize(\n conn: ConnectionView,\n start: { authorizeUrl: string; callbackMode?: \"direct\" | \"paste\"; redirectUri?: string },\n deps: ManageDeps,\n flags: { paste?: boolean } = {},\n): Promise<ConnectionView> {\n const { api, prompter: p } = deps;\n const env = deps.env ?? process.env;\n const authorizeUrl = start.authorizeUrl;\n const redirect = (() => {\n try {\n return start.redirectUri ? new URL(start.redirectUri) : redirectOf(authorizeUrl);\n } catch {\n return redirectOf(authorizeUrl);\n }\n })();\n const loopback = !!redirect && isLoopbackHost(redirect.hostname);\n const paste = !!flags.paste || start.callbackMode === \"paste\" || (loopback && (overSsh(env) || redirect!.protocol === \"https:\"));\n const name = safeText(conn.name, 60);\n if (paste) {\n p.print(`Open this link in a browser where you can sign in to ${name}:`);\n p.print(` ${pc.cyan(authorizeUrl)}`);\n const start = redirect ? `${redirect.origin}${redirect.pathname}` : \"the callback address\";\n p.print(pc.dim(`After you approve, the browser goes to an address starting with ${start} (it may say the page can't be reached). Copy that whole address.`));\n for (;;) {\n const pasted = await p.ask(\"Paste the address here\");\n if (!/[?&](code|error)=/.test(pasted)) {\n p.print(pc.yellow(` That isn't the address after signing in: it starts with ${start} and has ?code=… in it.`));\n continue;\n }\n const r = await api.finish(pasted.trim());\n if (r.status === \"connected\") return r.connection;\n throw new Error(r.status === \"error\" ? r.message : \"The sign-in didn't finish.\");\n }\n }\n // A sign-in that completes saves a new credential: its fingerprint changes even on an already-active\n // connection (a Reconnect), where status and updated_at can't tell.\n const stamp = () => api.channel.credentialStamp(conn.id);\n const before = stamp();\n const beforeView = await api.get(conn.id);\n p.print(`Opening your browser to sign in to ${name}. If it doesn't open, use this link:`);\n p.print(` ${pc.cyan(authorizeUrl)}`);\n try {\n await (deps.openBrowser ?? (async (u: string) => (await import(\"open\")).default(u)))(authorizeUrl);\n } catch {\n // The link is printed.\n }\n const pollMs = deps.pollMs ?? 2000;\n const deadline = Date.now() + (deps.timeoutMs ?? 15 * 60_000);\n p.print(pc.dim(\"Waiting for you to approve in the browser… (Ctrl+C to stop)\"));\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, pollMs));\n const now = await api.get(conn.id);\n const after = stamp();\n const changed = after !== null ? after !== before : now.expiresAt !== beforeView.expiresAt || now.updatedAt !== beforeView.updatedAt;\n // The sign-in page itself shows any error.\n if (now.status === \"active\" && changed) return now;\n }\n throw new Error(`Timed out waiting for the sign-in. Try again with \\`${NPX} connections reconnect ${conn.slug}\\`${overSsh(env) ? \"\" : \" (add --paste to paste the address instead)\"}.`);\n}\n\n/** Working = active with at least one tool listed: a \"connected\" answer alone isn't proof (a header isn't tested). */\nexport const isWorking = (c: ConnectionView) => c.status === \"active\" && c.tools.total > 0;\n\n/**\n * Waits briefly for a just-connected connection's first tool sync: until it works, turns needs_reauth / error /\n * disabled, or `ms` pass. Returns the last view.\n */\nexport async function waitWorking(api: ConnectionsApi, c: ConnectionView, opts: { pollMs?: number; ms?: number } = {}): Promise<ConnectionView> {\n let now = c;\n const deadline = Date.now() + (opts.ms ?? 10_000);\n while (!isWorking(now) && now.status === \"active\" && Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, opts.pollMs ?? 500));\n now = await api.get(c.id);\n }\n return now;\n}\n\n/** Connects (header, setup inputs, or OAuth) and returns the connection as it ends up. */\nexport async function connectNow(conn: ConnectionView, input: StartConnectInput, deps: ManageDeps, flags: { paste?: boolean } = {}): Promise<ConnectionView> {\n const r = await deps.api.connect(conn.id, input);\n if (r.status === \"connected\") return waitWorking(deps.api, r.connection, { pollMs: deps.pollMs, ms: deps.timeoutMs === undefined ? undefined : Math.min(deps.timeoutMs, 10_000) });\n // A finished sign-in is the start, not proof: wait for the first tool sync, as for a header.\n if (r.status === \"authorize\") return waitWorking(deps.api, await authorize(conn, r, deps, flags), { pollMs: deps.pollMs, ms: deps.timeoutMs === undefined ? undefined : Math.min(deps.timeoutMs, 10_000) });\n throw new Error(r.message);\n}\n\nfunction printResult(p: Prompter, c: ConnectionView): void {\n if (isWorking(c)) {\n p.print(`${pc.green(\"✔\")} Connected \"${c.slug}\": ${c.tools.total} tool${c.tools.total === 1 ? \"\" : \"s\"}, seen by agents as ${c.slug}__<tool> (${accessLabel(c.levelDefault)}).`);\n } else {\n p.print(`${pc.yellow(\"○\")} \"${c.slug}\" isn't working yet: ${c.status}${c.statusReason ? ` (${safeText(c.statusReason, 200)})` : \"\"}, ${c.tools.total} tools.`);\n p.print(` ${reconnectHint(c)}`);\n }\n}\n\ninterface Pending {\n slug: string;\n /** Only when the user gave one (--name): otherwise the server's default, which never collides. */\n name?: string;\n preset?: string;\n url?: string;\n}\n\n/** The access question, the agents, then create; `after` runs on the new connection (allow, connect). */\nasync function createThen(base: Pending, flags: AddFlags, deps: ManageDeps, after: (c: ConnectionView) => Promise<ConnectionView>): Promise<number> {\n const { api, prompter: p } = deps;\n const level = await chooseAccess(p, flags.access ? parseAccess(flags.access) : undefined);\n const agents = await chooseAgents(p, api, flags.agent);\n if (!(await p.confirm(`Add \"${base.slug}\" (${accessLabel(level)}, ${agentsLabel(agents)})?`, true))) {\n p.print(\"Nothing was added.\");\n return 0;\n }\n const created = await api.create({ ...base, levelDefault: level, ...(agents === \"all\" ? {} : { agentIds: agents }) });\n let conn: ConnectionView;\n try {\n conn = await after(created);\n } catch (err) {\n p.print(pc.yellow(`\"${created.slug}\" was added but isn't connected: ${safeText(err instanceof Error ? err.message : String(err), 300)}`));\n p.print(` ${reconnectHint(created)} (or remove it: ${NPX} connections remove ${created.slug})`);\n return 1;\n }\n printResult(p, conn);\n return isWorking(conn) ? 0 : 1;\n}\n\nasync function addPreset(preset: PresetView, flags: AddFlags, deps: ManageDeps, taken: Set<string>): Promise<number> {\n const p = deps.prompter;\n p.print(pc.bold(`Connect ${safeText(preset.displayName, 60)}`));\n preset.setupSteps.forEach((step, i) => {\n for (const l of renderStep(step, i + 1)) p.print(l);\n });\n const inputs: Record<string, string> = {};\n for (const step of preset.setupSteps) if (step.input) inputs[step.input.key] = await askInput(p, step.input);\n let header: StartConnectInput[\"header\"];\n if (preset.authType === \"header\") {\n const name = flags.header ?? \"Authorization\";\n header = { name, value: await askInput(p, { key: \"header\", label: `${name} value (not shown)`, secret: true }) };\n }\n const slug = await askSlug(p, flags.slug, preset.slug, taken);\n const input: StartConnectInput = { ...(header ? { header } : {}), ...(Object.keys(inputs).length ? { inputs } : {}) };\n return createThen({ slug, ...(flags.name ? { name: flags.name } : {}), preset: preset.id }, flags, deps, (c) => connectNow(c, input, deps, flags));\n}\n\nasync function headerFor(p: Prompter, flags: { header?: string }): Promise<NonNullable<StartConnectInput[\"header\"]>> {\n const name = flags.header ?? (await p.ask(\"Header name\", \"Authorization\"));\n const value = await askInput(p, { key: \"header\", label: `${name} value (not shown)`, secret: true });\n return { name, value: /^authorization$/i.test(name) && !/\\s/.test(value) ? `Bearer ${value}` : value };\n}\n\nfunction describeProbe(p: Prompter, probe: ConnectionProbe): void {\n if (probe.auth === \"oauth\") {\n p.print(`It signs in with OAuth${probe.issuer ? ` via ${safeText(probe.issuer, 120)}` : \"\"}${probe.registration ? `, and ${registrationWords[probe.registration] ?? probe.registration}` : \"\"}.`);\n } else if (probe.auth === \"header\") p.print(`It needs an API key or token. ${safeText(probe.message, 200)}`);\n else if (probe.auth === \"none\") p.print(\"It doesn't need a sign-in.\");\n else p.print(safeText(probe.message, 200));\n}\n\nconst MANUAL_CLIENT = \"It needs a client ID from the provider; finish it in the console's Connections page.\";\n\n/** `preset`: an integration whose server you name (t3code): its steps first, then the same check as a custom URL. */\nasync function addUrl(raw: string, flags: AddFlags, deps: ManageDeps, taken: Set<string>, preset: PresetView | null = null): Promise<number> {\n const { api, prompter: p } = deps;\n let url: URL;\n try {\n url = new URL(preset?.userServer ? presetServerUrl(raw, preset.userServer.defaultPath) : raw.trim());\n } catch {\n throw new Error(`\"${raw}\" isn't a URL. Use the server's full MCP address, e.g. https://mcp.example.com/mcp.`);\n }\n if (preset) {\n p.print(pc.bold(`Connect ${safeText(preset.displayName, 60)}`));\n preset.setupSteps.forEach((step, i) => {\n for (const l of renderStep(step, i + 1)) p.print(l);\n });\n }\n p.print(`Checking ${pc.cyan(url.href)}…`);\n const probe = await api.probe(url.href);\n let allowPrivate = false;\n let header: StartConnectInput[\"header\"];\n if (probe.blocked === \"private_target\") {\n const origin = exactOrigin(url);\n p.print(pc.yellow(`${url.host} is on this machine or your private network.`));\n p.print(\n \"xaq blocks those by default: a connection to a server there can reach other services on the same machine or network. \" +\n `An allow covers exactly ${origin}, for this connection only (and plain http on that host).`,\n );\n const allowed = flags.allowPrivate === origin || (await p.confirmExplicit(`Allow this connection to reach ${origin}?`, `nothing was added (pass --allow-private ${origin} to allow it)`));\n if (!allowed) {\n p.print(\"Nothing was added.\");\n return 0;\n }\n // Probed again once the connection (and its allow) exists.\n allowPrivate = true;\n } else if (probe.blocked || !probe.reachable) throw new Error(probe.message);\n else {\n describeProbe(p, probe);\n if (probe.auth === \"oauth\" && probe.registration === \"manual\") throw new Error(MANUAL_CLIENT);\n if (probe.auth === \"header\") header = await headerFor(p, flags);\n }\n if (preset && !allowPrivate && probe.auth !== \"oauth\") throw new Error(`${url.host} doesn't look like a ${preset.displayName} server: it doesn't ask for a sign-in.`);\n const slug = await askSlug(p, flags.slug, preset ? presetServerSlug(preset.slug, url.href) : slugFromUrl(url), taken);\n const base: Pending = { slug, ...(flags.name ? { name: flags.name } : {}), ...(preset ? { preset: preset.id } : {}), url: url.href };\n return createThen(base, flags, deps, async (c) => {\n if (allowPrivate) {\n await api.allowPrivateTarget(c.id, true);\n const again = await api.probe(url.href, c.id);\n if (again.blocked || !again.reachable) throw new Error(again.message);\n if (preset && again.auth !== \"oauth\") throw new Error(`${url.host} doesn't look like a ${preset.displayName} server: it doesn't ask for a sign-in.`);\n describeProbe(p, again);\n if (again.auth === \"oauth\" && again.registration === \"manual\") throw new Error(MANUAL_CLIENT);\n if (again.auth === \"header\") header = await headerFor(p, flags);\n }\n return connectNow(c, header ? { header } : {}, deps, flags);\n });\n}\n\nexport async function addConnection(target: string, flags: AddFlags, deps: ManageDeps): Promise<number> {\n const existing = await deps.api.list();\n const taken = new Set(existing.map((c) => c.slug));\n // A name you chose that's taken fails now, before any question (names are unique per owner, case-insensitive).\n if (flags.name !== undefined) {\n const name = flags.name.trim();\n if (!name) throw new Error(\"--name can't be empty.\");\n const clash = existing.find((c) => c.name.toLowerCase() === name.toLowerCase());\n if (clash) throw new Error(`You already have a connection named \"${safeText(clash.name, 100)}\" (\"${clash.slug}\"). Pick another --name, or leave it out.`);\n flags = { ...flags, name };\n }\n if (isUrl(target)) return addUrl(target, flags, deps, taken);\n const presets = await deps.api.presets();\n const preset = presets.find((x) => x.id === target.trim().toLowerCase());\n if (!preset) throw new Error(`Unknown integration \"${target}\". Use ${[...presets.map((x) => x.id), \"<an MCP server URL>\"].join(\", \")}.`);\n if (preset.userServer) {\n const raw = flags.url ?? (await deps.prompter.ask(`Address of your ${preset.displayName} server (e.g. http://100.101.102.103:3773)`));\n return addUrl(raw, flags, deps, taken, preset);\n }\n return addPreset(preset, flags, deps, taken);\n}\n\nexport async function listConnections(deps: ManageDeps): Promise<number> {\n const { api, prompter: p } = deps;\n const all = await api.list();\n if (!all.length) {\n p.print(`No connections yet. Add one: ${NPX} connections add notion|whoop|<url>`);\n return 0;\n }\n const w = Math.max(4, ...all.map((c) => c.slug.length));\n p.print(pc.dim(`${\"NAME\".padEnd(w)} ${\"STATUS\".padEnd(12)} ${\"ACCESS\".padEnd(24)} ${\"TOOLS\".padEnd(5)} URL`));\n for (const c of all) {\n const status = c.status === \"active\" ? pc.green(c.status.padEnd(12)) : pc.yellow(c.status.padEnd(12));\n const notes: string[] = [];\n if (c.privateTarget) notes.push(\"private network\");\n const d = c.expiresInDays;\n if (d !== null && d <= 7) notes.push(d <= 0 ? \"expires today: Reconnect\" : `expires in ${d} day${d === 1 ? \"\" : \"s\"}`);\n if (c.status === \"needs_reauth\") notes.push(\"Reconnect\");\n p.print(\n `${c.slug.padEnd(w)} ${status} ${accessLabel(c.levelDefault).padEnd(24)} ${String(c.tools.total).padEnd(5)} ${safeText(c.url ?? c.kind, 80)}${notes.length ? pc.yellow(` (${notes.join(\", \")})`) : \"\"}`,\n );\n }\n return 0;\n}\n\nexport async function reconnectConnection(slug: string, flags: { paste?: boolean; header?: string }, deps: ManageDeps): Promise<number> {\n const { api, prompter: p } = deps;\n const c = await api.bySlug(slug);\n const after = await connectNow(c, c.authType === \"header\" ? { header: await headerFor(p, flags) } : {}, deps, flags);\n printResult(p, after);\n return isWorking(after) ? 0 : 1;\n}\n\nexport async function disableConnection(slug: string, deps: ManageDeps): Promise<number> {\n const { api, prompter: p } = deps;\n const c = await api.bySlug(slug);\n if (!(await p.confirm(`Disable \"${slug}\"? Agents lose its tools at once, its pending approvals are cancelled and its stored credentials are deleted.`, false))) return 0;\n await api.kill(c.id);\n p.print(`${pc.green(\"✔\")} Disabled \"${slug}\". To use it again, turn it on in the console's Connections page and reconnect.`);\n return 0;\n}\n\nexport async function removeConnection(slug: string, deps: ManageDeps): Promise<number> {\n const { api, prompter: p } = deps;\n const c = await api.bySlug(slug);\n if (!(await p.confirm(`Remove \"${slug}\" and delete its stored credentials? This can't be undone.`, false))) return 0;\n await api.remove(c.id);\n p.print(`${pc.green(\"✔\")} Removed \"${slug}\".`);\n return 0;\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,gBAAwE;CACnF;EAAE,OAAO;EAAQ,OAAO;EAAuC,OAAO;CAAc;CACpF;EAAE,OAAO;EAAO,OAAO;EAA+F,OAAO;CAA2B;CACxJ;EAAE,OAAO;EAAQ,OAAO;EAA2D,OAAO;CAAY;AACxG;AAEA,MAAa,eAAe,UAAuB,cAAc,MAAM,MAAM,EAAE,UAAU,KAAK,CAAC,EAAE,SAAS;AAE1G,SAAgB,YAAY,OAA4B;CACtD,MAAM,IAAI,MAAM,KAAK,CAAC,CAAC,YAAY;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M,KAAK,IAAI,EAAE,EAAE,IAAI,IAC1M;CACF;CACA,OAAO;AACT;AAEA,eAAsB,oBAAoB,MAAc,OAA6C,MAAmC;CACtI,MAAM,EAAE,KAAK,UAAU,MAAM;CAC7B,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI;CAC/B,MAAM,QAAQ,MAAM,WAAW,GAAG,EAAE,aAAa,WAAW,EAAE,QAAQ,MAAM,UAAU,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,MAAM,KAAK;CACnH,YAAY,GAAG,KAAK;CACpB,OAAO,UAAU,KAAK,IAAI,IAAI;AAChC;AAEA,eAAsB,kBAAkB,MAAc,MAAmC;CACvF,MAAM,EAAE,KAAK,UAAU,MAAM;CAC7B,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI;CAC/B,IAAI,CAAE,MAAM,EAAE,QAAQ,YAAY,KAAK,gHAAgH,KAAK,GAAI,OAAO;CACvK,MAAM,IAAI,KAAK,EAAE,EAAE;CACnB,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,EAAE,aAAa,KAAK,gFAAgF;CAC3H,OAAO;AACT;AAEA,eAAsB,iBAAiB,MAAc,MAAmC;CACtF,MAAM,EAAE,KAAK,UAAU,MAAM;CAC7B,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI;CAC/B,IAAI,CAAE,MAAM,EAAE,QAAQ,WAAW,KAAK,6DAA6D,KAAK,GAAI,OAAO;CACnH,MAAM,IAAI,OAAO,EAAE,EAAE;CACrB,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,EAAE,YAAY,KAAK,GAAG;CAC7C,OAAO;AACT"}
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export { t as addConnection, i as disableConnection, o as listConnections, s as reconnectConnection, c as removeConnection } from "./manage-BlGiqPRV.js";
2
+ export { t as addConnection, i as disableConnection, o as listConnections, s as reconnectConnection, c as removeConnection } from "./manage-D3eTpw6R.js";