-
Notifications
You must be signed in to change notification settings - Fork 50
fix: Actorized MCP servers have 30 seconds timeout to connect #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Or, theoretically, we can start the session without these tools and add them after the MCP server is connected. But it will probably be a problem for clients without the tool update feature. |
Yes, but we can use the https://github.com/apify/mcp-client-capabilities package and for the clients that support tools changed notification we can load that dynamically and connect them instantly and for those who do not we can let them wait or time out the proxy MCP connection. |
@MichalKalita from my testing the LLM usually do not read the resources sadly, we could pass that in the initialize response |
This is actually a great improvement, I wanted to do it but never finished that 😅 |
Testing with:
direct connection works mcp-servers/brave-search-mcp-server ✅ cold start in 11s jiri.spilka/weather-mcp-server ❌ error 500 in 8s (direct connection works)
apify/actors-mcp-server ✅ |
There was simple bug, I fixed it.
|
Created issue for that https://github.com/apify/ai-team/issues/85 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nits/questions, otherwise LGTM
}); | ||
|
||
// Wait for all actors to be processed in parallel | ||
const actorToolsArrays = await Promise.all(actorToolPromises); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notice: for the most use cases it should be fine, but we should be aware of rate limits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find any rate limiting docs in the public docs on internal Notion. What type of limits do you mean?
|
||
try { | ||
client = await createMCPSSEClient(url, token); | ||
return client; | ||
} catch (error) { | ||
if (error instanceof TimeoutError) { | ||
log.warning('Connection to MCP server using SSE transport timed out', { url }); | ||
return null; | ||
} | ||
|
||
log.error('Failed to connect to MCP server using SSE transport', { cause: error }); | ||
throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit/question: Why is the try block here? We are just catching and then re-throwing. I would remove the try block for the SSE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I throw exception, connection will not be opened.
When TimeoutError occurs, only warning will be logged to us and connection will be opened, but without this MCP server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left only a few comments. Can you please re-consider the number of mcp-servers u use for testing?
@jirispilka I kept only a single MCP server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Fixes: #250
When the connection to the Actorized MCP server is not completed in 30 seconds, this MCP server silently fails and opens a user session without this Actorized MCP server.
Potential improvements:
getMCPServersAsTools
load all MCP servers in parallel