From c0ddfefd2aedb8691579f31e9c6777a14ad427ff Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Thu, 26 Jun 2025 15:16:45 -0700 Subject: [PATCH] make sure types are all right --- client/src/common/types.ts | 12 +++++++++++- .../SidePanel/Agents/AgentMCPFormPanel.tsx | 4 ++-- client/src/components/SidePanel/MCP/MCPFormPanel.tsx | 5 +++-- client/src/components/SidePanel/MCP/MCPInput.tsx | 6 +++--- client/src/components/SidePanel/MCP/MCPPanel.tsx | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/client/src/common/types.ts b/client/src/common/types.ts index 214dc349b5..a29af7f143 100644 --- a/client/src/common/types.ts +++ b/client/src/common/types.ts @@ -167,13 +167,23 @@ export type ActionAuthForm = { token_exchange_method: t.TokenExchangeMethodEnum; }; -export type MCPForm = ActionAuthForm & { +export type MCPAuthForm = { + customHeaders?: Array<{ + id: string; + name: string; + value: string; + }>; +}; + +export type MCPForm = MCPAuthForm & { name?: string; description?: string; url?: string; tools?: string[]; icon?: string; trust?: boolean; + requestTimeout?: number; + connectionTimeout?: number; }; export type ActionWithNullableMetadata = Omit & { diff --git a/client/src/components/SidePanel/Agents/AgentMCPFormPanel.tsx b/client/src/components/SidePanel/Agents/AgentMCPFormPanel.tsx index d5a28f3c11..282dbe9c2a 100644 --- a/client/src/components/SidePanel/Agents/AgentMCPFormPanel.tsx +++ b/client/src/components/SidePanel/Agents/AgentMCPFormPanel.tsx @@ -1,8 +1,8 @@ +import type { MCP } from 'librechat-data-provider'; import { useAgentPanelContext } from '~/Providers/AgentPanelContext'; import { useToastContext } from '~/Providers'; import { useLocalize } from '~/hooks'; import { Panel } from '~/common'; -import type { MCP } from '~/common'; import MCPFormPanel from '../MCP/MCPFormPanel'; // TODO: Add MCP delete (for now mocked for ui) @@ -101,7 +101,7 @@ export default function AgentMCPFormPanel() { return ( void; diff --git a/client/src/components/SidePanel/MCP/MCPInput.tsx b/client/src/components/SidePanel/MCP/MCPInput.tsx index de3e48eab7..0a4f3bd20d 100644 --- a/client/src/components/SidePanel/MCP/MCPInput.tsx +++ b/client/src/components/SidePanel/MCP/MCPInput.tsx @@ -15,7 +15,7 @@ interface MCPInputProps { isLoading?: boolean; } -export default function MCPInput({ mcp, a, onSave, isLoading = false }: MCPInputProps) { +export default function MCPInput({ mcp, agent_id, onSave, isLoading = false }: MCPInputProps) { const localize = useLocalize(); const { handleSubmit, @@ -37,7 +37,7 @@ export default function MCPInput({ mcp, a, onSave, isLoading = false }: MCPInput const saveMCP = handleSubmit(async (data: MCPForm) => { const updatedMCP: MCP = { mcp_id: mcp?.mcp_id ?? '', - agent_id: a ?? '', // This will be agent_id, conversation_id, etc. + agent_id: agent_id ?? '', metadata: { ...data, tools: selectedTools, @@ -78,7 +78,7 @@ export default function MCPInput({ mcp, a, onSave, isLoading = false }: MCPInput const base64String = reader.result as string; const updatedMCP: MCP = { mcp_id: mcp?.mcp_id ?? '', - agent_id: a ?? '', + agent_id: agent_id ?? '', metadata: { ...mcp?.metadata, icon: base64String, diff --git a/client/src/components/SidePanel/MCP/MCPPanel.tsx b/client/src/components/SidePanel/MCP/MCPPanel.tsx index 5ec168af9e..d4f46e61bd 100644 --- a/client/src/components/SidePanel/MCP/MCPPanel.tsx +++ b/client/src/components/SidePanel/MCP/MCPPanel.tsx @@ -4,13 +4,13 @@ import { Constants } from 'librechat-data-provider'; import { useForm, Controller } from 'react-hook-form'; import { useUpdateUserPluginsMutation } from 'librechat-data-provider/react-query'; import type { TUpdateUserPlugins } from 'librechat-data-provider'; +import type { MCP } from 'librechat-data-provider'; import { Button, Input, Label } from '~/components/ui'; import { useGetStartupConfig } from '~/data-provider'; import MCPPanelSkeleton from './MCPPanelSkeleton'; import { useToastContext } from '~/Providers'; import { useLocalize } from '~/hooks'; import MCPFormPanel from './MCPFormPanel'; -import type { MCP } from '~/common'; interface ServerConfigWithVars { serverName: string;