Summary
This issue tracks the integration of MCP (Model Context Protocol) tools with the Tool Confirmation Message Bus infrastructure being implemented in #7231. This represents an additional phase of work beyond the initial 3 PRs outlined in the parent issue.
Context
MCP tools currently have their own confirmation logic with static allowlists and callback-based confirmation handling. This needs to be migrated to use the new MessageBus/PolicyEngine infrastructure for consistency across all tool types.
Implementation Plan
1. Extend PolicyEngine for MCP-Specific Rules
- Add
mcpServerName and mcpToolName fields to PolicyRule interface
- Support matching rules by MCP server and/or specific tools within a server
- Enable server-level and tool-level "always allow" policies
2. Enhance Message Types for MCP Metadata
- Add optional
mcpMetadata field to ToolConfirmationRequest:
mcpMetadata?: {
serverName: string;
serverToolName: string;
displayName: string;
trust?: boolean;
}
3. Migrate MCP Tool Confirmation
- Modify
DiscoveredMCPToolInvocation.shouldConfirmExecute() to use MessageBus
- Convert static allowlist to dynamic PolicyEngine rules
- Bridge async messaging with existing synchronous interface using Promise/correlation pattern
4. Implement "Always Allow" as Policy Rules
- "Always Allow Server" → Add rule:
{ mcpServerName: 'server-name', decision: ALLOW }
- "Always Allow Tool" → Add rule:
{ mcpServerName: 'server', mcpToolName: 'tool', decision: ALLOW }
- Persist rules appropriately for user preferences
5. Handle Trust Contexts
- Integrate trusted folder checks into PolicyEngine evaluation
- Pass trust context through message metadata or PolicyEngineConfig
Dependencies
Acceptance Criteria
Related Issues
/cc @allenhutchison
Summary
This issue tracks the integration of MCP (Model Context Protocol) tools with the Tool Confirmation Message Bus infrastructure being implemented in #7231. This represents an additional phase of work beyond the initial 3 PRs outlined in the parent issue.
Context
MCP tools currently have their own confirmation logic with static allowlists and callback-based confirmation handling. This needs to be migrated to use the new MessageBus/PolicyEngine infrastructure for consistency across all tool types.
Implementation Plan
1. Extend PolicyEngine for MCP-Specific Rules
mcpServerNameandmcpToolNamefields toPolicyRuleinterface2. Enhance Message Types for MCP Metadata
mcpMetadatafield toToolConfirmationRequest:3. Migrate MCP Tool Confirmation
DiscoveredMCPToolInvocation.shouldConfirmExecute()to use MessageBus4. Implement "Always Allow" as Policy Rules
{ mcpServerName: 'server-name', decision: ALLOW }{ mcpServerName: 'server', mcpToolName: 'tool', decision: ALLOW }5. Handle Trust Contexts
Dependencies
Acceptance Criteria
Related Issues
/cc @allenhutchison