1- import React from 'react' ;
1+ import cls from 'classnames' ;
2+ import React , { useCallback } from 'react' ;
23
4+ import { Badge } from '@opensumi/ide-components' ;
35import { AINativeSettingSectionsId , ILogger , useInjectable } from '@opensumi/ide-core-browser' ;
46import { PreferenceService } from '@opensumi/ide-core-browser/lib/preferences' ;
7+ import { localize } from '@opensumi/ide-core-common' ;
58
69import { BUILTIN_MCP_SERVER_NAME } from '../../../../common' ;
710import { MCPServerDescription } from '../../../../common/mcp-server-manager' ;
@@ -17,6 +20,7 @@ interface MCPServer {
1720 tools ?: string [ ] ;
1821 command ?: string ;
1922 type ?: string ;
23+ serverHost ?: string ;
2024}
2125
2226export const MCPConfigView : React . FC = ( ) => {
@@ -54,7 +58,6 @@ export const MCPConfigView: React.FC = () => {
5458 // Update enabled state in preferences
5559 const servers = preferenceService . get < MCPServerDescription [ ] > ( AINativeSettingSectionsId . MCPServers , [ ] ) ;
5660 let updatedServers = servers ;
57-
5861 // 处理内置服务器的特殊情况
5962 if ( serverName === BUILTIN_MCP_SERVER_NAME ) {
6063 const builtinServerExists = servers . some ( ( server ) => server . name === BUILTIN_MCP_SERVER_NAME ) ;
@@ -133,6 +136,19 @@ export const MCPConfigView: React.FC = () => {
133136 await loadServers ( ) ;
134137 } ;
135138
139+ const getReadableServerType = useCallback ( ( type : string ) => {
140+ switch ( type ) {
141+ case MCP_SERVER_TYPE . STDIO :
142+ return localize ( 'ai.native.mcp.type.stdio' ) ;
143+ case MCP_SERVER_TYPE . SSE :
144+ return localize ( 'ai.native.mcp.type.sse' ) ;
145+ case MCP_SERVER_TYPE . BUILTIN :
146+ return localize ( 'ai.native.mcp.type.builtin' ) ;
147+ default :
148+ return type ;
149+ }
150+ } , [ ] ) ;
151+
136152 return (
137153 < div className = { styles . container } >
138154 < div className = { styles . header } >
@@ -152,19 +168,23 @@ export const MCPConfigView: React.FC = () => {
152168 < h3 className = { styles . serverName } > { server . name } </ h3 >
153169 </ div >
154170 < div className = { styles . serverActions } >
155- < button className = { styles . iconButton } title = 'Edit' onClick = { ( ) => handleEditServer ( server ) } >
156- < i className = 'codicon codicon-edit' />
157- </ button >
171+ { server . name !== BUILTIN_MCP_SERVER_NAME && (
172+ < button className = { styles . iconButton } title = 'Edit' onClick = { ( ) => handleEditServer ( server ) } >
173+ < i className = 'codicon codicon-edit' />
174+ </ button >
175+ ) }
158176 < button
159177 className = { styles . iconButton }
160178 title = { server . isStarted ? 'Stop' : 'Start' }
161179 onClick = { ( ) => handleServerControl ( server . name , ! server . isStarted ) }
162180 >
163181 < i className = { `codicon ${ server . isStarted ? 'codicon-debug-stop' : 'codicon-debug-start' } ` } />
164182 </ button >
165- < button className = { styles . iconButton } title = 'Delete' onClick = { ( ) => handleDeleteServer ( server . name ) } >
166- < i className = 'codicon codicon-trash' />
167- </ button >
183+ { server . name !== BUILTIN_MCP_SERVER_NAME && (
184+ < button className = { styles . iconButton } title = 'Delete' onClick = { ( ) => handleDeleteServer ( server . name ) } >
185+ < i className = 'codicon codicon-trash' />
186+ </ button >
187+ ) }
168188 </ div >
169189 </ div >
170190 < div className = { styles . serverDetail } >
@@ -177,7 +197,7 @@ export const MCPConfigView: React.FC = () => {
177197 { server . type && (
178198 < div className = { styles . detailRow } >
179199 < span className = { styles . detailLabel } > Type:</ span >
180- < span className = { styles . serverType } > { server . type } </ span >
200+ < Badge className = { styles . serverType } > { getReadableServerType ( server . type ) } </ Badge >
181201 </ div >
182202 ) }
183203 </ div >
@@ -203,6 +223,14 @@ export const MCPConfigView: React.FC = () => {
203223 </ div >
204224 </ div >
205225 ) }
226+ { server . serverHost && (
227+ < div className = { styles . serverDetail } >
228+ < div className = { styles . detailRow } >
229+ < span className = { styles . detailLabel } > Server Link:</ span >
230+ < span className = { cls ( styles . detailContent , styles . link ) } > { server . serverHost } </ span >
231+ </ div >
232+ </ div >
233+ ) }
206234 </ div >
207235 ) ) }
208236 </ div >
0 commit comments