-
Notifications
You must be signed in to change notification settings - Fork 220
Refactor MCP server connection logic #313
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
base: main
Are you sure you want to change the base?
Conversation
Moved MCP server connection logic from the Agent's startup process to dedicated methods `connectMCPServers` and `disconnectMCPServers`. This improves code organization and allows explicit control over MCP server connections.
🦋 Changeset detectedLatest commit: e96edda The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
This LGTM. I can push up some changes changing the client demo to support this.
ok cool, I'll wait to land this until you make the client demo changes |
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 great!
sigh, this is going to be a serious breaking change, need a better way of messaging this before releasing... |
What about a migration guide? We could link it in Discord. |
64fb3f4
to
258b4af
Compare
Yeah.. I guess if we're going to make a breaking change to this interface, is there any other MCP breaking changes we'd want to bundle in with this? I don't think there are, but probably a good thing to consider |
Pushed some changes to:
|
packages/agents/src/mcp/client.ts
Outdated
console.log("connecting!"); | ||
console.log(id); | ||
|
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.
delete?
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.
Yup, just removed
258b4af
to
e96edda
Compare
|
||
@unstable_callable() | ||
async connectServers() { | ||
await this.connectMCPServers(); |
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.
Is there any situation where a user might want to connect only one or some set of servers rather than all that have been added?
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 thought about this and the answer is probably yes. But we could always add that as a option in the future
ok I thought this through and spoke to some folks, and it'll just break too many existing users. Instead I'm just going to mark it as deprecated and add a new method or two. (maybe registerMCPAServer) |
Moved MCP server connection logic from the Agent's startup process to dedicated methods
connectMCPServers
anddisconnectMCPServers
. This improves code organization and allows explicit control over MCP server connections.TODO: rewrite client demo //cc @cmsparks