Mastra推出实验性MCP事件功能
Mastra推出MCP events,使MCP服务器可通过推送、轮询或签名Webhook向连接的客户端发送事件。客户端可直接订阅,智能体和工作流也可响应事件;该功能要求@mastra/mcp 2.5.0及@mastra/core 1.79.0或更高版本,且API仍处于实验阶段。
Mastra表示,MCP events让客户端、智能体和工作流能够通过标准方式接收更新,无需额外部署发布订阅服务或自行构建轮询工具。
Your MCP server can now send events to connected clients using push, poll, or webhook delivery methods.
Agents and apps often need to act on changes that occur outside of conversations, like a failed deploy, merged pull request, new signup, or change in order status. MCP events give both ends of the pipe a standard way to .emit() and .subscribe() to events without the need for an additional pub/sub service.
Your browser does not support the video tag.
Before MCP events, MCP servers could only respond to requests. If connected clients needed updates, they'd need to poll the server, which often required additional tooling and added complexity. Now, building on Mastra's MCP 2.0 support, events can be used to make two-way communication easier to manage.
When observability is configured, MCP event traces are captured automatically.
Get started
In this example, GitHub sends a request to a webhook URL whenever repo activity occurs. The webhook URL is a custom Mastra API endpoint, which is used to emit events from a Mastra MCPServer. A desktop Electron app subscribes to the same events using the Mastra MCPClient.
#Mastra#Mastra MCP events#Mastra MCPServer#Mastra MCPClient#Mastra MCPEventsSignalProvider