drio
Open app

Starlette MCP SSE

Source

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

Catalog onlyCatalog onlySTDIO

Overview

Starlette MCP SSE is a project that demonstrates how to create a Starlette server with Server-Sent Events (SSE) support, integrating the Model Context Protocol (MCP) for enhanced AI model interactions.

To use this project, you can either run it directly without installation using UV's execution tool or set up a virtual environment and install the necessary dependencies. After starting the server, you can access various endpoints for both standard web routes and MCP SSE functionality.

  • Implementation of Server-Sent Events (SSE) with MCP integration. - Customizable route structure within a Starlette web application. - Clean separation of concerns between MCP functionality and standard web endpoints. - Debugging capabilities with MCP Inspector.
  1. Building real-time applications that require live data updates.
  2. Integrating AI models with external tools and APIs using MCP.
  3. Creating modular web applications that leverage SSE for dynamic content delivery.

Add to your AI client

Use these steps to connect Starlette MCP SSE in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "starlette-mcp-sse-panz2018": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-starlette-mcp-sse-panz2018"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "starlette-mcp-sse-panz2018": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-starlette-mcp-sse-panz2018"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "starlette-mcp-sse-panz2018": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-starlette-mcp-sse-panz2018"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "starlette-mcp-sse-panz2018": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-starlette-mcp-sse-panz2018"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "starlette-mcp-sse-panz2018": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-starlette-mcp-sse-panz2018"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "starlette-mcp-sse-panz2018": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-starlette-mcp-sse-panz2018"
      ]
    }
  }
}

FAQ

What is the Model Context Protocol (MCP)?

MCP is an open standard that allows AI models to interact with external tools and data sources, addressing context limitations and enabling tool integration.

How can I extend the application?

You can easily add custom routes by defining new route handlers and including them in the main application.

Is there a way to debug MCP functionality?

Yes! You can use the MCP Inspector for testing and debugging the MCP features.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":2676,"uuid":"9f83dd73-f89e-47f5-aaf8-34584cd7782b","name":"starlette_mcp_sse","title":"Starlette MCP SSE","description":"A working example to create a starlette server with SSE-based MCP support","avatar_url":"https://avatars.githubusercontent.com/u/49798383?v=4","created_at":"$D2025-03-13T09:32:56.622Z","updated_at":"$D2025-03-13T09:38:30.956Z","status":"created","author_name":"panz2018","author_avatar_url":"https://avatars.githubusercontent.com/u/49798383?v=4","tags":"starlette,sse,mcp","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/panz2018/starlette_mcp_sse","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"1\",\"license\":\"MIT license\",\"language\":\"Python\",\"is_official\":false,\"latest_commit_time\":\"2025-03-09 15:22:57\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]