You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Actor crashes at startup for runs with meta.origin="MCP" (MetaOrigin enum missing MCP, present in apify-shared-js) #1032
Any Python Actor invoked through the Apify MCP server crashes during startup, before any user code runs. The run's meta.origin is "MCP", but the MetaOrigin enum in apify-shared (Python) has no MCP member, so the SDK's charging manager fails to validate the run with a pydantic.ValidationError inside Actor.__aenter__.
Notably, apify-shared-js already includes MCP (and CI), so this looks like the Python apify-shared simply lagging behind the platform / JS SDK.
Environment
apify 3.4.1
apify-client 2.5.1
apify-shared 2.2.0
Python 3.12
Run started via the Apify MCP server (meta.origin == "MCP")
Minimal reproduction
fromapify_shared.constsimportMetaOriginMetaOrigin("MCP") # ValueError: 'MCP' is not a valid MetaOrigin
Real-world path: an MCP-triggered run reaches apify/_charging.py:
The fetched run has meta.origin == "MCP", which fails validation against ActorRun.meta.origin: MetaOrigin, raising during async with Actor:. The Actor exits with code 1 within a few seconds regardless of input.
apify-shared-jsMETA_ORIGINS (master): ... CLI, STANDBY, CI, MCP — includes MCP (commented "Job started through apify client triggered from apify-mcp-server") and CI.
Add the missing origins to MetaOrigin in apify-shared-python to match apify-shared-js:
classMetaOrigin(str, Enum):
...
CI='CI'MCP='MCP'
Optional hardening: make run-origin parsing forward-compatible so a newly added platform origin does not hard-crash older SDKs.
Impact
Every Python Actor invoked via the Apify MCP server is affected — the crash happens before user code, so Actors appear broken over MCP with no useful error surfaced to the caller.
Workaround (for affected Actor authors)
Register the value at runtime before importing apify:
Activity
vdusek commentedon Jul 8, 2026
Hi, thanks for reporting it. The fix is on the way.
apify/apify-docs#2752
apify/apify-client-python#929
apify/apify-shared-python#73
fix(openapi): add MCP to RunOrigin enum (#2752)
fix: add CI and MCP to MetaOrigin enum (#73)
vdusek commentedon Jul 8, 2026
This should be fixed in
apify-sharedv2.2.1. You can either regenerate your dependencies or add an explicit constraint.