Skip to content

Conversation

@MQ37
Copy link
Contributor

@MQ37 MQ37 commented Dec 24, 2025

This solves the issue with missing session id when the stdio server is executed through npx. Instead of putting the custom props into the params in request we use the _meta fields. The issue seems that for some reason the npx uses a newer version of SDK that seems to strip the request for custom params, I was able to replicate the error but could not really confirm the root cause.

…patibility

- Move mcpSessionId, apifyToken, and userRentedActorIds into params._meta object
- Newer MCP SDK versions filter out unknown top-level parameters, so _meta is used as standard container
- Add ApifyRequestParams type definition for proper typing of _meta structure
- Update parameter extraction in tool handlers and task handlers to read from _meta
- Refactor parameter injection to use nullish coalescing assignment (??=) for clarity
- Allow _meta underscore in ESLint config as standard MCP protocol field
- Remove unnecessary parameter deletion after extraction since they're now in _meta
- Enable MCP Session ID error throwing since injection is now guaranteed

FIXES: Parameters being stripped by newer MCP SDK versions causing task store errors
@github-actions github-actions bot added the t-ai Issues owned by the AI team. label Dec 24, 2025
@MQ37 MQ37 added the beta Create beta prereleases label Dec 24, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 24, 2025

Open in StackBlitz

npm i https://pkg.pr.new/apify/apify-mcp-server/@apify/actors-mcp-server@379

commit: 24934f9

@MQ37 MQ37 requested a review from jirispilka December 24, 2025 13:07
Copy link
Collaborator

@jirispilka jirispilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I wouldn't expect that a newer version of MCP would stip the extra params. I hope this is going to work 🤞🏻

Thanks!

@MQ37 MQ37 merged commit 6329c4c into master Jan 5, 2026
6 checks passed
@MQ37 MQ37 deleted the fix-mcp-request-params branch January 5, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta Create beta prereleases t-ai Issues owned by the AI team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants