This project provides a sample implementation of Server-Sent Events (SSE) for the MCP Server. It demonstrates how to use SSE with the MCP protocol, offering a practical example for developers. The project includes various tools and components to showcase the capabilities of SSE in real-time communication.
message (string): Message to echo back.Returns: Text content with echoed message.
Add
a (number): First number, b (number): Second number.Returns: Text result of the addition.
Long Running Operation
duration (number, default: 10): Duration in seconds, steps (number, default: 5): Number of progress steps.Sends: Progress notifications during execution.
Sample LLM
prompt (string): The prompt to send to the LLM, maxTokens (number, default: 100): Maximum tokens to generate.Returns: Generated LLM response.
Get Tiny Image
Returns: Base64 encoded PNG image data.
Print Env
Returns: JSON string of all environment variables.
Annotated Message
messageType (enum: "error" | "success" | "debug"): Type of message to demonstrate different annotation patterns, includeImage (boolean, default: false): Whether to include an example image.The server sends random-leveled log messages every 15 seconds, e.g.:
{
"method": "notifications/message",
"params": {
"level": "info",
"data": "Info-level message"
}
}
# Install dependencies
npm install
# Build the project
npm run build
# Run in STDIO mode
npm run start
# Run in SSE mode
npm run start:sse
Add the following to claude_desktop_config.json:
{
"mcpServers": {
"sse-sample": {
"command": "npx",
"args": [
"-y",
"mcp_sse_sample"
]
}
}
}
This project is a sample implementation of SSE for the MCP Server, designed to help developers understand and utilize SSE in their MCP-based applications.