@redocly/theme 0.59.0-next.10 → 0.59.0-next.11
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.
- package/lib/components/Buttons/ConnectMCPButton.d.ts +8 -0
- package/lib/components/Buttons/ConnectMCPButton.js +145 -0
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.js +41 -1
- package/lib/components/PageActions/PageActions.js +4 -1
- package/lib/components/PageActions/variables.js +2 -0
- package/lib/components/Segmented/Segmented.d.ts +1 -8
- package/lib/components/Segmented/Segmented.js +3 -1
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/mcp.d.ts +1 -0
- package/lib/core/constants/mcp.js +5 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-connect-mcp-button.d.ts +13 -0
- package/lib/core/hooks/use-connect-mcp-button.js +50 -0
- package/lib/core/hooks/use-mcp-config.d.ts +9 -0
- package/lib/core/hooks/use-mcp-config.js +27 -0
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +98 -95
- package/lib/core/openapi/index.d.ts +1 -0
- package/lib/core/styles/global.js +1 -0
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +6 -0
- package/lib/core/types/mcp.js +3 -0
- package/lib/core/types/segmented.d.ts +12 -0
- package/lib/core/types/segmented.js +3 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/mcp.d.ts +2 -0
- package/lib/core/utils/mcp.js +31 -0
- package/lib/icons/ConnectIcon/ConnectIcon.d.ts +9 -0
- package/lib/icons/ConnectIcon/ConnectIcon.js +17 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.d.ts +9 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.js +17 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.d.ts +8 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.js +19 -0
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +6 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/connect-mcp.d.ts +2 -0
- package/lib/markdoc/tags/connect-mcp.js +27 -0
- package/package.json +2 -2
- package/src/components/Buttons/ConnectMCPButton.tsx +180 -0
- package/src/components/Buttons/variables.ts +41 -0
- package/src/components/PageActions/PageActions.tsx +5 -1
- package/src/components/PageActions/variables.ts +2 -0
- package/src/components/Segmented/Segmented.tsx +15 -20
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/mcp.ts +1 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-connect-mcp-button.ts +79 -0
- package/src/core/hooks/use-mcp-config.ts +43 -0
- package/src/core/hooks/use-page-actions.ts +148 -126
- package/src/core/openapi/index.ts +1 -0
- package/src/core/styles/global.ts +2 -1
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +9 -0
- package/src/core/types/mcp.ts +8 -0
- package/src/core/types/segmented.ts +14 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/mcp.ts +34 -0
- package/src/icons/ConnectIcon/ConnectIcon.tsx +27 -0
- package/src/icons/VSCodeIcon/VSCodeIcon.tsx +29 -0
- package/src/markdoc/components/ConnectMCP/ConnectMCP.tsx +28 -0
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/connect-mcp.ts +25 -0
|
@@ -15,13 +15,22 @@ const CopyIcon_1 = require("../../icons/CopyIcon/CopyIcon");
|
|
|
15
15
|
const ChatGptIcon_1 = require("../../icons/ChatGptIcon/ChatGptIcon");
|
|
16
16
|
const ClaudeIcon_1 = require("../../icons/ClaudeIcon/ClaudeIcon");
|
|
17
17
|
const MarkdownFullIcon_1 = require("../../icons/MarkdownFullIcon/MarkdownFullIcon");
|
|
18
|
+
const VSCodeIcon_1 = require("../../icons/VSCodeIcon/VSCodeIcon");
|
|
19
|
+
const CursorIcon_1 = require("../../icons/CursorIcon/CursorIcon");
|
|
18
20
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
19
21
|
const use_theme_config_1 = require("./use-theme-config");
|
|
22
|
+
const use_mcp_config_1 = require("./use-mcp-config");
|
|
20
23
|
const clipboard_service_1 = require("../utils/clipboard-service");
|
|
21
24
|
const dom_1 = require("../utils/dom");
|
|
22
|
-
const
|
|
23
|
-
const DEFAULT_ENABLED_ACTIONS = [
|
|
24
|
-
|
|
25
|
+
const mcp_1 = require("../utils/mcp");
|
|
26
|
+
const DEFAULT_ENABLED_ACTIONS = [
|
|
27
|
+
'copy',
|
|
28
|
+
'view',
|
|
29
|
+
'chatgpt',
|
|
30
|
+
'claude',
|
|
31
|
+
'docs-mcp-cursor',
|
|
32
|
+
'docs-mcp-vscode',
|
|
33
|
+
];
|
|
25
34
|
function usePageActions(pageSlug, mcpUrl, actions) {
|
|
26
35
|
var _a, _b, _c;
|
|
27
36
|
const { useTranslate, usePageData, usePageProps, usePageSharedData } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
@@ -29,8 +38,19 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
29
38
|
const themeConfig = (0, use_theme_config_1.useThemeConfig)();
|
|
30
39
|
const pageProps = usePageProps();
|
|
31
40
|
const openApiSharedData = usePageSharedData('openAPIDocsStore');
|
|
41
|
+
const mcpConfig = (0, use_mcp_config_1.useMCPConfig)();
|
|
32
42
|
const shouldHideAllActions = shouldHidePageActions(pageProps, themeConfig, (_a = openApiSharedData === null || openApiSharedData === void 0 ? void 0 : openApiSharedData.options) === null || _a === void 0 ? void 0 : _a.excludeFromSearch);
|
|
33
43
|
const { isPublic } = usePageData() || {};
|
|
44
|
+
const createMCPHandler = (0, react_1.useCallback)((clientType, requiresMcpUrl = false) => () => {
|
|
45
|
+
if (requiresMcpUrl && !mcpUrl)
|
|
46
|
+
return null;
|
|
47
|
+
if (!requiresMcpUrl && (mcpUrl || mcpConfig.isMcpDisabled))
|
|
48
|
+
return null;
|
|
49
|
+
const config = requiresMcpUrl
|
|
50
|
+
? { serverName: mcpConfig.serverName, url: mcpUrl || '' }
|
|
51
|
+
: { serverName: mcpConfig.serverName, url: mcpConfig.serverUrl || '' };
|
|
52
|
+
return createMCPAction({ clientType, mcpConfig: config, translate });
|
|
53
|
+
}, [mcpUrl, mcpConfig, translate]);
|
|
34
54
|
const result = (0, react_1.useMemo)(() => {
|
|
35
55
|
var _a, _b;
|
|
36
56
|
if (shouldHideAllActions) {
|
|
@@ -39,111 +59,94 @@ function usePageActions(pageSlug, mcpUrl, actions) {
|
|
|
39
59
|
const origin = dom_1.IS_BROWSER ? window.location.origin : globalThis['SSR_HOSTNAME'];
|
|
40
60
|
const normalizedSlug = pageSlug.startsWith('/') ? pageSlug : '/' + pageSlug;
|
|
41
61
|
const mdPageUrl = new URL(origin + normalizedSlug + (normalizedSlug === '/' ? 'index.html.md' : '.md')).toString();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return JSON.stringify(jsonConfig, null, 2);
|
|
62
|
-
}
|
|
63
|
-
switch (action) {
|
|
64
|
-
case 'mcp-cursor':
|
|
65
|
-
if (!mcpUrl) {
|
|
66
|
-
return null;
|
|
62
|
+
const actionHandlers = {
|
|
63
|
+
'docs-mcp-cursor': createMCPHandler('cursor'),
|
|
64
|
+
'docs-mcp-vscode': createMCPHandler('vscode'),
|
|
65
|
+
'mcp-cursor': createMCPHandler('cursor', true),
|
|
66
|
+
'mcp-vscode': createMCPHandler('vscode', true),
|
|
67
|
+
copy: () => ({
|
|
68
|
+
buttonText: translate('page.actions.copyButtonText', 'Copy'),
|
|
69
|
+
title: translate('page.actions.copyTitle', 'Copy for LLM'),
|
|
70
|
+
description: translate('page.actions.copyDescription', 'Copy page as Markdown for LLMs'),
|
|
71
|
+
iconComponent: CopyIcon_1.CopyIcon,
|
|
72
|
+
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
try {
|
|
74
|
+
const result = yield fetch(mdPageUrl);
|
|
75
|
+
if (result.status !== 200) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const text = yield result.text();
|
|
79
|
+
clipboard_service_1.ClipboardService.copyCustom(text);
|
|
67
80
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
title: translate('page.actions.cursorMcpTitle', 'Connect to Cursor'),
|
|
71
|
-
description: translate('page.actions.cursorMcpDescription', 'Install MCP server on Cursor'),
|
|
72
|
-
iconComponent: CursorIcon_1.CursorIcon,
|
|
73
|
-
onClick: () => {
|
|
74
|
-
try {
|
|
75
|
-
const url = generateMCPConfig(true);
|
|
76
|
-
window.open(url, '_blank');
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error(error);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
case 'copy':
|
|
84
|
-
return {
|
|
85
|
-
buttonText: translate('page.actions.copyButtonText', 'Copy'),
|
|
86
|
-
title: translate('page.actions.copyTitle', 'Copy for LLM'),
|
|
87
|
-
description: translate('page.actions.copyDescription', 'Copy page as Markdown for LLMs'),
|
|
88
|
-
iconComponent: CopyIcon_1.CopyIcon,
|
|
89
|
-
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
try {
|
|
91
|
-
const result = yield fetch(mdPageUrl);
|
|
92
|
-
if (result.status !== 200) {
|
|
93
|
-
throw new Error('Failed to fetch markdown content');
|
|
94
|
-
}
|
|
95
|
-
const text = yield result.text();
|
|
96
|
-
clipboard_service_1.ClipboardService.copyCustom(text);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
console.error(error);
|
|
100
|
-
}
|
|
101
|
-
}),
|
|
102
|
-
};
|
|
103
|
-
case 'view':
|
|
104
|
-
return {
|
|
105
|
-
buttonText: translate('page.actions.viewAsMdButtonText', 'View as Markdown'),
|
|
106
|
-
title: translate('page.actions.viewAsMdTitle', 'View as Markdown'),
|
|
107
|
-
description: translate('page.actions.viewAsMdDescription', 'Open this page as Markdown'),
|
|
108
|
-
iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
|
|
109
|
-
link: mdPageUrl,
|
|
110
|
-
};
|
|
111
|
-
case 'chatgpt':
|
|
112
|
-
if (!isPublic) {
|
|
113
|
-
return null;
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error(error);
|
|
114
83
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
84
|
+
}),
|
|
85
|
+
}),
|
|
86
|
+
view: () => ({
|
|
87
|
+
buttonText: translate('page.actions.viewAsMdButtonText', 'View as Markdown'),
|
|
88
|
+
title: translate('page.actions.viewAsMdTitle', 'View as Markdown'),
|
|
89
|
+
description: translate('page.actions.viewAsMdDescription', 'Open this page as Markdown'),
|
|
90
|
+
iconComponent: MarkdownFullIcon_1.MarkdownFullIcon,
|
|
91
|
+
link: mdPageUrl,
|
|
92
|
+
}),
|
|
93
|
+
chatgpt: () => {
|
|
94
|
+
if (!isPublic) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
buttonText: translate('page.actions.chatGptButtonText', 'Open in ChatGPT'),
|
|
99
|
+
title: translate('page.actions.chatGptTitle', 'Open in ChatGPT'),
|
|
100
|
+
description: translate('page.actions.chatGptDescription', 'Get insights from ChatGPT'),
|
|
101
|
+
iconComponent: ChatGptIcon_1.ChatGptIcon,
|
|
102
|
+
link: getExternalAiPromptLink('https://chat.openai.com', mdPageUrl),
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
claude: () => {
|
|
106
|
+
if (!isPublic) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
buttonText: translate('page.actions.claudeButtonText', 'Open in Claude'),
|
|
111
|
+
title: translate('page.actions.claudeTitle', 'Open in Claude'),
|
|
112
|
+
description: translate('page.actions.claudeDescription', 'Get insights from Claude'),
|
|
113
|
+
iconComponent: ClaudeIcon_1.ClaudeIcon,
|
|
114
|
+
link: getExternalAiPromptLink('https://claude.ai/new', mdPageUrl),
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
return (((_b = (_a = themeConfig.navigation) === null || _a === void 0 ? void 0 : _a.actions) === null || _b === void 0 ? void 0 : _b.items) || actions || DEFAULT_ENABLED_ACTIONS)
|
|
119
|
+
.map((action) => { var _a; return (_a = actionHandlers[action]) === null || _a === void 0 ? void 0 : _a.call(actionHandlers); })
|
|
135
120
|
.filter((action) => action !== null);
|
|
136
121
|
}, [
|
|
137
122
|
shouldHideAllActions,
|
|
138
123
|
pageSlug,
|
|
139
124
|
(_c = (_b = themeConfig.navigation) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.items,
|
|
140
125
|
actions,
|
|
141
|
-
mcpUrl,
|
|
142
126
|
translate,
|
|
143
127
|
isPublic,
|
|
128
|
+
createMCPHandler,
|
|
144
129
|
]);
|
|
145
130
|
return result;
|
|
146
131
|
}
|
|
132
|
+
function getExternalAiPromptLink(baseUrl, mdPageUrl) {
|
|
133
|
+
const externalAiPrompt = `Read ${mdPageUrl} and answer questions based on the content.`;
|
|
134
|
+
const url = new URL(baseUrl);
|
|
135
|
+
url.searchParams.set('q', externalAiPrompt);
|
|
136
|
+
return url.toString();
|
|
137
|
+
}
|
|
138
|
+
function createMCPAction({ clientType, mcpConfig, translate }) {
|
|
139
|
+
const url = (0, mcp_1.generateMCPDeepLink)(clientType, mcpConfig);
|
|
140
|
+
const sharedProps = {
|
|
141
|
+
onClick: () => {
|
|
142
|
+
window.open(url, '_blank');
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
if (clientType === 'cursor') {
|
|
146
|
+
return Object.assign(Object.assign({}, sharedProps), { buttonText: translate('page.actions.connectMcp.cursor', 'Connect to Cursor'), title: translate('page.actions.connectMcp.cursor', 'Connect to Cursor'), description: translate('page.actions.connectMcp.cursorDescription', 'Install MCP server on Cursor'), iconComponent: CursorIcon_1.CursorIcon });
|
|
147
|
+
}
|
|
148
|
+
return Object.assign(Object.assign({}, sharedProps), { buttonText: translate('page.actions.connectMcp.vscode', 'Connect to VS Code'), title: translate('page.actions.connectMcp.vscode', 'Connect to VS Code'), description: translate('page.actions.connectMcp.vscodeDescription', 'Install MCP server on VS Code'), iconComponent: VSCodeIcon_1.VSCodeIcon });
|
|
149
|
+
}
|
|
147
150
|
function shouldHidePageActions(pageProps, themeConfig, openapiExcludeFromSearch) {
|
|
148
151
|
var _a, _b, _c, _d, _e, _f;
|
|
149
152
|
// Can't use any actions if no markdown files are generated for LLMs
|
|
@@ -2,6 +2,7 @@ export type { UserClaims } from '../types/user-claims';
|
|
|
2
2
|
export type { OperationParameter, ParameterHighlight } from '../types/search';
|
|
3
3
|
export type { TFunction, TOptions } from '../types/l10n';
|
|
4
4
|
export type { SelectOption, SelectProps } from '../types/select';
|
|
5
|
+
export type { SegmentedOption, SegmentedProps } from '../types/segmented';
|
|
5
6
|
export { IS_BROWSER } from '../utils/dom';
|
|
6
7
|
export { addLeadingSlash, removeLeadingSlash, getPathPrefix, combineUrls, addTrailingSlash, withPathPrefix, } from '../utils/urls';
|
|
7
8
|
export { capitalize } from '../utils/string';
|
|
@@ -1220,6 +1220,7 @@ exports.styles = (0, styled_components_1.css) `
|
|
|
1220
1220
|
${variables_5.breadcrumbs}
|
|
1221
1221
|
${variables_19.button}
|
|
1222
1222
|
${variables_20.aiAssistantButton}
|
|
1223
|
+
${variables_20.connectMCPButton}
|
|
1223
1224
|
${variables_38.cards}
|
|
1224
1225
|
${variables_8.catalog}
|
|
1225
1226
|
${variables_10.catalogClassic}
|
package/lib/core/types/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./breadcrumb"), exports);
|
|
18
18
|
__exportStar(require("./catalog"), exports);
|
|
19
19
|
__exportStar(require("./l10n"), exports);
|
|
20
|
+
__exportStar(require("./mcp"), exports);
|
|
20
21
|
__exportStar(require("./feedback"), exports);
|
|
21
22
|
__exportStar(require("./hooks"), exports);
|
|
22
23
|
__exportStar(require("./markdown"), exports);
|
package/lib/core/types/l10n.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TOptions } from 'i18next';
|
|
2
|
-
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
2
|
+
export type TranslationKey = 'dev.newApp' | 'dev.newApp.text' | 'dev.sidebar.header' | 'dev.sidebar.footer.text' | 'dev.create.app.dialog.appName.placeholder' | 'dev.create.app.dialog.appName.error' | 'dev.create.app.dialog.selectAPIs' | 'dev.create.app.dialog.description' | 'dev.create.app.dialog.description.placeholder' | 'dev.create.app.dialog.create' | 'dev.create.app.dialog.cancel' | 'dev.main.tab.appKeys' | 'dev.main.tab.logs' | 'dev.app.description.title' | 'dev.edit.description.dialog.title' | 'dev.edit.description.dialog.save' | 'dev.edit.description.dialog.cancel' | 'dev.edit.apis.dialog.selectedAPIs' | 'dev.app.key.create' | 'dev.create.key.dialog.title' | 'dev.create.key.dialog.create' | 'dev.create.key.dialog.cancel' | 'dev.app.edit' | 'dev.app.delete' | 'dev.edit.app.dialog.title' | 'dev.edit.app.dialog.save' | 'dev.edit.app.dialog.cancel' | 'dev.delete.app.dialog.title' | 'dev.delete.app.dialog.confirmation' | 'dev.delete.app.dialog.delete' | 'dev.delete.app.dialog.cancel' | 'dev.app.key.roll' | 'dev.roll.key.dialog.title' | 'dev.roll.key.dialog.apiKey' | 'dev.roll.key.dialog.expires' | 'dev.roll.key.dialog.confirmation' | 'dev.roll.key.dialog.cancel' | 'dev.roll.key.dialog.roll' | 'dev.update.key.dialog.title' | 'dev.update.key.dialog.update' | 'dev.update.key.dialog.cancel' | 'dev.app.key.api.name' | 'dev.app.key.api.status' | 'dev.app.key.api.edit' | 'dev.edit.apis.dialog.title' | 'dev.edit.apis.dialog.apiKey' | 'dev.edit.apis.dialog.save' | 'dev.edit.apis.dialog.cancel' | 'dev.select.placeholder' | 'dev.app.overview.status.pending' | 'dev.app.overview.status.approved' | 'dev.app.overview.status.revoked' | 'dev.app.overview.status' | 'dev.app.overview.non-production' | 'dev.app.overview.production' | 'dev.app.overview.clientId' | 'dev.app.overview.apiKey' | 'dev.app.key.revoke' | 'dev.revoke.key.dialog.title' | 'dev.revoke.key.dialog.apiKey' | 'dev.revoke.key.dialog.expires' | 'dev.revoke.key.dialog.confirmation' | 'dev.revoke.key.dialog.revoke' | 'dev.revoke.key.dialog.cancel' | 'dev.app.overview.expires' | 'dev.app.overview.created' | 'dev.app.overview.visibilityToggle.hide' | 'dev.app.overview.visibilityToggle.show' | 'search.loading' | 'search.noResults.title' | 'search.keys.navigate' | 'search.keys.select' | 'search.keys.exit' | 'search.label' | 'search.cancel' | 'search.recent' | 'search.navbar.label' | 'search.suggested' | 'search.showMore' | 'search.filter.title' | 'search.filter.reset' | 'search.filter.field.reset' | 'search.ai.welcomeText' | 'search.ai.newConversation' | 'search.ai.backToSearch' | 'search.ai.back' | 'search.ai.placeholder' | 'search.ai.generatingResponse' | 'search.ai.followUpQuestion' | 'search.ai.suggestionsTitle' | 'search.ai.thinkingText' | 'search.ai.resourcesFound' | 'search.ai.resourcesFound.basedOn' | 'search.ai.resourcesFound.resources' | 'search.ai.feedback.title' | 'search.ai.feedback.detailsPlaceholder' | 'search.ai.feedback.thanks' | 'search.ai.button' | 'search.ai.label' | 'search.ai.disclaimer' | 'search.ai.error.description' | 'search.ai.error.description.forbidden' | 'search.ai.error.description.unauthorized' | 'search.ai.error.header' | 'search.ai.error.header.forbidden' | 'search.ai.error.header.unauthorized' | 'aiAssistant.trigger' | 'toc.header' | 'footer.copyrightText' | 'page.homeButton' | 'page.forbidden.title' | 'page.notFound.title' | 'page.notFound.description' | 'page.lastUpdated.timeago' | 'page.lastUpdated.on' | 'catalog.filters.placeholder' | 'catalog.filters.title' | 'catalog.filters.add' | 'catalog.filters.clearAll' | 'catalog.filters.select.addFilter' | 'catalog.filters.select.all' | 'catalog.filters.done' | 'catalog.catalogs.all.title' | 'catalog.catalogs.all.description' | 'catalog.catalogs.all.switcherLabel' | 'catalog.catalogs.service.title' | 'catalog.catalogs.service.description' | 'catalog.catalogs.service.switcherLabel' | 'catalog.catalogs.user.title' | 'catalog.catalogs.user.description' | 'catalog.catalogs.user.switcherLabel' | 'catalog.catalogs.team.title' | 'catalog.catalogs.team.description' | 'catalog.catalogs.team.switcherLabel' | 'catalog.catalogs.domain.title' | 'catalog.catalogs.domain.description' | 'catalog.catalogs.domain.switcherLabel' | 'catalog.catalogs.apiDescription.title' | 'catalog.catalogs.apiDescription.description' | 'catalog.catalogs.apiDescription.switcherLabel' | 'catalog.catalogs.dataSchema.title' | 'catalog.catalogs.dataSchema.description' | 'catalog.catalogs.dataSchema.switcherLabel' | 'catalog.catalogs.apiOperation.title' | 'catalog.catalogs.apiOperation.description' | 'catalog.catalogs.apiOperation.switcherLabel' | 'catalog.entity.metadata.title' | 'catalog.entity.schema.title' | 'catalog.entity.properties.apiDescription.title' | 'catalog.backToAllLabel' | 'sidebar.menu.backLabel' | 'sidebar.menu.backToLabel' | 'sidebar.actions.show' | 'sidebar.actions.hide' | 'sidebar.actions.changeToSingleColumn' | 'sidebar.actions.changeToTwoColumns' | 'sidebar.actions.singleColumn' | 'sidebar.actions.twoColumns' | 'versionPicker.label' | 'versionPicker.unversioned' | 'codeSnippet.copy.buttonText' | 'codeSnippet.copy.tooltipText' | 'codeSnippet.copy.toasterText' | 'markdown.editPage.text' | 'feedback.settings.comment.submitText' | 'feedback.settings.comment.label' | 'feedback.settings.comment.send' | 'feedback.settings.comment.cancel' | 'feedback.settings.comment.satisfiedLabel' | 'feedback.settings.comment.neutralLabel' | 'feedback.settings.comment.dissatisfiedLabel' | 'feedback.settings.submitText' | 'feedback.settings.label' | 'feedback.settings.reasons.label' | 'feedback.submit' | 'feedback.cancel' | 'feedback.settings.comment.likeLabel' | 'feedback.settings.comment.dislikeLabel' | 'feedback.sentiment.thumbUp' | 'feedback.sentiment.thumbDown' | 'feedback.settings.leftScaleLabel' | 'feedback.settings.rightScaleLabel' | 'feedback.settings.optionalEmail.placeholder' | 'feedback.settings.optionalEmail.label' | 'codeSnippet.report.buttonText' | 'codeSnippet.report.tooltipText' | 'codeSnippet.report.label' | 'codeSnippet.expand.tooltipText' | 'codeSnippet.collapse.tooltipText' | 'userMenu.login' | 'userMenu.logout' | 'userMenu.devOnboardingLabel' | 'mobileMenu.mainMenu' | 'mobileMenu.previous' | 'mobileMenu.products' | 'mobileMenu.version' | 'navbar.products' | 'page.nextButton' | 'page.previousButton' | 'page.actions.copyButtonText' | 'page.actions.copyTitle' | 'page.actions.copyDescription' | 'page.actions.viewAsMdTitle' | 'page.actions.viewAsMdButtonText' | 'page.actions.viewAsMdDescription' | 'page.actions.chatGptTitle' | 'page.actions.chatGptButtonText' | 'page.actions.chatGptDescription' | 'page.actions.claudeTitle' | 'page.actions.claudeButtonText' | 'page.actions.claudeDescription' | 'page.actions.cursorMcpButtonText' | 'page.actions.cursorMcpTitle' | 'page.actions.cursorMcpDescription' | 'page.actions.connectMcp' | 'page.actions.connectMcp.cursor' | 'page.actions.connectMcp.cursorDescription' | 'page.actions.connectMcp.vscode' | 'page.actions.connectMcp.vscodeDescription' | 'page.actions.connectMcp.copyConfig' | 'page.actions.connectMcp.copyConfigDescription' | 'openapi.download.description.title' | 'openapi.info.title' | 'openapi.info.contact.url' | 'openapi.info.contact.name' | 'openapi.info.license' | 'openapi.info.termsOfService' | 'openapi.info.metadata.title' | 'openapi.key' | 'openapi.value' | 'openapi.enum' | 'openapi.items' | 'openapi.default' | 'openapi.variable' | 'openapi.variables' | 'openapi.actions.show' | 'openapi.actions.hide' | 'openapi.actions.more' | 'openapi.languages.title' | 'openapi.servers.title' | 'openapi.operations' | 'openapi.webhooks' | 'openapi.description' | 'openapi.badges.deprecated' | 'openapi.badges.required' | 'openapi.badges.webhook' | 'openapi.request' | 'openapi.path' | 'openapi.query' | 'openapi.cookie' | 'openapi.header' | 'openapi.body' | 'openapi.responses' | 'openapi.response' | 'openapi.callbacks' | 'openapi.callbackRequest' | 'openapi.callbackResponse' | 'openapi.payload' | 'openapi.discriminator' | 'openapi.contentType' | 'openapi.tryIt' | 'openapi.loading' | 'openapi.example' | 'openapi.examples' | 'openapi.additionalProperties' | 'openapi.patternProperties' | 'openapi.required' | 'openapi.recursive' | 'openapi.complex' | 'openapi.hideExample' | 'openapi.showExample' | 'openapi.expandAll' | 'openapi.collapseAll' | 'openapi.viewSecurityDetails' | 'openapi.noResponseExample' | 'openapi.discriminator.searchPlaceholder' | 'openapi.discriminator.searchNoResults' | 'openapi.discriminator.defaultMapping' | 'openapi.discriminator.defaultMappingTooltip' | 'openapi.noResponseContent' | 'openapi.noRequestPayload' | 'openapi.hidePattern' | 'openapi.showPattern' | 'openapi.authorizationUrl' | 'openapi.tokenUrl' | 'openapi.refreshUrl' | 'openapi.showOptionalScopes' | 'openapi.hideOptionalScopes' | 'openapi.security' | 'openapi.httpAuthorizationScheme' | 'openapi.bearerFormat' | 'openapi.parameterName' | 'openapi.flowType' | 'openapi.connectUrl' | 'openapi.requiredScopes' | 'openapi.unsupportedLanguage' | 'openapi.failedToGenerateCodeSample' | 'openapi.schemaCatalogLink.title' | 'openapi.schemaCatalogLink.copyButtonTooltip' | 'openapi.schemaCatalogLink.copiedTooltip' | 'openapi.mcp.title' | 'openapi.mcp.endpoint' | 'openapi.mcp.tools' | 'openapi.mcp.protocolVersion' | 'openapi.mcp.capabilities' | 'openapi.mcp.experimentalCapabilities' | 'openapi.mcp.inputSchema' | 'openapi.mcp.inputExample' | 'openapi.mcp.outputSchema' | 'openapi.mcp.outputExample' | 'asyncapi.download.description.title' | 'asyncapi.info.title' | 'graphql.queries' | 'graphql.mutations' | 'graphql.subscriptions' | 'graphql.directives' | 'graphql.objects' | 'graphql.interfaces' | 'graphql.unions' | 'graphql.enums' | 'graphql.inputs' | 'graphql.scalars' | 'graphql.arguments.label' | 'graphql.arguments.show' | 'graphql.arguments.hide' | 'graphql.arguments.here' | 'graphql.returnTypes.label' | 'graphql.returnTypes.show' | 'graphql.returnTypes.hide' | 'graphql.possibleTypes' | 'graphql.defaultValue' | 'graphql.deprecationReason' | 'graphql.requiredScopes' | 'graphql.viewSecurityDetails' | 'graphql.objectScopes' | 'graphql.fieldScopes' | 'graphql.implementedInterfaces' | 'graphql.nonNull' | 'graphql.required' | 'graphql.deprecated' | 'graphql.variables' | 'graphql.querySample' | 'graphql.mutationSample' | 'graphql.subscriptionSample' | 'graphql.responseSample' | 'graphql.locations' | 'graphql.sample' | 'graphql.referenced' | 'graphql.content.fragment' | 'codeWalkthrough.download' | 'codeWalkthrough.preview' | 'time.justNow' | 'time.past.second' | 'time.past.seconds' | 'time.past.minute' | 'time.past.minutes' | 'time.past.hour' | 'time.past.hours' | 'time.past.day' | 'time.past.days' | 'time.past.week' | 'time.past.weeks' | 'time.past.month' | 'time.past.months' | 'time.past.year' | 'time.past.years' | 'page.internalServerError.title' | 'page.internalServerError.description' | 'page.skipToContent.label';
|
|
3
3
|
export type Locale = {
|
|
4
4
|
code: string;
|
|
5
5
|
name: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SelectOption } from './select';
|
|
3
|
+
export type SegmentedOption<T> = SelectOption<T> & {
|
|
4
|
+
divider?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export type SegmentedProps<T = any> = {
|
|
7
|
+
options: SegmentedOption<T>[];
|
|
8
|
+
value: T;
|
|
9
|
+
onChange: ({ label, value }: SegmentedOption<T>) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
size?: 'regular' | 'small';
|
|
12
|
+
};
|
package/lib/core/utils/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./clipboard-service"), exports);
|
|
18
18
|
__exportStar(require("./css-variables"), exports);
|
|
19
19
|
__exportStar(require("./add-line-numbers"), exports);
|
|
20
|
+
__exportStar(require("./mcp"), exports);
|
|
20
21
|
__exportStar(require("./media-css"), exports);
|
|
21
22
|
__exportStar(require("./theme-helpers"), exports);
|
|
22
23
|
__exportStar(require("./class-names"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateMCPDeepLink = generateMCPDeepLink;
|
|
4
|
+
function generateCursorMCPDeepLink(config) {
|
|
5
|
+
const cursorConfig = {
|
|
6
|
+
url: config.url,
|
|
7
|
+
description: 'MCP Server',
|
|
8
|
+
};
|
|
9
|
+
const encodedConfig = btoa(JSON.stringify(cursorConfig));
|
|
10
|
+
return `cursor://anysphere.cursor-deeplink/mcp/install?name=${config.serverName}&config=${encodedConfig}`;
|
|
11
|
+
}
|
|
12
|
+
function generateVSCodeMCPDeepLink(config) {
|
|
13
|
+
const vscodeConfig = {
|
|
14
|
+
name: config.serverName,
|
|
15
|
+
url: config.url,
|
|
16
|
+
type: 'http',
|
|
17
|
+
};
|
|
18
|
+
const encodedConfig = encodeURIComponent(JSON.stringify(vscodeConfig));
|
|
19
|
+
return `vscode:mcp/install?${encodedConfig}`;
|
|
20
|
+
}
|
|
21
|
+
function generateMCPDeepLink(clientType, config) {
|
|
22
|
+
switch (clientType) {
|
|
23
|
+
case 'cursor':
|
|
24
|
+
return generateCursorMCPDeepLink(config);
|
|
25
|
+
case 'vscode':
|
|
26
|
+
return generateVSCodeMCPDeepLink(config);
|
|
27
|
+
default:
|
|
28
|
+
return generateCursorMCPDeepLink(config);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const ConnectIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConnectIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
10
|
+
react_1.default.createElement("path", { d: "M10.5 7.00875C9.74669 7.00947 9.01371 7.25321 8.40999 7.70375L6.29999 5.59375C6.75586 4.99443 7.00185 4.26175 6.99999 3.50875C7.00197 2.72021 6.73759 1.9541 6.24973 1.33459C5.76186 0.715073 5.07908 0.278462 4.31205 0.0955081C3.54502 -0.0874454 2.73868 -0.00601915 2.02371 0.326591C1.30874 0.659201 0.727035 1.2235 0.372873 1.92805C0.0187108 2.63259 -0.087157 3.43608 0.0724264 4.20832C0.23201 4.98055 0.647693 5.67627 1.25211 6.18272C1.85652 6.68917 2.61425 6.97668 3.4025 6.99864C4.19074 7.02061 4.96331 6.77576 5.59499 6.30375L7.69999 8.41375C7.22812 9.04527 6.98326 9.81759 7.00508 10.6056C7.0269 11.3937 7.31412 12.1512 7.82021 12.7557C8.32631 13.3601 9.02164 13.776 9.79358 13.9359C10.5655 14.0959 11.3688 13.9906 12.0735 13.637C12.7781 13.2834 13.3427 12.7024 13.6758 11.9879C14.009 11.2734 14.0912 10.4674 13.9091 9.70036C13.727 8.93334 13.2913 8.25026 12.6726 7.76174C12.0539 7.27323 11.2883 7.00791 10.5 7.00875ZM0.999993 3.50875C0.999993 3.0143 1.14662 2.53095 1.42132 2.11983C1.69602 1.70871 2.08647 1.38827 2.54328 1.19906C3.0001 1.00984 3.50277 0.960328 3.98772 1.05679C4.47267 1.15325 4.91813 1.39136 5.26776 1.74099C5.61739 2.09062 5.85549 2.53608 5.95196 3.02103C6.04842 3.50598 5.99891 4.00865 5.80969 4.46546C5.62047 4.92228 5.30004 5.31272 4.88892 5.58743C4.4778 5.86213 3.99445 6.00875 3.49999 6.00875C2.83695 6.00875 2.20107 5.74536 1.73223 5.27652C1.26339 4.80768 0.999993 4.1718 0.999993 3.50875Z", fill: "currentColor" })));
|
|
11
|
+
exports.ConnectIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
12
|
+
'data-component-name': 'icons/ConnectIcon/ConnectIcon',
|
|
13
|
+
})) `
|
|
14
|
+
height: ${({ size }) => size || '14px'};
|
|
15
|
+
width: ${({ size }) => size || '14px'};
|
|
16
|
+
`;
|
|
17
|
+
//# sourceMappingURL=ConnectIcon.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../../icons/types';
|
|
3
|
+
export declare const VSCodeIcon: import("styled-components").StyledComponent<(props: IconProps) => React.JSX.Element, any, {
|
|
4
|
+
'data-component-name': string;
|
|
5
|
+
} & {
|
|
6
|
+
color?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
} & React.SVGProps<SVGSVGElement>, "data-component-name">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VSCodeIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Icon = (props) => (react_1.default.createElement("svg", Object.assign({ width: "16", height: "16", viewBox: "0 0 100 100", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props),
|
|
10
|
+
react_1.default.createElement("path", { clipRule: "evenodd", d: "m70.9119 99.3171c1.575.6136 3.3709.5743 4.9606-.1907l20.5883-9.9067c2.1634-1.041 3.5392-3.2305 3.5392-5.6325v-67.1739c0-2.402-1.3757-4.5915-3.5391-5.6325l-20.5884-9.907044c-2.0863-1.003885-4.5279-.757996-6.359.573194-.2615.19016-.5107.40248-.7445.63646l-39.4139 35.95809-17.1679-13.0319c-1.5982-1.2131-3.83357-1.1137-5.31787.2365l-5.5063 5.0088c-1.815582 1.6515-1.817663 4.5078-.0045 6.1621l14.88857 13.5831-14.88857 13.5831c-1.813163 1.6542-1.811082 4.5106.0045 6.1621l5.5063 5.0088c1.4843 1.3502 3.71967 1.4496 5.31787.2364l17.1679-13.0318 39.4139 35.958c.6235.6239 1.3556 1.0937 2.1429 1.4004zm4.1033-72.0182-29.9061 22.7012 29.9061 22.7011z", fill: "currentColor", fillRule: "evenodd" })));
|
|
11
|
+
exports.VSCodeIcon = (0, styled_components_1.default)(Icon).attrs(() => ({
|
|
12
|
+
'data-component-name': 'icons/VSCodeIcon/VSCodeIcon',
|
|
13
|
+
})) `
|
|
14
|
+
height: ${({ size }) => size || '16px'};
|
|
15
|
+
width: ${({ size }) => size || '16px'};
|
|
16
|
+
`;
|
|
17
|
+
//# sourceMappingURL=VSCodeIcon.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { MCPOption } from '../../../core/types';
|
|
3
|
+
export type ConnectMCPProps = {
|
|
4
|
+
placement?: 'top' | 'bottom';
|
|
5
|
+
alignment?: 'start' | 'end';
|
|
6
|
+
options?: MCPOption[];
|
|
7
|
+
};
|
|
8
|
+
export declare function ConnectMCP({ placement, alignment, options, }: ConnectMCPProps): JSX.Element | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConnectMCP = ConnectMCP;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ConnectMCPButton_1 = require("../../../components/Buttons/ConnectMCPButton");
|
|
9
|
+
const hooks_1 = require("../../../core/hooks");
|
|
10
|
+
function ConnectMCP({ placement = 'bottom', alignment = 'start', options, }) {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const themeConfig = (0, hooks_1.useThemeConfig)();
|
|
13
|
+
const isMcpDisabled = ((_a = themeConfig.mcp) === null || _a === void 0 ? void 0 : _a.hide) || ((_c = (_b = themeConfig.mcp) === null || _b === void 0 ? void 0 : _b.docs) === null || _c === void 0 ? void 0 : _c.hide);
|
|
14
|
+
if (isMcpDisabled) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return react_1.default.createElement(ConnectMCPButton_1.ConnectMCPButton, { placement: placement, alignment: alignment, options: options });
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ConnectMCP.js.map
|
|
@@ -20,3 +20,4 @@ export * from '../../markdoc/components/CodeWalkthrough/CodeToggle';
|
|
|
20
20
|
export * from '../../markdoc/components/CodeWalkthrough/CodeContainer';
|
|
21
21
|
export * from '../../markdoc/components/CodeGroup/CodeGroup';
|
|
22
22
|
export * from '../../markdoc/components/Icon/Icon';
|
|
23
|
+
export * from '../../markdoc/components/ConnectMCP/ConnectMCP';
|
|
@@ -36,4 +36,5 @@ __exportStar(require("../../markdoc/components/CodeWalkthrough/CodeToggle"), exp
|
|
|
36
36
|
__exportStar(require("../../markdoc/components/CodeWalkthrough/CodeContainer"), exports);
|
|
37
37
|
__exportStar(require("../../markdoc/components/CodeGroup/CodeGroup"), exports);
|
|
38
38
|
__exportStar(require("../../markdoc/components/Icon/Icon"), exports);
|
|
39
|
+
__exportStar(require("../../markdoc/components/ConnectMCP/ConnectMCP"), exports);
|
|
39
40
|
//# sourceMappingURL=default.js.map
|
package/lib/markdoc/default.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { input } from '../markdoc/tags/input';
|
|
|
22
22
|
import { toggle } from '../markdoc/tags/code-toggle';
|
|
23
23
|
import { codeGroup } from '../markdoc/tags/code-group';
|
|
24
24
|
import { icon } from '../markdoc/tags/icon';
|
|
25
|
+
import { connectMcp } from '../markdoc/tags/connect-mcp';
|
|
25
26
|
export declare const tags: {
|
|
26
27
|
[admonition.tagName]: import("@markdoc/markdoc").Schema & {
|
|
27
28
|
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
@@ -113,4 +114,9 @@ export declare const tags: {
|
|
|
113
114
|
resolver?: string;
|
|
114
115
|
}>;
|
|
115
116
|
};
|
|
117
|
+
[connectMcp.tagName]: import("@markdoc/markdoc").Schema & {
|
|
118
|
+
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
119
|
+
resolver?: string;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
116
122
|
};
|
package/lib/markdoc/default.js
CHANGED
|
@@ -64,6 +64,7 @@ const input_1 = require("../markdoc/tags/input");
|
|
|
64
64
|
const code_toggle_1 = require("../markdoc/tags/code-toggle");
|
|
65
65
|
const code_group_1 = require("../markdoc/tags/code-group");
|
|
66
66
|
const icon_1 = require("../markdoc/tags/icon");
|
|
67
|
+
const connect_mcp_1 = require("../markdoc/tags/connect-mcp");
|
|
67
68
|
exports.tags = {
|
|
68
69
|
[admonition_1.admonition.tagName]: admonition_1.admonition.schema,
|
|
69
70
|
[debug_1.debug.tagName]: debug_1.debug.schema,
|
|
@@ -83,5 +84,6 @@ exports.tags = {
|
|
|
83
84
|
[input_1.input.tagName]: input_1.input.schema,
|
|
84
85
|
[code_group_1.codeGroup.tagName]: code_group_1.codeGroup.schema,
|
|
85
86
|
[icon_1.icon.tagName]: icon_1.icon.schema,
|
|
87
|
+
[connect_mcp_1.connectMcp.tagName]: connect_mcp_1.connectMcp.schema,
|
|
86
88
|
};
|
|
87
89
|
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectMcp = void 0;
|
|
4
|
+
exports.connectMcp = {
|
|
5
|
+
schema: {
|
|
6
|
+
render: 'ConnectMCP',
|
|
7
|
+
attributes: {
|
|
8
|
+
placement: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: 'bottom',
|
|
11
|
+
matches: ['top', 'bottom'],
|
|
12
|
+
},
|
|
13
|
+
alignment: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'start',
|
|
16
|
+
matches: ['start', 'end'],
|
|
17
|
+
},
|
|
18
|
+
options: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: ['cursor', 'vscode', 'copy'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
selfClosing: true,
|
|
24
|
+
},
|
|
25
|
+
tagName: 'connect-mcp',
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=connect-mcp.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.59.0-next.
|
|
3
|
+
"version": "0.59.0-next.11",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"openapi-sampler": "1.6.2",
|
|
88
88
|
"react-calendar": "5.1.0",
|
|
89
89
|
"react-date-picker": "11.0.0",
|
|
90
|
-
"@redocly/config": "0.
|
|
90
|
+
"@redocly/config": "0.37.0",
|
|
91
91
|
"@redocly/realm-asyncapi-sdk": "0.5.0-next.3"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|