Skip to content

feat: #2807 support callable approval policies for local MCP servers#2818

Merged
seratch merged 1 commit into
mainfrom
feat/local-mcp-callable-approval
Apr 1, 2026
Merged

feat: #2807 support callable approval policies for local MCP servers#2818
seratch merged 1 commit into
mainfrom
feat/local-mcp-callable-approval

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Apr 1, 2026

This pull request adds first-class callable require_approval support for local MCP servers in the Python SDK. Local MCP integrations can now decide approval dynamically from (run_context, agent, tool) instead of being limited to static "always" / "never" policies, per-tool maps, or grouped tool-name lists.

The implementation extends the public MCP typing surface, preserves existing static approval behavior, and keeps the legacy fail-closed fallback for older MCPUtil.to_function_tool(...) call sites that do not provide an agent. It also exports the new callable type from agents.mcp, adds bridge-level and end-to-end tests for synchronous and asynchronous policies, and updates the MCP documentation with a concrete runtime-state example.

One behavior detail worth calling out is that callable approval policies are evaluated again when a paused run resumes after approval. That behavior already matches the runtime bridge and is now covered by tests and an explicit runtime probe.

Resolves #2807

@seratch seratch added this to the 0.13.x milestone Apr 1, 2026
@github-actions github-actions Bot added enhancement New feature or request feature:mcp labels Apr 1, 2026
@seratch seratch merged commit 976bcce into main Apr 1, 2026
9 checks passed
@seratch seratch deleted the feat/local-mcp-callable-approval branch April 1, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature:mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP: allow RequireApprovalSetting to accept a callable similar to ToolFilter.

1 participant