Simple Streamable HTTP MCP Server

Simple Streamable HTTP MCP Server

A reference implementation demonstrating proper MCP server patterns with HTTP transport, featuring session management, progress notifications, and example tools for testing server functionality. Serves as a clean template for building MCP servers with streamable responses and comprehensive error handling.

Category
Visit Server

README

Simple Streamable HTTP MCP Server

A clean implementation of an MCP server using the Streamable HTTP transport, following the official MCP patterns.

Features

  • Streamable HTTP Transport: Supports both JSON responses and Server-Sent Events (SSE)
  • Session Management: Proper session handling with unique session IDs
  • Progress Notifications: Long-running tools send progress updates
  • Multiple Tools:
    • hello_world: Simple greeting tool
    • get_server_info: Returns server information
    • long_running_test: Configurable duration test with progress (default: 30s)
    • slow_test: 10-minute test with progress updates

Architecture

This server follows the MCP team's recommended patterns:

  1. Session-based Architecture: Each client gets a unique session ID
  2. Transport Reuse: Transports are stored and reused for subsequent requests
  3. Proper Initialization: New sessions are created only on initialization requests
  4. Clean Shutdown: All transports are properly closed on server shutdown

Running the Server

# Install dependencies
npm ci

# Run the server (default port: 3001, DEBUG logging enabled by default)
npm run start

# Run without debug logging, or edit `.env` to set DEBUG=false
DEBUG=false npm run start

# Run in development mode (auto-reload)
npm run dev

Testing

Use the provided test script to verify the server is working correctly:

npm run test:http

This will test:

  • Session initialization
  • Tool listing and calling
  • Session ID management
  • SSE streaming
  • Session termination

Progress Notifications

The long_running_test and slow_test tools demonstrate progress notifications:

// Example tool call with progress
{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "long_running_test",
    "arguments": {
      "duration": 60,
      "steps": 12,
      "message": "Testing progress notifications"
    },
    "_meta": {
      "progressToken": "unique-progress-token"
    }
  },
  "id": 1
}

The server will send progress notifications:

{
  "method": "notifications/progress",
  "params": {
    "progress": 1,
    "total": 12,
    "progressToken": "unique-progress-token"
  }
}

Key Differences from Basic Examples

  1. Proper Session Management: Sessions are created per client, not per request
  2. Transport Lifecycle: Transports persist across requests within a session
  3. Error Handling: Comprehensive error handling for all edge cases
  4. Progress Support: Long-running operations can report progress
  5. Clean Architecture: Clear separation between server creation and request handling

Environment Variables

  • PORT: Server port (default: 3001)
  • DEBUG: Enable debug logging (true by default)

Endpoints

  • POST /mcp: Handle JSON-RPC requests
  • GET /mcp: Handle SSE streaming
  • DELETE /mcp: Terminate sessions
  • GET /health: Health check endpoint

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured