Skip to content

fix(openapi): add MCP to RunOrigin enum#2752

Merged
vdusek merged 1 commit into
masterfrom
fix/openapi-runorigin-add-mcp
Jul 8, 2026
Merged

fix(openapi): add MCP to RunOrigin enum#2752
vdusek merged 1 commit into
masterfrom
fix/openapi-runorigin-add-mcp

Conversation

@vdusek

@vdusek vdusek commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What

Add MCP to the RunOrigin enum in the OpenAPI spec.

The Apify MCP server starts Actor runs with meta.origin: "MCP", but the spec's RunOrigin enum doesn't list that value. As a result, generated typed clients reject any such run during validation. apify-shared-js already includes MCP, so the spec is the last place still missing it.

Why

This is the root cause of apify/apify-sdk-python#1032. Every Python Actor invoked via the Apify MCP server crashes at startup, before user code runs, because the generated apify-client model validates meta.origin against a strict enum that has no MCP member.

Fixing the enum here propagates down the chain:

  • apify-client-python regenerates its models from this spec (docs.apify.com/api/openapi.json), so RunOrigin picks up MCP.
  • The Python SDK then accepts MCP-triggered runs once it uses the regenerated client.

Follows the same pattern as #2559, which added CI to the same enum.

🤖 Generated with Claude Code

@vdusek vdusek requested review from fnesveda and janbuchar as code owners July 8, 2026 12:29
@apify-service-account

apify-service-account commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🗑️ Preview for this PR was deleted.

@apify-service-account

Copy link
Copy Markdown
Contributor

Important

Action required@vdusek please coordinate this docs PR with the Python API client PR linked below.

Because this PR modifies the OpenAPI specification, the generated models in apify-client-python must be regenerated to stay in sync. This has already been done automatically:

A companion PR has been opened in apify-client-python with the regenerated models: apify/apify-client-python#929

  • Please make sure to review and merge both PRs together to keep the OpenAPI spec and API clients in sync.
  • You can ask for review and help from the Tooling team if needed.

vdusek pushed a commit to apify/apify-client-python that referenced this pull request Jul 8, 2026
- Updates the auto-generated Pydantic models and TypedDicts based on the proposed OpenAPI specification changes.
- Based on apify-docs PR [#2752](apify/apify-docs#2752).
@vdusek vdusek merged commit 79dcd05 into master Jul 8, 2026
17 checks passed
@vdusek vdusek deleted the fix/openapi-runorigin-add-mcp branch July 8, 2026 14:38
vdusek added a commit to apify/apify-shared-python that referenced this pull request Jul 8, 2026
Add the two `MetaOrigin` values the platform already emits but the
Python enum was missing, bringing it to parity with `apify-shared-js`:

- `MCP` — runs started through the Apify client triggered from the Apify
MCP server.
- `CI` — runs started from a CI/CD pipeline (e.g. GitHub Actions).

Without `MCP`, any Actor invoked via the Apify MCP server crashes at
startup: the released SDK line (`apify` 3.4.x) validates
`run.meta.origin` against `apify_shared.consts.MetaOrigin`, and an
unknown value raises a `pydantic.ValidationError` before user code runs.

Related: apify/apify-sdk-python#1032. The API OpenAPI spec is fixed in
parallel (apify/apify-docs#2752), which covers the SDK master line that
reads the enum from `apify-client` v3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants