IJAI-69 enable agent-managed session folders

Unify Pi and private MCP integrations behind one session-folder dispatcher so supported agents share the same operation contract without exposing a growing tool list.

Scope controls to explicit user launch consent or active folder membership, keep consent in backend one-shot capabilities, and rebind pending runtime authorization when providers publish their real session IDs. Destructive operations require interactive confirmation, and the user workflow and safety boundary are documented in a dedicated guide.

(cherry picked from commit 5d01bc024bd040aee07cf23fbff0f6ac9b39a4e6)

GitOrigin-RevId: c1866d2f0c27e39b1961bcdddb392a729113e0fc
This commit is contained in:
Vladimir Krivosheev
2026-07-19 13:53:23 +00:00
committed by intellij-monorepo-bot
parent a35752f66e
commit c632aa3a19
@@ -82,6 +82,19 @@ open class McpServerService(val cs: CoroutineScope) {
val localAgentId: String? = null,
val invocationMode: McpSessionInvocationMode? = null,
) {
var elicitationKind: McpElicitationKind? = null
private set
constructor(
commandExecutionMode: AskCommandExecutionMode,
toolFilter: McpToolFilter?,
localAgentId: String?,
invocationMode: McpSessionInvocationMode?,
elicitationKind: McpElicitationKind?,
) : this(commandExecutionMode, toolFilter, localAgentId, invocationMode) {
this.elicitationKind = elicitationKind
}
@Deprecated("ABI compat with 261.22158 that doesn't have `localAgentId`", level = DeprecationLevel.HIDDEN)
constructor(
commandExecutionMode: AskCommandExecutionMode,
@@ -348,7 +361,13 @@ open class McpServerService(val cs: CoroutineScope) {
val useFiltersFromEP = allowedToolsFromHeader.isNullOrEmpty()
// if no header provided, use the existing filter from sessionOptions
val sessionOptions = if (headerFilter != null) {
McpSessionOptions(baseSessionOptions.commandExecutionMode, headerFilter, baseSessionOptions.localAgentId)
McpSessionOptions(
commandExecutionMode = baseSessionOptions.commandExecutionMode,
toolFilter = headerFilter,
localAgentId = baseSessionOptions.localAgentId,
invocationMode = baseSessionOptions.invocationMode,
elicitationKind = baseSessionOptions.elicitationKind,
)
} else {
baseSessionOptions
}
@@ -383,7 +402,7 @@ open class McpServerService(val cs: CoroutineScope) {
mcpServer = mcpServer,
transportType = transportType,
projectPathFromInitialRequest = projectPath,
elicitationKind = elicitationKind,
elicitationKind = sessionOptions.elicitationKind ?: elicitationKind,
useFiltersFromEP = useFiltersFromEP,
)
// Process initial tools immediately to fix race condition