Skip to content
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

fix: MCP alpha "MCP error -32601: Method not found" + typo #2874

Merged
merged 4 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slick-moles-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mastra/mcp': patch
---

Fixed an error in the @mastra/mcp alpha release where client.setLoggingLevel led to errors in clients that don't support it
5 changes: 4 additions & 1 deletion packages/mcp/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,13 @@ export class MastraMCPClient extends MastraBase {
try {
await this.client.connect(this.transport);
this.isConnected = true;
const originalOnClose = this.client.onclose;
this.client.onclose = () => {
this.isConnected = false;
if (typeof originalOnClose === `function`) {
originalOnClose();
}
};
await this.client.setLoggingLevel(`critical`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the fix

asyncExitHook(
async () => {
this.logger.debug(`Disconnecting ${this.name} MCP server`);
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ To fix this you have three different options:
await mcpClient.connect();
} catch (e) {
this.mcpClientsById.delete(name);
this.logger.error(`MCPConfiguraiton errored connecting to MCP server ${name}`);
this.logger.error(`MCPConfiguration errored connecting to MCP server ${name}`);
throw e;
}

Expand Down
Loading