mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
feat: add /mcps/add route for deep linking MCP server creation
This commit is contained in:
parent
bda5f1c118
commit
180c023af9
2 changed files with 29 additions and 0 deletions
24
client/src/routes/MCPAddRedirect.tsx
Normal file
24
client/src/routes/MCPAddRedirect.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { useEffect } from 'react';
|
||||
import { useSearchParams, useNavigate } from 'react-router-dom';
|
||||
|
||||
const MCP_NAME_PARAM = 'name';
|
||||
const MCP_URL_PARAM = 'url';
|
||||
const MCP_TRANSPORT_PARAM = 'transport';
|
||||
|
||||
export default function MCPAddRedirect() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
const mcpName = searchParams.get(MCP_NAME_PARAM) ?? undefined;
|
||||
const mcpUrl = searchParams.get(MCP_URL_PARAM) ?? undefined;
|
||||
const mcpTransport = searchParams.get(MCP_TRANSPORT_PARAM) ?? undefined;
|
||||
|
||||
navigate('/c/new', {
|
||||
replace: true,
|
||||
state: { mcpName, mcpUrl, mcpTransport },
|
||||
});
|
||||
}, [searchParams, navigate]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ import RouteErrorBoundary from './RouteErrorBoundary';
|
|||
import StartupLayout from './Layouts/Startup';
|
||||
import LoginLayout from './Layouts/Login';
|
||||
import dashboardRoutes from './Dashboard';
|
||||
import MCPAddRedirect from './MCPAddRedirect';
|
||||
import ShareRoute from './ShareRoute';
|
||||
import ChatRoute from './ChatRoute';
|
||||
import Search from './Search';
|
||||
|
|
@ -107,6 +108,10 @@ export const router = createBrowserRouter(
|
|||
path: 'c/:conversationId?',
|
||||
element: <ChatRoute />,
|
||||
},
|
||||
{
|
||||
path: 'mcps/add',
|
||||
element: <MCPAddRedirect />,
|
||||
},
|
||||
{
|
||||
path: 'search',
|
||||
element: <Search />,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue