@@ -28,6 +28,7 @@ public class McpSettingsSection
2828 private Button clearUvxButton ;
2929 private VisualElement uvxPathStatus ;
3030 private TextField gitUrlOverride ;
31+ private Button browseGitUrlButton ;
3132 private Button clearGitUrlButton ;
3233 private TextField deploySourcePath ;
3334 private Button browseDeploySourceButton ;
@@ -76,6 +77,7 @@ private void CacheUIElements()
7677 clearUvxButton = Root . Q < Button > ( "clear-uv-button" ) ;
7778 uvxPathStatus = Root . Q < VisualElement > ( "uv-path-status" ) ;
7879 gitUrlOverride = Root . Q < TextField > ( "git-url-override" ) ;
80+ browseGitUrlButton = Root . Q < Button > ( "browse-git-url-button" ) ;
7981 clearGitUrlButton = Root . Q < Button > ( "clear-git-url-button" ) ;
8082 deploySourcePath = Root . Q < TextField > ( "deploy-source-path" ) ;
8183 browseDeploySourceButton = Root . Q < Button > ( "browse-deploy-source-button" ) ;
@@ -124,6 +126,8 @@ private void RegisterCallbacks()
124126 browseUvxButton . clicked += OnBrowseUvxClicked ;
125127 clearUvxButton . clicked += OnClearUvxClicked ;
126128
129+ browseGitUrlButton . clicked += OnBrowseGitUrlClicked ;
130+
127131 gitUrlOverride . RegisterValueChangedCallback ( evt =>
128132 {
129133 string url = evt . newValue ? . Trim ( ) ;
@@ -147,6 +151,25 @@ private void RegisterCallbacks()
147151 OnHttpServerCommandUpdateRequested ? . Invoke ( ) ;
148152 } ;
149153
154+ deploySourcePath . RegisterValueChangedCallback ( evt =>
155+ {
156+ string path = evt . newValue ? . Trim ( ) ;
157+ if ( string . IsNullOrEmpty ( path ) || path == "Not set" )
158+ {
159+ return ;
160+ }
161+
162+ try
163+ {
164+ MCPServiceLocator . Deployment . SetStoredSourcePath ( path ) ;
165+ }
166+ catch ( Exception ex )
167+ {
168+ EditorUtility . DisplayDialog ( "Invalid Source" , ex . Message , "OK" ) ;
169+ UpdateDeploymentSection ( ) ;
170+ }
171+ } ) ;
172+
150173 browseDeploySourceButton . clicked += OnBrowseDeploySourceClicked ;
151174 clearDeploySourceButton . clicked += OnClearDeploySourceClicked ;
152175 deployButton . clicked += OnDeployClicked ;
@@ -250,12 +273,25 @@ private void OnClearUvxClicked()
250273 McpLog . Info ( "uv path override cleared" ) ;
251274 }
252275
276+ private void OnBrowseGitUrlClicked ( )
277+ {
278+ string picked = EditorUtility . OpenFolderPanel ( "Select Server folder" , string . Empty , string . Empty ) ;
279+ if ( ! string . IsNullOrEmpty ( picked ) )
280+ {
281+ gitUrlOverride . value = picked ;
282+ EditorPrefs . SetString ( EditorPrefKeys . GitUrlOverride , picked ) ;
283+ OnGitUrlChanged ? . Invoke ( ) ;
284+ OnHttpServerCommandUpdateRequested ? . Invoke ( ) ;
285+ McpLog . Info ( $ "Server source override set to: { picked } ") ;
286+ }
287+ }
288+
253289 private void UpdateDeploymentSection ( )
254290 {
255291 var deployService = MCPServiceLocator . Deployment ;
256292
257293 string sourcePath = deployService . GetStoredSourcePath ( ) ;
258- deploySourcePath . value = string . IsNullOrEmpty ( sourcePath ) ? "Not set" : sourcePath ;
294+ deploySourcePath . value = sourcePath ?? string . Empty ;
259295
260296 deployTargetLabel . text = $ "Target: { deployService . GetTargetDisplayPath ( ) } ";
261297
0 commit comments