Skip to content

Commit 1a2e602

Browse files
its-mashMohammod Al Amin Ashik
authored andcommitted
fix: drop the auto-mapped clientId binding when a client is deleted
delete_oauth_client now best-effort removes the id-binding keyed by the client_id, so deleting an API-key client doesn't leave an orphan "<client_id> -> Starter" mapping behind in the Mapping tab. No-op for DCR clients (they have no such binding). Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 6ca7753 commit 1a2e602

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • apps/desktop/src-tauri/src/commands

apps/desktop/src-tauri/src/commands/oauth.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,7 @@ pub async fn update_oauth_client(
901901
#[tauri::command]
902902
pub async fn delete_oauth_client(
903903
gateway_state: State<'_, Arc<RwLock<GatewayAppState>>>,
904+
app: State<'_, AppState>,
904905
client_id: String,
905906
) -> Result<(), String> {
906907
let app_state = gateway_state.read().await;
@@ -922,6 +923,23 @@ pub async fn delete_oauth_client(
922923

923924
info!("[OAuth] Deleted client: {}", client_id);
924925

926+
// Best-effort: remove the auto-mapped clientId id-binding so a deleted
927+
// client doesn't leave an orphan "<client_id> → Starter" mapping behind in
928+
// the Mapping tab. Only API-key clients have such a binding; for DCR
929+
// clients this is a no-op.
930+
if let Ok(Some(b)) = app
931+
.workspace_binding_repository
932+
.find_by_id_key(&client_id)
933+
.await
934+
{
935+
if let Err(e) = app.workspace_binding_repository.delete(&b.id).await {
936+
warn!(
937+
"[OAuth] failed to remove clientId mapping for {}: {}",
938+
client_id, e
939+
);
940+
}
941+
}
942+
925943
// Emit domain event
926944
state.emit_domain_event(mcpmux_core::DomainEvent::ClientDeleted { client_id });
927945

0 commit comments

Comments
 (0)