MCP over SSE
by kEND
This library provides a simple implementation of the Model Context Protocol (MCP) over Server-Sent Events (SSE). It allows you to easily integrate MCP functionality into your Phoenix or Plug applications.
Last updated: N/A
What is MCP over SSE?
MCP over SSE is a library that implements the Model Context Protocol using Server-Sent Events. It provides a way to build real-time communication between a server and client using the MCP standard.
How to use MCP over SSE?
The library can be installed in Phoenix or Plug applications. Configuration involves adding dependencies to mix.exs
, configuring the router, and setting up session management. Detailed installation steps for both Phoenix and Plug (Bandit) applications are provided in the README.
Key features of MCP over SSE
Full MCP server implementation
SSE connection management
JSON-RPC message handling
Tool registration and execution
Session management
Automatic ping/keepalive
Error handling and validation
Use cases of MCP over SSE
Integrating AI models with application context
Real-time updates from AI models
Building interactive AI-powered applications
Providing context-aware AI services
FAQ from MCP over SSE
What is MCP?
What is MCP?
The Model Context Protocol (MCP) is an open standard that defines how AI models communicate and share context with other applications and services. For more infromation visit https://modelcontextprotocol.io/introduction.
What is SSE?
What is SSE?
Server-Sent Events (SSE) is a server push technology enabling a server to automatically push data updates to a client over HTTP.
How do I configure the ping interval?
How do I configure the ping interval?
You can configure the ping interval using the :mcp_sse, :sse_keepalive_timeout
configuration option in your config/config.exs
file. The value is in milliseconds, or set :infinity
to disable pings.
How do I handle different content types in responses?
How do I handle different content types in responses?
You need to format your responses according to the MCP specification for content types (text, image, resource). The README provides examples of how to format text, image, and resource responses.
How do I manage session IDs?
How do I manage session IDs?
The library automatically manages session IDs. It uses an existing session ID from query parameters if provided or generates a new one if none exists. This ensures all requests to the /sse
and /message
endpoints have a valid session ID.