Skip to content

Conversation

@nimishamehta5
Copy link
Contributor

There is likely an issue with the default ctx that gets passed into tool calls by the mark3labs/mcp-go library, which passes in a ctx with a timeout of 0s.
This leads to errors like this during calls to the k8s apiserver:

2025/05/07 21:36:07 Context error while listing resources: context canceled
2025/05/07 21:36:07 Rate limiter error: client rate limiter Wait returned an error: context canceled

To fix this, we add middleware to the server which injects a custom ctx with a longer timeout (default 30s).
This bypasses the "context canceled" issues!

Signed-off-by: Nimisha Mehta <nimishamehta5@gmail.com>
@JAORMX JAORMX merged commit 9562010 into StacklokLabs:main May 9, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants