MCP.so
Sign In
Servers

Starlette MCP SSE

@panz2018

A working example to create a starlette server with SSE-based MCP support

Overview

What is Starlette MCP SSE?

It is a Server-Sent Events (SSE) implementation using the Starlette framework with Model Context Protocol (MCP) integration. The project demonstrates how to add MCP SSE endpoints to a Starlette web application while keeping standard web routes separate.

How to use Starlette MCP SSE?

You can run the server without cloning via uvx --from git+https://github.com/panz2018/starlette_mcp_sse.git start, or install fully with uv venv, activate it, install dependencies with uv pip install -r pyproject.toml, then start with python src/server.py or uv run start. After startup, the SSE endpoint is at /sse and message endpoint at /messages/. Debug using MCP Inspector with the mcp dev ./src/weather.py command and connect at http://localhost:8000/sse.

Key features of Starlette MCP SSE

  • Server-Sent Events (SSE) implementation with MCP
  • Starlette framework integration with custom routes
  • Unified web application with both MCP and standard web endpoints
  • Customizable route structure
  • Clean separation of concerns between MCP and web functionality

Use cases of Starlette MCP SSE

  • Building AI assistants that need real‑time data via SSE
  • Integrating MCP tools into an existing Starlette web app
  • Debugging MCP functionality with the MCP Inspector
  • Extending a web application with custom routes while maintaining MCP endpoints
  • Connecting AI coding tools like Continue to MCP‑enabled weather services

FAQ from Starlette MCP SSE

What is the Model Context Protocol (MCP)?

MCP is an open standard that lets AI models interact with external tools and data sources, solving context limitations, tool integration, interoperability, and extensibility challenges.

What are the prerequisites for running Starlette MCP SSE?

You need the UV Package Manager installed. The recommended install command is: powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex".

What endpoints are available after starting the server?

Standard web routes: /, /about, /status, /docs. MCP SSE endpoints: /sse (SSE stream) and /messages/ (message posting). The main server runs on http://localhost:8000.

How can I debug the MCP functionality?

Use the MCP Inspector by running mcp dev ./src/weather.py, open http://localhost:5173, set Transport Type to SSE, enter URL http://localhost:8000/sse, and click Connect. Then list and test tools like get_alerts and get_forcast.

How do I integrate this server with the Continue VS Code extension?

Add the following JSON to your Continue settings under experimental.modelContextProtocolServers: {"transport":{"name":"weather","type":"sse","url":"http://localhost:8000/sse"}}.

Tags

More from Other