{Object.keys(tool?.config).length !== 0 && tool.name !== 'api_tool' && (
- {t('settings.tools.authentication')}
+ {tool.name === 'mcp_tool'
+ ? (tool.config as any)?.auth_type === 'bearer'
+ ? 'Bearer Token'
+ : (tool.config as any)?.auth_type === 'api_key'
+ ? 'API Key'
+ : (tool.config as any)?.auth_type === 'basic'
+ ? 'Password'
+ : t('settings.tools.authentication')
+ : t('settings.tools.authentication')}
)}
@@ -208,7 +249,17 @@ export default function ToolConfig({
value={authKey}
onChange={(e) => setAuthKey(e.target.value)}
borderVariant="thin"
- placeholder={t('modals.configTool.apiKeyPlaceholder')}
+ placeholder={
+ tool.name === 'mcp_tool'
+ ? (tool.config as any)?.auth_type === 'bearer'
+ ? 'Bearer Token'
+ : (tool.config as any)?.auth_type === 'api_key'
+ ? 'API Key'
+ : (tool.config as any)?.auth_type === 'basic'
+ ? 'Password'
+ : t('modals.configTool.apiKeyPlaceholder')
+ : t('modals.configTool.apiKeyPlaceholder')
+ }
/>
)}
@@ -450,6 +501,26 @@ export default function ToolConfig({
setModalState={(state) => setShowUnsavedModal(state === 'ACTIVE')}
submitLabel={t('settings.tools.saveAndLeave')}
handleSubmit={() => {
+ let configToSave;
+ if (tool.name === 'api_tool') {
+ configToSave = tool.config;
+ } else if (tool.name === 'mcp_tool') {
+ configToSave = { ...tool.config } as any;
+ const mcpConfig = tool.config as any;
+
+ if (authKey.trim()) {
+ if (mcpConfig.auth_type === 'api_key') {
+ configToSave.api_key = authKey;
+ } else if (mcpConfig.auth_type === 'bearer') {
+ configToSave.encrypted_token = authKey;
+ } else if (mcpConfig.auth_type === 'basic') {
+ configToSave.password = authKey;
+ }
+ }
+ } else {
+ configToSave = { token: authKey };
+ }
+
userService
.updateTool(
{
@@ -458,10 +529,7 @@ export default function ToolConfig({
displayName: tool.displayName,
customName: customName,
description: tool.description,
- config:
- tool.name === 'api_tool'
- ? tool.config
- : { token: authKey },
+ config: configToSave,
actions: 'actions' in tool ? tool.actions : [],
status: tool.status,
},
diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx
index fe675330..a6db7e56 100644
--- a/frontend/src/upload/Upload.tsx
+++ b/frontend/src/upload/Upload.tsx
@@ -4,8 +4,15 @@ import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import userService from '../api/services/userService';
-import { getSessionToken } from '../utils/providerUtils';
-
+import {
+ getSessionToken,
+ setSessionToken,
+ removeSessionToken,
+} from '../utils/providerUtils';
+import { formatDate } from '../utils/dateTimeUtils';
+import { formatBytes } from '../utils/stringUtils';
+import FileUpload from '../assets/file_upload.svg';
+import WebsiteCollect from '../assets/website_collect.svg';
import Dropdown from '../components/Dropdown';
import Input from '../components/Input';
import ToggleSwitch from '../components/ToggleSwitch';
@@ -377,7 +384,8 @@ function Upload({
data?.find(
(d: Doc) => d.type?.toLowerCase() === 'local',
),
- ));
+ ),
+ );
});
setProgress(
(progress) =>
diff --git a/frontend/src/utils/providerUtils.ts b/frontend/src/utils/providerUtils.ts
index b200928b..25236ad2 100644
--- a/frontend/src/utils/providerUtils.ts
+++ b/frontend/src/utils/providerUtils.ts
@@ -3,7 +3,6 @@
* Follows the convention: {provider}_session_token
*/
-
export const getSessionToken = (provider: string): string | null => {
return localStorage.getItem(`${provider}_session_token`);
};
@@ -14,4 +13,4 @@ export const setSessionToken = (provider: string, token: string): void => {
export const removeSessionToken = (provider: string): void => {
localStorage.removeItem(`${provider}_session_token`);
-};
\ No newline at end of file
+};