genkit icon indicating copy to clipboard operation
genkit copied to clipboard

Add Roots support to the MCP client and server

Open gspencergoog opened this issue 7 months ago • 1 comments

Description

This adds roots support to the MCP client and server. It supports setting client roots when creating the client, but not modifying the roots once the client plugin is created. That will have to come later: changing the roots means that the available tools/prompts/resources might also change, and I didn't want to build dynamically changing tools because I wasn't clear on exactly how that was done. I did add support for the server to request the roots from the client (because some do that even if the roots don't change), which means that the client now registers handlers too.

Tests

  • I also added some basic configuration unit tests for the client and server (Despite being verbose, they don't actually test that much, just the setup).

gspencergoog avatar May 09 '25 22:05 gspencergoog

@mbleigh Here is the roots support PR I said I'd send your way. Let me know if it's what you were expecting.

I've tested the client against a server that supports roots, and it seems to work as expected. It should probably have some integration tests too, so that the client (and server) would be tested against a fake server (and client).

gspencergoog avatar May 09 '25 22:05 gspencergoog

@gspencergoog I know it's been forever on this -- we're in the middle of revamping the MCP plugin with a pretty big rewrite and this got caught in the middle. We're in the home stretch and I'm making sure roots support is added before we finish, so hopefully the long wait is over soon.

mbleigh avatar Jun 13 '25 15:06 mbleigh

Ahh, OK. Shall I just close this then?

gspencergoog avatar Jun 13 '25 15:06 gspencergoog

I'll close it out - #3074 adds roots to the new implementation 😄 but thank you!

mbleigh avatar Jun 13 '25 16:06 mbleigh