PS

panz2018/starlette_mcp_sse

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

8 stars 5 forks 품질 55 트렌드 16MIT

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

개요

A Server-Sent Events (SSE) implementation using Starlette framework with Model Context Protocol (MCP) integration. The Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and data sources. MCP solves several key challenges in AI development: - : Allows models to access up-to-date information beyond their training data - : Provides a standardized way for models to use external tools and APIs - : Creates a common interface between different AI models and tools - : Makes it easy to add new capabilities to AI systems without retraining This project demonstrates how to implement MCP using Server-Sent Events (SSE) in a Starlette web application. This project demonstrates how to implement Server-Sent Events (SSE) using the Starlette framework while integrating Model Context Protocol (MCP) functionality.

README

원문 README의 일부입니다. 원문 보기.

Starlette MCP SSE

English | 简体中文

A Server-Sent Events (SSE) implementation using Starlette framework with Model Context Protocol (MCP) integration.

What is MCP?

The Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and data sources. MCP solves several key challenges in AI development:

  • Context limitations: Allows models to access up-to-date information beyond their training data
  • Tool integration: Provides a standardized way for models to use external tools and APIs
  • Interoperability: Creates a common interface between different AI models and tools
  • Extensibility: Makes it easy to add new capabilities to AI systems without retraining

This project demonstrates how to implement MCP using Server-Sent Events (SSE) in a Starlette web application.

Description

This project demonstrates how to implement Server-Sent Events (SSE) using the Starlette framework while integrating Model Context Protocol (MCP) functionality. The key feature is the seamless integration of MCP’s SSE capabilities within a full-featured Starlette web application that includes custom routes.

Features

  • 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

Architecture

This project showcases a modular architecture that:

  1. Integrates MCP SSE endpoints (/sse and /messages/) into a Starlette application
  2. Provides standard web routes (/, /about, /status, /docs)
  3. Demonstrates how to maintain separation between MCP functionality and web routes

Installation & Usage Options

Prerequisites

Install UV Package Manager - A fast Python package installer written in Rust:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Option 1: Quick Run Without Installation

Run the application directly without cloning the repository using UV’s execution tool:

uvx --from git+https://github.com/panz2018/starlette_mcp_sse.git start

Option 2: Full Installation

Create Virtual Environment

Create an isolated Python environment for the project:

uv venv

Activate Virtual Environment

Activate the virtual environment to use it:

.venv\Scripts\activate

Install Dependencies

Install all required packages:

uv pip install -r pyproject.toml

Start the Integrated Server

Launch the integrated Starlette server with MCP SSE functionality:

python src/server.py

or

uv run start

Available Endpoints

GitHub에서 전체 README 보기

설치

uvx --from git+https://github.com/panz2018/starlette_mcp_sse.git start
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →