@@ -23,15 +23,24 @@ import { Translator } from 'components/i18n';
2323interface McpAddFormProps {
2424 onSuccess : ( ) => void ;
2525 onCancel : ( ) => void ;
26+ allowStdio ?: boolean ;
27+ allowSse ?: boolean ;
2628}
2729
28- export const McpAddForm = ( { onSuccess, onCancel } : McpAddFormProps ) => {
30+ export const McpAddForm = ( {
31+ onSuccess,
32+ onCancel,
33+ allowStdio,
34+ allowSse
35+ } : McpAddFormProps ) => {
2936 const apiClient = useContext ( ChainlitContext ) ;
3037 const sessionId = useRecoilValue ( sessionIdState ) ;
3138 const setMcps = useSetRecoilState ( mcpState ) ;
3239
3340 const [ serverName , setServerName ] = useState ( '' ) ;
34- const [ serverType , setServerType ] = useState < 'stdio' | 'sse' > ( 'stdio' ) ;
41+ const [ serverType , setServerType ] = useState < 'stdio' | 'sse' > (
42+ allowStdio ? 'stdio' : 'sse'
43+ ) ;
3544 const [ serverUrl , setServerUrl ] = useState ( '' ) ;
3645 const [ serverCommand , setServerCommand ] = useState ( '' ) ;
3746 const [ isLoading , setIsLoading ] = useState ( false ) ;
@@ -131,8 +140,10 @@ export const McpAddForm = ({ onSuccess, onCancel }: McpAddFormProps) => {
131140 < SelectValue placeholder = "Type" />
132141 </ SelectTrigger >
133142 < SelectContent >
134- < SelectItem value = "sse" > sse</ SelectItem >
135- < SelectItem value = "stdio" > stdio</ SelectItem >
143+ { allowSse ? < SelectItem value = "sse" > sse</ SelectItem > : null }
144+ { allowStdio ? (
145+ < SelectItem value = "stdio" > stdio</ SelectItem >
146+ ) : null }
136147 </ SelectContent >
137148 </ Select >
138149 </ div >
0 commit comments