
mcp sse
一个使用TypeScript SDK实现的极简无状态MCP协议服务器和客户端示例。
Repository Info
About This Server
一个使用TypeScript SDK实现的极简无状态MCP协议服务器和客户端示例。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Simple MCP Server Example
A minimal implementation of the Model Context Protocol (MCP) using the TypeScript SDK with a stateless HTTP server and client.
Overview
This example demonstrates:
- A stateless MCP server with a simple greeting tool
- A standard MCP client that connects and tests the server
- Production-ready architecture with no session management complexity
Key Features
✅ Stateless Mode - No session management required
✅ Production Ready - Works with multiple server instances
✅ No Sticky Sessions - Perfect for load balancers
✅ Standard MCP Protocol - Compatible with all MCP clients
Project Structure
src/
├── server.ts # Stateless MCP server with greeting tool
└── client.ts # Simple MCP client for testing
Prerequisites
- Node.js (v16 or higher)
- npm or pnpm
Installation
npm install
npm run build
Running the Example
Start the Server
npm run start:server
The server will start on http://localhost:3003/mcp
Test with Client
In another terminal:
npm run start:client
Available Tools
greet
Generate friendly greeting messages with different styles.
Parameters:
name(required): The name of the person to greetstyle(optional): greeting style -casual,formal, orenthusiastic
Examples:
- Casual: "Hi Alice! Nice to meet you. 👋"
- Formal: "Good day, Dr. Smith. I hope you are well."
- Enthusiastic: "Hey Bob! 🎉 Great to see you! Hope you're having an amazing day! ✨"
Development
# Development mode with auto-reload
npm run dev:server # Start server in dev mode
npm run dev:client # Run client in dev mode
# Build
npm run build
# Clean
npm run clean
Architecture
This implementation uses the stateless mode of StreamableHTTPServerTransport:
const transport = new StreamableHTTPServerTransport({
sessionIdGenerator: undefined, // Stateless mode
});
Benefits:
- Scalable: Works with multiple server instances
- Simple: No complex session management
- Reliable: No sticky session requirements
- Standard: Compatible with all MCP clients
How it Works:
- Each request creates a fresh transport and server instance
- No shared state between requests
- Clean isolation and automatic cleanup
- Perfect for containerized deployments
Based On
This implementation follows the official MCP TypeScript SDK patterns:
- MCP TypeScript SDK
- Stateless Server Example
License
MIT
Quick Start
Clone the repository
git clone https://github.com/mendywoly/mcp-sseInstall dependencies
cd mcp-sse
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.