@redocly/theme 0.69.0-next.0 → 0.69.0-next.2

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 (61) hide show
  1. package/lib/components/Buttons/ConnectMCPButton.js +43 -14
  2. package/lib/components/MCP/McpConnectionTabs.d.ts +7 -0
  3. package/lib/components/MCP/McpConnectionTabs.js +151 -0
  4. package/lib/components/Markdown/Markdown.js +1 -1
  5. package/lib/core/constants/accordion.d.ts +3 -0
  6. package/lib/core/constants/accordion.js +7 -0
  7. package/lib/core/constants/index.d.ts +1 -0
  8. package/lib/core/constants/index.js +1 -0
  9. package/lib/core/constants/mcp.d.ts +2 -0
  10. package/lib/core/constants/mcp.js +8 -1
  11. package/lib/core/hooks/use-active-section-id.js +3 -1
  12. package/lib/core/hooks/use-connect-mcp-button.d.ts +1 -1
  13. package/lib/core/hooks/use-connect-mcp-button.js +16 -13
  14. package/lib/core/styles/global.js +46 -39
  15. package/lib/core/types/catalog.d.ts +2 -0
  16. package/lib/core/types/l10n.d.ts +1 -1
  17. package/lib/core/types/mcp.d.ts +1 -1
  18. package/lib/core/utils/mcp.d.ts +5 -0
  19. package/lib/core/utils/mcp.js +35 -0
  20. package/lib/icons/CodexIcon/CodexIcon.d.ts +25 -0
  21. package/lib/icons/CodexIcon/CodexIcon.js +22 -0
  22. package/lib/layouts/McpNotAllowed.js +5 -3
  23. package/lib/markdoc/components/Accordion/Accordion.d.ts +9 -0
  24. package/lib/markdoc/components/Accordion/Accordion.js +132 -0
  25. package/lib/markdoc/components/Accordion/AccordionGroup.d.ts +5 -0
  26. package/lib/markdoc/components/Accordion/AccordionGroup.js +29 -0
  27. package/lib/markdoc/components/Accordion/variables.d.ts +1 -0
  28. package/lib/markdoc/components/Accordion/variables.js +40 -0
  29. package/lib/markdoc/components/default.d.ts +2 -0
  30. package/lib/markdoc/components/default.js +2 -0
  31. package/lib/markdoc/default.d.ts +4 -0
  32. package/lib/markdoc/default.js +4 -0
  33. package/lib/markdoc/tags/accordion-group.d.ts +2 -0
  34. package/lib/markdoc/tags/accordion-group.js +10 -0
  35. package/lib/markdoc/tags/accordion.d.ts +2 -0
  36. package/lib/markdoc/tags/accordion.js +14 -0
  37. package/lib/markdoc/tags/connect-mcp.js +2 -1
  38. package/package.json +2 -2
  39. package/src/components/Buttons/ConnectMCPButton.tsx +44 -14
  40. package/src/components/MCP/McpConnectionTabs.tsx +263 -0
  41. package/src/components/Markdown/Markdown.tsx +2 -1
  42. package/src/core/constants/accordion.ts +4 -0
  43. package/src/core/constants/index.ts +1 -0
  44. package/src/core/constants/mcp.ts +10 -0
  45. package/src/core/hooks/use-active-section-id.ts +3 -1
  46. package/src/core/hooks/use-connect-mcp-button.ts +23 -15
  47. package/src/core/styles/global.ts +8 -1
  48. package/src/core/types/catalog.ts +3 -0
  49. package/src/core/types/l10n.ts +17 -0
  50. package/src/core/types/mcp.ts +1 -1
  51. package/src/core/utils/mcp.ts +39 -0
  52. package/src/icons/CodexIcon/CodexIcon.tsx +23 -0
  53. package/src/layouts/McpNotAllowed.tsx +4 -2
  54. package/src/markdoc/components/Accordion/Accordion.tsx +128 -0
  55. package/src/markdoc/components/Accordion/AccordionGroup.tsx +41 -0
  56. package/src/markdoc/components/Accordion/variables.ts +37 -0
  57. package/src/markdoc/components/default.ts +2 -0
  58. package/src/markdoc/default.ts +4 -0
  59. package/src/markdoc/tags/accordion-group.ts +8 -0
  60. package/src/markdoc/tags/accordion.ts +12 -0
  61. package/src/markdoc/tags/connect-mcp.ts +3 -1
@@ -44,11 +44,14 @@ const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem")
44
44
  const Button_1 = require("../../components/Button/Button");
45
45
  const CursorIcon_1 = require("../../icons/CursorIcon/CursorIcon");
46
46
  const VSCodeIcon_1 = require("../../icons/VSCodeIcon/VSCodeIcon");
47
+ const ClaudeIcon_1 = require("../../icons/ClaudeIcon/ClaudeIcon");
48
+ const CodexIcon_1 = require("../../icons/CodexIcon/CodexIcon");
47
49
  const CopyIcon_1 = require("../../icons/CopyIcon/CopyIcon");
48
50
  const CheckmarkFilledIcon_1 = require("../../icons/CheckmarkFilledIcon/CheckmarkFilledIcon");
49
51
  const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
50
52
  const ChevronUpIcon_1 = require("../../icons/ChevronUpIcon/ChevronUpIcon");
51
53
  const hooks_1 = require("../../core/hooks");
54
+ const constants_1 = require("../../core/constants");
52
55
  const MENU_OPTIONS = [
53
56
  {
54
57
  key: 'cursor',
@@ -66,6 +69,22 @@ const MENU_OPTIONS = [
66
69
  descriptionTranslationKey: 'page.actions.connectMcp.vscodeDescription',
67
70
  descriptionDefault: 'Install MCP server on VS Code',
68
71
  },
72
+ {
73
+ key: 'claude-code',
74
+ icon: ClaudeIcon_1.ClaudeIcon,
75
+ titleTranslationKey: 'page.actions.connectMcp.claudeCode',
76
+ titleDefault: 'Connect to Claude Code',
77
+ descriptionTranslationKey: 'page.actions.connectMcp.claudeCodeDescription',
78
+ descriptionDefault: 'Copy the Claude Code CLI command',
79
+ },
80
+ {
81
+ key: 'codex',
82
+ icon: CodexIcon_1.CodexIcon,
83
+ titleTranslationKey: 'page.actions.connectMcp.codex',
84
+ titleDefault: 'Connect to Codex CLI',
85
+ descriptionTranslationKey: 'page.actions.connectMcp.codexDescription',
86
+ descriptionDefault: 'Copy the Codex CLI command',
87
+ },
69
88
  {
70
89
  key: 'copy',
71
90
  icon: CopyIcon_1.CopyIcon,
@@ -75,12 +94,14 @@ const MENU_OPTIONS = [
75
94
  descriptionDefault: 'Copy MCP JSON Configuration',
76
95
  },
77
96
  ];
78
- function ConnectMCPButton({ placement = 'bottom', alignment = 'end', options = ['cursor', 'vscode', 'copy'], }) {
97
+ // Copy actions keep the dropdown open so the copied checkmark is visible.
98
+ const COPY_OPTIONS = ['claude-code', 'codex', 'copy'];
99
+ function ConnectMCPButton({ placement = 'bottom', alignment = 'end', options = constants_1.DEFAULT_MCP_OPTIONS, }) {
79
100
  const { useTranslate } = (0, hooks_1.useThemeHooks)();
80
101
  const { translate } = useTranslate();
81
102
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
82
103
  const wrapperRef = (0, react_1.useRef)(null);
83
- const { isCopied, visibleOptions, handleAction } = (0, hooks_1.useConnectMCPButton)({ options });
104
+ const { copiedOption, visibleOptions, handleAction } = (0, hooks_1.useConnectMCPButton)({ options });
84
105
  (0, hooks_1.useOutsideClick)(wrapperRef, () => setIsOpen(false));
85
106
  const menuOptions = MENU_OPTIONS.filter((option) => visibleOptions.includes(option.key));
86
107
  const primaryOption = menuOptions[0];
@@ -88,12 +109,12 @@ function ConnectMCPButton({ placement = 'bottom', alignment = 'end', options = [
88
109
  if (!primaryOption)
89
110
  return null;
90
111
  const PrimaryIcon = primaryOption.icon;
91
- // When copy is the primary action there is no dropdown item to show the copied state, so the
92
- // primary button itself must reflect it.
93
- const showPrimaryCopied = primaryOption.key === 'copy' && isCopied;
112
+ const showPrimaryCopied = copiedOption === primaryOption.key;
94
113
  const handleMenuAction = (key) => {
95
114
  handleAction(key);
96
- setIsOpen(false);
115
+ if (!COPY_OPTIONS.includes(key)) {
116
+ setIsOpen(false);
117
+ }
97
118
  };
98
119
  return (react_1.default.createElement(ConnectMCPButtonWrapper, { ref: wrapperRef, "data-component-name": "Buttons/ConnectMCPButton" },
99
120
  react_1.default.createElement(SplitButtonGroup, null,
@@ -102,7 +123,7 @@ function ConnectMCPButton({ placement = 'bottom', alignment = 'end', options = [
102
123
  isOpen && dropdownOptions.length > 0 && (react_1.default.createElement(DropdownWrapper, { $placement: placement, $alignment: alignment },
103
124
  react_1.default.createElement(DropdownMenu_1.DropdownMenu, null, dropdownOptions.map((option) => {
104
125
  const Icon = option.icon;
105
- const showCheckmark = option.key === 'copy' && isCopied;
126
+ const showCheckmark = copiedOption === option.key;
106
127
  return (react_1.default.createElement(DropdownMenuItem_1.DropdownMenuItem, { key: option.key, onAction: () => handleMenuAction(option.key) },
107
128
  react_1.default.createElement(MenuItemContent, null,
108
129
  react_1.default.createElement(MenuItemIcon, null, showCheckmark ? (react_1.default.createElement(CheckmarkFilledIcon_1.CheckmarkFilledIcon, { color: "var(--color-success-base)" })) : (react_1.default.createElement(Icon, null))),
@@ -119,16 +140,24 @@ const SplitButtonGroup = styled_components_1.default.div `
119
140
  display: inline-flex;
120
141
  align-items: stretch;
121
142
  `;
143
+ /* Doubled selectors outrank the base button class in any style injection order,
144
+ and margin: 0 keeps themed button margins from splitting the group apart. */
122
145
  const PrimaryButton = (0, styled_components_1.default)(Button_1.Button) `
123
- --button-gap: var(--connect-mcp-button-gap);
124
- border-top-right-radius: 0;
125
- border-bottom-right-radius: 0;
146
+ && {
147
+ --button-gap: var(--connect-mcp-button-gap);
148
+ margin: 0;
149
+ border-top-right-radius: 0;
150
+ border-bottom-right-radius: 0;
151
+ }
126
152
  `;
127
153
  const ChevronButton = (0, styled_components_1.default)(Button_1.Button) `
128
- border-top-left-radius: 0;
129
- border-bottom-left-radius: 0;
130
- border-left: none;
131
- padding-inline: var(--connect-mcp-button-chevron-padding-inline);
154
+ && {
155
+ margin: 0;
156
+ border-top-left-radius: 0;
157
+ border-bottom-left-radius: 0;
158
+ border-left: none;
159
+ padding-inline: var(--connect-mcp-button-chevron-padding-inline);
160
+ }
132
161
  `;
133
162
  const DropdownWrapper = styled_components_1.default.div `
134
163
  position: absolute;
@@ -0,0 +1,7 @@
1
+ import type { JSX } from 'react';
2
+ export type McpConnectionTab = 'claude' | 'chatgpt' | 'json';
3
+ export type McpConnectionTabsProps = {
4
+ options?: McpConnectionTab[];
5
+ className?: string;
6
+ };
7
+ export declare function McpConnectionTabs({ options, className, }: McpConnectionTabsProps): JSX.Element | null;
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.McpConnectionTabs = McpConnectionTabs;
40
+ const react_1 = __importStar(require("react"));
41
+ const styled_components_1 = __importDefault(require("styled-components"));
42
+ const hooks_1 = require("../../core/hooks");
43
+ const utils_1 = require("../../core/utils");
44
+ const CodeBlock_1 = require("../../components/CodeBlock/CodeBlock");
45
+ const ClaudeIcon_1 = require("../../icons/ClaudeIcon/ClaudeIcon");
46
+ const ChatGptIcon_1 = require("../../icons/ChatGptIcon/ChatGptIcon");
47
+ const Tabs_1 = require("../../markdoc/components/Tabs/Tabs");
48
+ const TabItemFragment_1 = require("../../markdoc/components/Tabs/TabItemFragment");
49
+ const NumberedList_1 = require("../../markdoc/components/NumberedList/NumberedList");
50
+ const NumberedItem_1 = require("../../markdoc/components/NumberedList/NumberedItem");
51
+ const DEFAULT_TAB_OPTIONS = ['claude', 'chatgpt', 'json'];
52
+ const TAB_LABELS = {
53
+ claude: {
54
+ translationKey: 'page.mcpNotAllowed.tabs.claude',
55
+ defaultLabel: 'Claude',
56
+ icon: ClaudeIcon_1.ClaudeIcon,
57
+ },
58
+ chatgpt: {
59
+ translationKey: 'page.mcpNotAllowed.tabs.chatgpt',
60
+ defaultLabel: 'ChatGPT',
61
+ icon: ChatGptIcon_1.ChatGptIcon,
62
+ },
63
+ json: { translationKey: 'page.mcpNotAllowed.tabs.json', defaultLabel: 'JSON' },
64
+ };
65
+ // The report control is docs feedback, not useful on the connection page.
66
+ const CODE_BLOCK_HEADER = { controls: { copy: {}, report: { hidden: true } } };
67
+ function McpConnectionTabs({ options = DEFAULT_TAB_OPTIONS, className, }) {
68
+ const { useTranslate } = (0, hooks_1.useThemeHooks)();
69
+ const { translate } = useTranslate();
70
+ const { serverName, serverUrl, isMcpDisabled } = (0, hooks_1.useMCPConfig)();
71
+ // The SSR markup of error pages is cached with the build-time origin, so the
72
+ // tabs remount after hydration to pick up the real browser origin.
73
+ const [hydrated, setHydrated] = (0, react_1.useState)(false);
74
+ (0, react_1.useEffect)(() => setHydrated(true), []);
75
+ if (isMcpDisabled) {
76
+ return null;
77
+ }
78
+ const connection = { serverName, url: serverUrl };
79
+ return (react_1.default.createElement(McpConnectionTabsWrapper, { key: hydrated ? 'client' : 'ssr', "data-component-name": "MCP/McpConnectionTabs", "data-testid": "mcp-connection-tabs", className: className },
80
+ react_1.default.createElement(Tabs_1.Tabs, { size: Tabs_1.TabsSize.SMALL }, options.map((option) => {
81
+ const { translationKey, defaultLabel, icon: TabIcon } = TAB_LABELS[option];
82
+ return (react_1.default.createElement(TabItemFragment_1.TabItemFragment, { key: option, label: translate(translationKey, defaultLabel), icon: TabIcon ? react_1.default.createElement(TabIcon, null) : undefined }, renderTabContent(option, connection, translate)));
83
+ }))));
84
+ }
85
+ function renderTabContent(option, connection, translate) {
86
+ const terminalHint = (react_1.default.createElement(TabHint, null, translate('page.mcpNotAllowed.snippets.terminal.hint', 'Run this command in your terminal:')));
87
+ const urlBlock = react_1.default.createElement(CodeBlock_1.CodeBlock, { lang: "text", source: connection.url, header: CODE_BLOCK_HEADER });
88
+ const assistantPromptClient = {
89
+ headline: translate('page.mcpNotAllowed.snippets.prompt.headline', 'Prompt'),
90
+ content: (react_1.default.createElement(react_1.default.Fragment, null,
91
+ react_1.default.createElement(TabHint, null, translate('page.mcpNotAllowed.snippets.prompt.hint', 'Or paste this prompt into the chat to have it add the server for you:')),
92
+ react_1.default.createElement(CodeBlock_1.CodeBlock, { lang: "text", source: (0, utils_1.generateMcpInstallPrompt)(connection), header: CODE_BLOCK_HEADER, wrapContents: true }))),
93
+ };
94
+ switch (option) {
95
+ case 'claude':
96
+ return renderClientList([
97
+ {
98
+ headline: translate('page.mcpNotAllowed.snippets.claudeCode.headline', 'Claude Code'),
99
+ content: (react_1.default.createElement(react_1.default.Fragment, null,
100
+ terminalHint,
101
+ react_1.default.createElement(CodeBlock_1.CodeBlock, { lang: "shell", source: (0, utils_1.generateClaudeCodeCommand)(connection), header: CODE_BLOCK_HEADER, wrapContents: true }))),
102
+ },
103
+ {
104
+ headline: translate('page.mcpNotAllowed.snippets.claudeDesktop.headline', 'Claude Desktop'),
105
+ content: (react_1.default.createElement(react_1.default.Fragment, null,
106
+ react_1.default.createElement(TabHint, null, translate('page.mcpNotAllowed.snippets.claudeDesktop.instruction', 'In Claude Desktop, open Settings → Developer → Edit Config, add this to the configuration file, and restart Claude Desktop:')),
107
+ react_1.default.createElement(CodeBlock_1.CodeBlock, { lang: "json", source: (0, utils_1.generateClaudeDesktopConfig)(connection), header: CODE_BLOCK_HEADER }))),
108
+ },
109
+ ]);
110
+ case 'chatgpt':
111
+ return renderClientList([
112
+ {
113
+ headline: translate('page.mcpNotAllowed.snippets.codexCli.headline', 'Codex CLI'),
114
+ content: (react_1.default.createElement(react_1.default.Fragment, null,
115
+ terminalHint,
116
+ react_1.default.createElement(CodeBlock_1.CodeBlock, { lang: "shell", source: (0, utils_1.generateCodexCommand)(connection), header: CODE_BLOCK_HEADER, wrapContents: true }))),
117
+ },
118
+ {
119
+ headline: translate('page.mcpNotAllowed.snippets.chatgptApp.headline', 'ChatGPT desktop app'),
120
+ content: (react_1.default.createElement(react_1.default.Fragment, null,
121
+ react_1.default.createElement(TabHint, null, translate('page.mcpNotAllowed.snippets.chatgptApp.instruction', 'In the ChatGPT desktop app, go to Settings → Plugins → MCPs and add a server with the "Streamable HTTP" type and this URL (restart the app afterwards):')),
122
+ urlBlock)),
123
+ },
124
+ assistantPromptClient,
125
+ ]);
126
+ case 'json':
127
+ return (react_1.default.createElement(react_1.default.Fragment, null,
128
+ react_1.default.createElement(TabHint, null, translate('page.mcpNotAllowed.snippets.json.hint', 'Add this server entry to your MCP client configuration file:')),
129
+ react_1.default.createElement(CodeBlock_1.CodeBlock, { lang: "json", source: JSON.stringify({ [connection.serverName]: { url: connection.url, description: 'MCP Server' } }, null, 2), header: CODE_BLOCK_HEADER })));
130
+ }
131
+ }
132
+ function renderClientList(clients) {
133
+ return (react_1.default.createElement(NumberedList_1.NumberedList, null, clients.map((client, index) => (react_1.default.createElement(NumberedItem_1.NumberedItem, { key: index, type: "dot", size: "small", headline: client.headline, index: index + 1, isLast: index === clients.length - 1 }, client.content)))));
134
+ }
135
+ const McpConnectionTabsWrapper = styled_components_1.default.div `
136
+ --md-numbered-list-margin: 0 0 var(--spacing-sm);
137
+
138
+ font-size: var(--page-mcp-405-snippets-font-size);
139
+ line-height: var(--page-mcp-405-snippets-line-height);
140
+ text-align: left;
141
+
142
+ /* The copy control floats over the code, so wrapped lines need room to clear it. */
143
+ pre[data-testid='source-code'] {
144
+ padding-right: var(--page-mcp-405-snippets-code-padding-right);
145
+ }
146
+ `;
147
+ const TabHint = styled_components_1.default.p `
148
+ margin: 0 0 var(--spacing-xs);
149
+ color: var(--page-mcp-405-snippets-hint-text-color);
150
+ `;
151
+ //# sourceMappingURL=McpConnectionTabs.js.map
@@ -184,7 +184,7 @@ exports.Markdown = styled_components_1.default.main
184
184
  margin: var(--md-hr-margin-vertical) 0;
185
185
  }
186
186
 
187
- details {
187
+ details:not(${constants_1.ACCORDION_SELECTOR}) {
188
188
  margin: 1.125em 0;
189
189
 
190
190
  summary {
@@ -0,0 +1,3 @@
1
+ export declare const ACCORDION_COMPONENT_NAME = "Markdoc/Accordion/Accordion";
2
+ export declare const ACCORDION_GROUP_COMPONENT_NAME = "Markdoc/Accordion/AccordionGroup";
3
+ export declare const ACCORDION_SELECTOR = "[data-component-name='Markdoc/Accordion/Accordion']";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACCORDION_SELECTOR = exports.ACCORDION_GROUP_COMPONENT_NAME = exports.ACCORDION_COMPONENT_NAME = void 0;
4
+ exports.ACCORDION_COMPONENT_NAME = 'Markdoc/Accordion/Accordion';
5
+ exports.ACCORDION_GROUP_COMPONENT_NAME = 'Markdoc/Accordion/AccordionGroup';
6
+ exports.ACCORDION_SELECTOR = `[data-component-name='${exports.ACCORDION_COMPONENT_NAME}']`;
7
+ //# sourceMappingURL=accordion.js.map
@@ -1,3 +1,4 @@
1
+ export * from './accordion';
1
2
  export * from './common';
2
3
  export * from './environments';
3
4
  export * from './code-walkthrough';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./accordion"), exports);
17
18
  __exportStar(require("./common"), exports);
18
19
  __exportStar(require("./environments"), exports);
19
20
  __exportStar(require("./code-walkthrough"), exports);
@@ -1 +1,3 @@
1
+ import type { MCPOption } from '../types/mcp';
1
2
  export declare const DEFAULT_MCP_SERVER_NAME = "mcp-server";
3
+ export declare const DEFAULT_MCP_OPTIONS: MCPOption[];
@@ -1,5 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_MCP_SERVER_NAME = void 0;
3
+ exports.DEFAULT_MCP_OPTIONS = exports.DEFAULT_MCP_SERVER_NAME = void 0;
4
4
  exports.DEFAULT_MCP_SERVER_NAME = 'mcp-server';
5
+ exports.DEFAULT_MCP_OPTIONS = [
6
+ 'cursor',
7
+ 'vscode',
8
+ 'claude-code',
9
+ 'codex',
10
+ 'copy',
11
+ ];
5
12
  //# sourceMappingURL=mcp.js.map
@@ -45,10 +45,12 @@ function useActiveSectionId(location, hasOverviewPage = false, withNavbar = true
45
45
  return;
46
46
  }
47
47
  window.addEventListener('scroll', scrollListener, { capture: false });
48
- setTimeout(() => {
48
+ const initialRead = setTimeout(() => {
49
49
  scrollListener();
50
50
  }, 10);
51
51
  return () => {
52
+ clearTimeout(initialRead);
53
+ scrollListener.cancel();
52
54
  window.removeEventListener('scroll', scrollListener);
53
55
  };
54
56
  }, [location, heightOffset, scrollListener]);
@@ -3,7 +3,7 @@ export type McpButtonOptions = {
3
3
  options?: MCPOption[];
4
4
  };
5
5
  export type McpButtonSettings = {
6
- isCopied: boolean;
6
+ copiedOption: MCPOption | null;
7
7
  cursorUrl: string;
8
8
  vscodeUrl: string;
9
9
  triggerButtonText: string;
@@ -9,24 +9,27 @@ const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
9
9
  const use_theme_hooks_1 = require("./use-theme-hooks");
10
10
  const use_mcp_config_1 = require("./use-mcp-config");
11
11
  const clipboard_service_1 = require("../utils/clipboard-service");
12
+ const mcp_1 = require("../constants/mcp");
13
+ const mcp_2 = require("../utils/mcp");
12
14
  const COPIED_RESET_TIMEOUT = 1000;
13
- function useConnectMCPButton({ options = ['cursor', 'vscode', 'copy'], } = {}) {
15
+ function useConnectMCPButton({ options = mcp_1.DEFAULT_MCP_OPTIONS, } = {}) {
14
16
  const { useTranslate } = (0, use_theme_hooks_1.useThemeHooks)();
15
17
  const { translate } = useTranslate();
16
18
  const { serverName, serverUrl, cursorUrl, vscodeUrl } = (0, use_mcp_config_1.useMCPConfig)();
17
- const [isCopied, setIsCopied] = (0, react_1.useState)(false);
19
+ const [copiedOption, setCopiedOption] = (0, react_1.useState)(null);
18
20
  // eslint-disable-next-line react-hooks/exhaustive-deps
19
- const resetCopied = (0, react_1.useCallback)((0, lodash_debounce_1.default)(() => setIsCopied(false), COPIED_RESET_TIMEOUT), []);
21
+ const resetCopied = (0, react_1.useCallback)((0, lodash_debounce_1.default)(() => setCopiedOption(null), COPIED_RESET_TIMEOUT), []);
20
22
  const handleAction = (0, react_1.useCallback)((action) => {
21
- if (action === 'copy') {
22
- const config = {
23
- [serverName]: {
24
- url: serverUrl,
25
- description: 'MCP Server',
26
- },
27
- };
28
- clipboard_service_1.ClipboardService.copyCustom(JSON.stringify(config, null, 2));
29
- setIsCopied(true);
23
+ const connection = { serverName, url: serverUrl };
24
+ const copyTextMap = {
25
+ copy: JSON.stringify({ [serverName]: { url: serverUrl, description: 'MCP Server' } }, null, 2),
26
+ 'claude-code': (0, mcp_2.generateClaudeCodeCommand)(connection),
27
+ codex: (0, mcp_2.generateCodexCommand)(connection),
28
+ };
29
+ const copyText = copyTextMap[action];
30
+ if (copyText !== undefined) {
31
+ clipboard_service_1.ClipboardService.copyCustom(copyText);
32
+ setCopiedOption(action);
30
33
  resetCopied();
31
34
  return;
32
35
  }
@@ -39,7 +42,7 @@ function useConnectMCPButton({ options = ['cursor', 'vscode', 'copy'], } = {}) {
39
42
  const triggerButtonText = (0, react_1.useMemo)(() => translate('page.actions.connectMcp', 'Connect MCP'), [translate]);
40
43
  const visibleOptions = (0, react_1.useMemo)(() => options.filter(Boolean), [options]);
41
44
  return {
42
- isCopied,
45
+ copiedOption,
43
46
  cursorUrl,
44
47
  vscodeUrl,
45
48
  triggerButtonText,
@@ -30,25 +30,26 @@ const variables_25 = require("../../components/CodeBlock/variables");
30
30
  const variables_26 = require("../../components/Product/variables");
31
31
  const variables_27 = require("../../components/Markdown/variables");
32
32
  const variables_28 = require("../../components/Banner/variables");
33
- const variables_29 = require("../../markdoc/components/Tabs/variables");
34
- const variables_30 = require("../../markdoc/components/NumberedList/variables");
35
- const variables_31 = require("../../markdoc/components/Diagram/variables");
36
- const variables_32 = require("../../components/LastUpdated/variables");
37
- const variables_33 = require("../../components/Logo/variables");
38
- const variables_34 = require("../../components/StatusCode/variables");
39
- const variables_35 = require("../../components/Segmented/variables");
40
- const variables_36 = require("../../components/UserMenu/variables");
41
- const variables_37 = require("../../components/Tags/variables");
42
- const variables_38 = require("../../components/VersionPicker/variables");
43
- const variables_39 = require("../../components/DatePicker/variables");
44
- const variables_40 = require("../../components/Switch/variables");
45
- const variables_41 = require("../../markdoc/components/Cards/variables");
46
- const variables_42 = require("../../markdoc/components/CodeWalkthrough/variables");
47
- const variables_43 = require("../../components/SkipContent/variables");
48
- const variables_44 = require("../../components/PageActions/variables");
49
- const variables_45 = require("../../components/SvgViewer/variables");
50
- const variables_46 = require("../../components/Toast/variables");
51
- const variables_47 = require("../../components/PageNavigation/variables");
33
+ const variables_29 = require("../../markdoc/components/Accordion/variables");
34
+ const variables_30 = require("../../markdoc/components/Tabs/variables");
35
+ const variables_31 = require("../../markdoc/components/NumberedList/variables");
36
+ const variables_32 = require("../../markdoc/components/Diagram/variables");
37
+ const variables_33 = require("../../components/LastUpdated/variables");
38
+ const variables_34 = require("../../components/Logo/variables");
39
+ const variables_35 = require("../../components/StatusCode/variables");
40
+ const variables_36 = require("../../components/Segmented/variables");
41
+ const variables_37 = require("../../components/UserMenu/variables");
42
+ const variables_38 = require("../../components/Tags/variables");
43
+ const variables_39 = require("../../components/VersionPicker/variables");
44
+ const variables_40 = require("../../components/DatePicker/variables");
45
+ const variables_41 = require("../../components/Switch/variables");
46
+ const variables_42 = require("../../markdoc/components/Cards/variables");
47
+ const variables_43 = require("../../markdoc/components/CodeWalkthrough/variables");
48
+ const variables_44 = require("../../components/SkipContent/variables");
49
+ const variables_45 = require("../../components/PageActions/variables");
50
+ const variables_46 = require("../../components/SvgViewer/variables");
51
+ const variables_47 = require("../../components/Toast/variables");
52
+ const variables_48 = require("../../components/PageNavigation/variables");
52
53
  const palette_1 = require("./palette");
53
54
  const dark_1 = require("./dark");
54
55
  const themeColors = (0, styled_components_1.css) `
@@ -1036,8 +1037,8 @@ const pages = (0, styled_components_1.css) `
1036
1037
 
1037
1038
  --page-mcp-405-status-text-color: var(--text-color-helper);
1038
1039
  --page-mcp-405-status-font-size: var(--font-size-lg); // @presenter FontSize
1039
- --page-mcp-405-status-line-height: var(--line-height-lg); // @presenter LineHeight
1040
1040
  --page-mcp-405-status-font-weight: var(--font-weight-semibold); // @presenter FontWeight
1041
+ --page-mcp-405-status-line-height: var(--line-height-lg); // @presenter LineHeight
1041
1042
 
1042
1043
  --page-mcp-405-title-text-color: var(--text-color-primary);
1043
1044
  --page-mcp-405-title-font-size: 42px; // @presenter FontSize
@@ -1053,6 +1054,11 @@ const pages = (0, styled_components_1.css) `
1053
1054
  --page-mcp-405-description-font-size-mobile: var(--font-size-lg);
1054
1055
  --page-mcp-405-description-line-height-mobile: var(--line-height-lg);
1055
1056
 
1057
+ --page-mcp-405-snippets-font-size: var(--font-size-base); // @presenter FontSize
1058
+ --page-mcp-405-snippets-line-height: var(--line-height-base); // @presenter LineHeight
1059
+ --page-mcp-405-snippets-hint-text-color: var(--text-color-secondary);
1060
+ --page-mcp-405-snippets-code-padding-right: var(--spacing-xxl);
1061
+
1056
1062
  // @tokens End
1057
1063
 
1058
1064
  /**
@@ -1309,29 +1315,30 @@ exports.styles = (0, styled_components_1.css) `
1309
1315
  ${variables_20.button}
1310
1316
  ${variables_21.aiAssistantButton}
1311
1317
  ${variables_21.connectMCPButton}
1312
- ${variables_41.cards}
1318
+ ${variables_42.cards}
1313
1319
  ${variables_8.catalog}
1314
1320
  ${variables_11.catalogClassic}
1315
1321
  ${variables_25.code}
1316
- ${variables_42.codeWalkthrough}
1322
+ ${variables_43.codeWalkthrough}
1317
1323
  ${docsDropdown}
1318
1324
  ${variables_15.dropdown}
1319
1325
  ${error}
1320
1326
  ${variables_10.filter}
1321
1327
  ${variables_19.footer}
1322
1328
  ${headingsTypography}
1323
- ${variables_37.httpTag}
1329
+ ${variables_38.httpTag}
1324
1330
  ${variables_9.image}
1325
1331
  ${inputs}
1326
1332
  ${variables_1.languagePicker}
1327
- ${variables_32.lastUpdated}
1333
+ ${variables_33.lastUpdated}
1328
1334
  ${links}
1329
1335
  ${loadProgressBar}
1330
- ${variables_33.logo}
1336
+ ${variables_34.logo}
1331
1337
  ${variables_27.markdown}
1332
- ${variables_29.markdownTabs}
1333
- ${variables_30.markdownNumberedList}
1334
- ${variables_31.diagram}
1338
+ ${variables_29.markdownAccordion}
1339
+ ${variables_30.markdownTabs}
1340
+ ${variables_31.markdownNumberedList}
1341
+ ${variables_32.diagram}
1335
1342
  ${variables_24.menu}
1336
1343
  ${variables_24.mobileMenu}
1337
1344
  ${modal}
@@ -1350,26 +1357,26 @@ exports.styles = (0, styled_components_1.css) `
1350
1357
  ${variables_7.toc}
1351
1358
  ${variables_16.tooltip}
1352
1359
  ${typography}
1353
- ${variables_36.userMenu}
1354
- ${variables_38.versionPicker}
1360
+ ${variables_37.userMenu}
1361
+ ${variables_39.versionPicker}
1355
1362
  ${zIndexDepth}
1356
1363
  ${scorecardColors}
1357
- ${variables_34.statusCode}
1364
+ ${variables_35.statusCode}
1358
1365
  ${tab}
1359
1366
  ${icon}
1360
1367
  ${tree}
1361
- ${variables_35.segmented}
1362
- ${variables_40.switcher}
1368
+ ${variables_36.segmented}
1369
+ ${variables_41.switcher}
1363
1370
  ${variables_17.checkbox}
1364
1371
  ${variables_3.feedback}
1365
1372
  ${variables_2.scorecard}
1366
- ${variables_39.datePicker}
1373
+ ${variables_40.datePicker}
1367
1374
  ${replay}
1368
- ${variables_43.skipContent}
1369
- ${variables_44.pageActions}
1370
- ${variables_45.svgViewer}
1371
- ${variables_46.toast}
1372
- ${variables_47.pageNavigation}
1375
+ ${variables_44.skipContent}
1376
+ ${variables_45.pageActions}
1377
+ ${variables_46.svgViewer}
1378
+ ${variables_47.toast}
1379
+ ${variables_48.pageNavigation}
1373
1380
 
1374
1381
  background-color: var(--bg-color);
1375
1382
  color: var(--text-color-primary);
@@ -180,6 +180,8 @@ export type BffCatalogList<T> = {
180
180
  export type BffCatalogEntityList = BffCatalogList<BffCatalogEntity>;
181
181
  export type BffCatalogRelatedEntityList = BffCatalogList<BffCatalogRelatedEntity>;
182
182
  export type Page = {
183
+ nextPage?: string | null;
184
+ previousPage?: string | null;
183
185
  endCursor: string | null;
184
186
  startCursor: string | null;
185
187
  hasNextPage: boolean;