-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
feature:mcpneeds-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the author
Description
Describe the bug
When connecting to MCP servers that send vendor-prefixed notification types (e.g., Codex CLI's codex/event), the SDK logs 20+ Pydantic validation warnings per notification to stderr:
WARNING:root:Failed to validate notification: 20 validation errors for ServerNotification
CancelledNotification.method
Input should be 'notifications/cancelled' [type=literal_error, input_value='codex/event', input_type=str]
...
The MCP spec allows vendor-prefixed methods, and Codex MCP server intentionally emits these events for progress reporting. The SDK should handle unknown notification types gracefully.
See also: openai/codex#4223
Debug information
- Agents SDK version: 0.6.1
- Python version: 3.12
Repro steps
from agents.mcp import MCPServerStdio
server = MCPServerStdio(
name="codex",
params={"command": "codex", "args": ["mcp-server"]},
)
async with server:
# codex/event notifications spam stderr with validation warnings
passExpected behavior
Unknown/vendor-prefixed notification types should be silently ignored or exposed via an optional callback.
Workaround
import logging
class MCPNotificationFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
if "Failed to validate notification" in record.getMessage():
return False
return True
logging.getLogger().addFilter(MCPNotificationFilter())Metadata
Metadata
Assignees
Labels
feature:mcpneeds-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the author