Skip to content

feat: implement MCP Client #1503

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

longfin
Copy link

@longfin longfin commented Mar 12, 2025

This PR adds Model Context Protocol(MCP) client feature, to enable leveraging various MCP servers.

  • Due to the nature of web-based projects, I want to exclude stdio transport and only support SSE transport.
  • Set the SSE endpoint as an environment variable beginning with the MCP_SSE_ prefix.
  • I'm thinking about integrating the basic UI, but it would be better to handle them into other PR due to size.

Here are the details of this work I am thinking about.

  • Configuration
  • Toolset conversion
  • LLM integration (llmcall, chat, summary)
  • UI Integration
  • Disabling for unsupported models
  • Progress reporting
  • Abort handling

Since I don't fully understand this project and its tech stack, there may be some inappropriate technology use or approaches. so, if you see anything weird, please feel free to let me know!

@longfin longfin changed the title [WIP] Implement MCP Client feat: Implement MCP Client Mar 12, 2025
@longfin longfin changed the title feat: Implement MCP Client feat: implement MCP Client Mar 12, 2025
@longfin longfin force-pushed the feature/mcp-client branch 2 times, most recently from dfa77cd to dbf289d Compare March 17, 2025 15:52
@longfin longfin force-pushed the feature/mcp-client branch from dbf289d to af6b5bb Compare March 18, 2025 01:39
@longfin longfin marked this pull request as ready for review March 18, 2025 01:46
@longfin
Copy link
Author

longfin commented Mar 18, 2025

The intended works has been completed. While doing so, I wanted to add the Prompt feature, but it would be better be done in the next PR. 😅

@thecodacus Could you review this PR? 🙏

@xKevIsDev xKevIsDev requested a review from thecodacus March 18, 2025 11:27
@thecodacus
Copy link
Collaborator

I see this relies on function calling is function calling is the only way to do this.. if so We might need to have a way to indicate the user that. and have a fallback mechanism for models that does not support function calling, and disable tool call in such scenario

@longfin longfin marked this pull request as draft March 20, 2025 04:40
@longfin
Copy link
Author

longfin commented Mar 20, 2025

I see this relies on function calling is function calling is the only way to do this.. if so We might need to have a way to indicate the user that. and have a fallback mechanism for models that does not support function calling, and disable tool call in such scenario

Fair enough. I'll consider them and back to here after addressing. thanks!

@chrismahoney
Copy link
Collaborator

I've been poking at the server and client sides of MCP over the past couple of weeks, and am re-acquainting myself with the codebase after a very busy spell, but I'm happy to help bridge the gap between what MCP is (and isn't), and some misconceptions that might arise from MCP adoption via Bolt. Still learning about where I stand regarding the webapp interacting with MCP versus a native desktop app, even though Electron and web builds aren't extremely different.

Anyway, feel free to reach out and I'll monitor this thread if there's some way I can help with testing. Got more MCP tool "servers" over here than I know what to do with and my first thought was to augment Bolt with it.

@longfin
Copy link
Author

longfin commented Mar 21, 2025

In addition to the feedback I received, I am implementing missing features (progress monitoring, abort signal), and I think I will be able to implement the MCP client after I have sorted out the issues related to the abort signal first.

I will submit this as a separate PR in advance. (please let me know if there are already working on or preparing for the aborting signal 🙏 )

@longfin
Copy link
Author

longfin commented Mar 21, 2025

In addition to the feedback I received, I am implementing missing features (progress monitoring, abort signal), and I think I will be able to implement the MCP client after I have sorted out the issues related to the abort signal first.

I will submit this as a separate PR in advance. (please let me know if there are already working on or preparing for the aborting signal 🙏 )

Opened #1538

@longfin
Copy link
Author

longfin commented Mar 27, 2025

Update:

  • As many of you already know, MCP spec has been updated at Mar 26th. so I'm waiting for official SDK bump now.
  • Also, I changed my mind that it would be better to incorporate the configuration UI work that was originally postponed into this PR. This is because handling the MCP server settings with cookies will change when and how the client is initialized.
    • image
    • Feel free to let me know about configuration if you have any though or idea too. 🙏

@xKevIsDev
Copy link
Collaborator

This is some nice work. I would like to note that the AI-SDK has been since updated to support MCP might be worth taking a look in to for this.

@ReEnvisionAi
Copy link

Can we look at implementing this feature in the main branch - its very important!

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.

5 participants