genkit icon indicating copy to clipboard operation
genkit copied to clipboard

feat(js/plugins/mcp): Refactor to a client manager structure, with dynamic tool calling.

Open ssbushi opened this issue 8 months ago • 3 comments

  • Modified the current McpClient class to a Client manager class
  • GenkitMcpClient is now a dedicated single client-server connection.
  • Tools are now fetched dynamically to support adding/removing/disabling clients in the manager.

ssbushi avatar May 07 '25 19:05 ssbushi

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar May 07 '25 19:05 google-cla[bot]

Oh also I think we should put this work into a launch branch - I created launch/mcp-redux and made #2896 to squash my own work and create a chain of commits. Can you rebase onto the launch/mcp-redux as your merge target?

mbleigh avatar May 10 '25 16:05 mbleigh

One more high-level piece of food for thought: in the client manager context, I think we probably want to be very robust to misconfiguration errors. It's possible people will use this for dynamic, user-configured tools and when that happens we should recover gracefully as best we can.

So maybe in the client manager there should be an {error?: {message, status, details}} and if there's an error trying to connect to the server it is put in a disabled state, an error-level log is emitted, and the error is also saved with the server.

I'll work on this in a new commit, updating the PR to reflect the changes so far.

ssbushi avatar May 13 '25 19:05 ssbushi