Skip to content

Release MCP eventsource plugin, and make a video (how to create) #193

@sakshiarora386

Description

@sakshiarora386

The Problem

Currently, there is no Godspeed-compatible plugin to consume events from the Model Context Protocol (MCP) standard using StdioServerTransport. This limits integration of tools or resources that emit/receive events via MCP into a Godspeed system.

The Solution

Introduce an @godspeedsystems/mcp-as-eventsource plugin that allows tools, prompts, and resource-style URIs to be consumed as valid Godspeed events. The plugin wraps the MCP Server and supports event validation and transformation into GSCloudEvent, allowing seamless processing through existing Godspeed functions and workflows.

What this does not do ?

  1. Bi-Directional Communication or Streaming Support
    Although the MCP protocol can support more advanced bidirectional interactions, this plugin currently only supports one-way event handling—from the MCP client to Godspeed. It does not handle real-time streaming, acknowledgments, or state synchronization beyond replying to the received message.

  2. Multi-Transport Support
    Only StdioServerTransport is supported for now. Other MCP transports like WebSocket, HTTP, or file-based streams are out of scope for this release.

How will we solve

1 . Implement EventSource class extending GSEventSource, wrapping the McpServer with StdioServerTransport.
2 . Define subscribeToEvent for handling three event types:

  • tool: Uses schema-defined params to process via server.tool.
  • resource: URI-based events handled via server.resource.
  • prompt: Chat-style events handled via server.prompt.

3 . Convert event config’s params and body to Zod schemas for validation.
4 . Transform incoming MCP payloads into GSCloudEvent and dispatch to processEvent.
5 . Lazy connect the MCP server using a timeout (debounced) on first event registration.

Any Special Considerations or Assumptions

  • Assumes MCP clients will connect over stdio transport.
  • Relies on correct and complete event schema definitions (params, body, uriTemplate).
  • zod is used for type validation – plugin consumer must ensure event schemas align with it.

Impact Areas

  • A new plugin (mcp-as-eventsource) will be added under the @godspeedsystems/plugins namespace.
  • Appears in the CLI plugin selection flow (godspeed plugin add) under EventSources.
  • May require new test harnesses or manual testing strategies since MCP uses stdio rather than HTTP or WebSocket.

Test Cases

  • Trigger a tool-type event with correct query parameters or body, validate schema match and successful processing.
  • Trigger a resource-type event with uriTemplate, assert correct path param extraction and event processing.
  • Trigger a prompt-type event with nested object body, validate formatting of reply messages.
  • Verify fallback and error cases: uninitialized server, invalid schemas, and malformed events.

Future Improvements

  1. Extend support for other MCP transport layers, such as:
    • WebSocketServerTransport for browser or real-time integrations.
    • HttpServerTransport for web API compatibility.
    • FileTransport or MemoryTransport for testing and embedded use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions