package com.github.catatafishen.agentbridge.custommcp;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.ProjectActivity;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import org.jetbrains.annotations.NotNull;

/**
 * Startup activity for the custom-MCP plugin variant.
 * Connects to all configured external MCP servers and registers their tools.
 * Runs on a background thread (standard {@link ProjectActivity} behaviour).
 */
public final class CustomMcpStartupActivity implements ProjectActivity {

    @NotNull
    @Override
    public Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) {
        if (com.github.catatafishen.agentbridge.psi.PlatformApiCompat.isJetBrainsClient()) {
            return Unit.INSTANCE;
        }
        CustomMcpRegistrar.getInstance(project).syncRegistrations();
        return Unit.INSTANCE;
    }
}
