Repository navigation
Add the Apify CLI and mcpc as a surface - #36
Open
RobertCrupa wants to merge 1 commit into
Open
RobertCrupa wants to merge 1 commit into
RobertCrupa wants to merge 1 commit into
Conversation
This was referenced Oct 16, 2026
RobertCrupa
added this pull request to stack #40
October 19, 2026 11:43
artogahr
requested changes
Oct 19, 2026
| const home = mkdtempSync(join(tmpdir(), 'eval-session-')); | ||
| try { | ||
| const shimDir = ctx.surface ? installCliShim(home, ctx.surface, ctx.runMarker) : undefined; | ||
| if (ctx.surface?.mcpcBinDir) await connectMcpc(home, ctx.surface, ctx.mcpUrl); |
Contributor
There was a problem hiding this comment.
This connects to the bare MCP URL, and surfaceItemMetadata sets tools: [] for the cli surface. So the cli agent sees the server's default tool set while the mcp agent sees the scenario's allowlist. An mcp vs cli comparison then compares two different setups. Either pass the item's tools into the connect URL or if not possibe we should probably document the difference?
Comment on lines
+295
to
+304
| export async function connectMcpc(sessionHome: string, surface: ResolvedSurface, mcpUrl: string): Promise<void> { | ||
| if (!surface.mcpcBinDir) return; | ||
| const token = surface.env.APIFY_TOKEN; | ||
| if (!token) throw new Error(`surface "${surface.name}": mcpc needs APIFY_TOKEN in the surface env`); | ||
| await execFile( | ||
| join(sessionHome, 'bin', 'mcpc'), | ||
| ['connect', mcpUrl, MCPC_SESSION, '--header', `Authorization: Bearer ${token}`], | ||
| { timeout: 60_000, env: { PATH: process.env.PATH, HOME: sessionHome } }, | ||
| ); | ||
| } |
Contributor
There was a problem hiding this comment.
If this connect call fails once, the whole session fails and is counted as not completed. On the mcp surface the session is retried when the MCP server doesn't answer at startup. Can we retry here too?
The `cli` surface gives the agent the Apify CLI and mcpc in Bash, with no MCP tools of its own. - The image pins apify-cli 1.10.0 and @apify/mcpc 0.7.0 off PATH; `cliVersion` and `mcpcVersion` install another build at run time. - Each session gets its own wrappers: the CLI logged in once per run with file credentials, mcpc connected to the Apify MCP server as @apify and closed after. Neither reads the developer's login or Keychain, and a surface without them hides any on PATH. - A Node preload marks the CLI's API requests with the session marker, so `apify call -s` runs are found. Evidence reads run ids and dataset ids from mcpc output and arguments. - Preflight checks `apify info` and an mcpc connect.
RobertCrupa
force-pushed
the
stack/4-cli-surface
branch
from
October 20, 2026 09:05
16891d5 to
47e1bd3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack 4 of 4, on top of #35.
The
clisurface gives the agent the Apify CLI and mcpc in Bash. The agent has no MCP tools of its own.What changes
apify-cli1.10.0 and@apify/mcpc0.7.0, off PATH. ThecliVersionandmcpcVersioninputs install another build at run time.APIFY_TOKEN. mcpc connects to the Apify MCP server as@apifybefore the agent starts, and closes after. Neither reads the developer's login or Keychain. On a surface without them, the wrappers also hide anyapifyormcpcthat is on PATH.apify call -sruns, which print no run id.apify infoand an mcpc connect.Tests: workflow-runner 108 (14 new for the CLI surface).