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'
Context
src/main.tscurrently runs as an Apify Actor (usingActor.init(),Actor.getInput(),Actor.isAtHome(), etc.). The HTTP server is mainly used for local dev/testing — production runs inapify-mcp-server-internal. We should replace it with a simple Express server and remove theapifySDK dependency entirely.Files to delete (9 files)
src/actor/server.tssrc/dev_server.tssrc/actor/utils.tsgetActorRunData()only used byactor/server.tssrc/actor/types.tsActorRunDatatype only used byactor/utils.tssrc/actor/const.tsactor/server.tssrc/actor/README.md.actor/actor.json.actor/input_schema.json.actor/ACTOR.md.actor/Dockerfileapify/actor-nodebase imageFiles to create (1 file)
src/dev_server.tsMove
src/actor/server.tshere, removing Actor-specific bits:getActorRunData()call from GET/routeHEADER_READINESS_PROBEcheck (Apify container probe)getHelpMessage(host)/ host parameter (hardcoded for Actor standby URL)actor/const.ts(Routes,TransportType)Files to modify (5 source files + 3 test files)
src/main.tsReplace with simple Express server:
createExpressAppfrom./dev_server.jsHOST/PORTfrom env vars (with defaults)APIFY_TOKEN, start server, handle SIGINTActor.*calls,apifyimport, debug mode,processInput/Inputimportssrc/apify_client.tsimport type { ApifyClientOptions } from 'apify'→from 'apify-client'src/utils/tools_loader.tsimport type { ApifyClient } from 'apify'→from 'apify-client'src/types.tsdebugActoranddebugActorInputfields fromInputtype (only used by old main.ts debug mode)package.json"apify": "^3.4.2"from dependenciesstart:standbyscript (removeAPIFY_META_ORIGIN="STANDBY")tests/unit/utils.tools_loader.test.tsimport { ApifyClient } from 'apify'→from 'apify-client'tests/integration/actor.server_sse.test.tsimport { createExpressApp } from '../../src/actor/server.js'→from '../../src/dev_server.js'tests/integration/actor.server_streamable.test.tsimport { createExpressApp } from '../../src/actor/server.js'→from '../../src/dev_server.js'