Skip to content

Remove Apify Actor SDK dependency, simplify server entry point #526

@jirispilka

Description

@jirispilka

Context

src/main.ts currently runs as an Apify Actor (using Actor.init(), Actor.getInput(), Actor.isAtHome(), etc.). The HTTP server is mainly used for local dev/testing — production runs in apify-mcp-server-internal. We should replace it with a simple Express server and remove the apify SDK dependency entirely.

Files to delete (9 files)

File Reason
src/actor/server.ts Moved to src/dev_server.ts
src/actor/utils.ts getActorRunData() only used by actor/server.ts
src/actor/types.ts ActorRunData type only used by actor/utils.ts
src/actor/const.ts Constants only used by actor/server.ts
src/actor/README.md Documents deleted Actor code
.actor/actor.json Apify Actor manifest
.actor/input_schema.json Apify console input schema
.actor/ACTOR.md Apify Store documentation
.actor/Dockerfile Uses apify/actor-node base image

Files to create (1 file)

src/dev_server.ts

Move src/actor/server.ts here, removing Actor-specific bits:

  • Remove getActorRunData() call from GET / route
  • Remove HEADER_READINESS_PROBE check (Apify container probe)
  • Remove getHelpMessage(host) / host parameter (hardcoded for Actor standby URL)
  • Keep all MCP transport logic (SSE, Streamable HTTP, session management)
  • Inline needed constants from actor/const.ts (Routes, TransportType)

Files to modify (5 source files + 3 test files)

src/main.ts

Replace with simple Express server:

  • Import createExpressApp from ./dev_server.js
  • Read HOST/PORT from env vars (with defaults)
  • Check APIFY_TOKEN, start server, handle SIGINT
  • Remove all Actor.* calls, apify import, debug mode, processInput/Input imports

src/apify_client.ts

  • import type { ApifyClientOptions } from 'apify'from 'apify-client'

src/utils/tools_loader.ts

  • import type { ApifyClient } from 'apify'from 'apify-client'

src/types.ts

  • Remove debugActor and debugActorInput fields from Input type (only used by old main.ts debug mode)

package.json

  • Remove "apify": "^3.4.2" from dependencies
  • Clean up start:standby script (remove APIFY_META_ORIGIN="STANDBY")

tests/unit/utils.tools_loader.test.ts

  • import { ApifyClient } from 'apify'from 'apify-client'

tests/integration/actor.server_sse.test.ts

  • import { createExpressApp } from '../../src/actor/server.js'from '../../src/dev_server.js'

tests/integration/actor.server_streamable.test.ts

  • import { createExpressApp } from '../../src/actor/server.js'from '../../src/dev_server.js'

Metadata

Metadata

Assignees

Labels

low priorityLow priority issues to be done eventually.t-aiIssues owned by the AI team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions