
FastAPI SSE MCP Random
A FastAPI server implementing the Model Context Protocol (MCP) for structured tool use, providing utility tools including random number generation, image generation via Azure OpenAI DALL-E, and AI podcast generation.
README
FastAPI SSE MCP Random
A FastAPI server that implements the Model Context Protocol (MCP) using Server-Sent Events (SSE) for streaming communication. This project provides various utility tools including random number generation, image generation using Azure OpenAI DALL-E, and AI podcast generation.
Features
- Server-Sent Events (SSE) for real-time streaming communication
- Model Context Protocol (MCP) implementation for structured tool use
- Multiple utility tools:
- Echo tool and resources
- Random number generator
- Image generation via Azure OpenAI DALL-E 3
- AI podcast generation
- "Think tool" for reflective responses
Prerequisites
- Python 3.10+
- Azure OpenAI API access (for image generation)
Installation
- Clone the repository:
git clone <repository-url>
cd fastapi_sse_mcp_random
- Install the dependencies:
pip install -r requirements.txt
Or using uv
:
uv pip install -e .
Usage
Starting the server
Run the server with:
python main.py
The server will start at http://0.0.0.0:8000
Available Endpoints
GET /
: Health check endpointGET /sse/
: SSE connection endpointPOST /messages/
: Endpoint for client messages
Available Tools
Echo Tool
{
"name": "echo_tool",
"parameters": {
"message": "Hello, world!"
}
}
Random Number Generator
{
"name": "random_number",
"parameters": {
"min_value": 1,
"max_value": 100
}
}
Image Generation
{
"name": "generate_image",
"parameters": {
"prompt": "A beautiful landscape with mountains and a lake"
}
}
Podcast Generation
{
"name": "generate_podcast",
"parameters": {
"prompt": "The future of artificial intelligence",
"duration": 5,
"name1": "Mark",
"voice1": "Thomas",
"name2": "Sophia",
"voice2": "Emily"
}
}
Think Tool
{
"name": "think_tool",
"parameters": {
"input": "What are the implications of quantum computing?"
}
}
Project Structure
main.py
: Main FastAPI application and MCP tools implementationsse.py
: Server-Sent Events (SSE) implementationpyproject.toml
: Project metadata and dependenciesrequirements.txt
: Basic dependencies list
Dependencies
- FastAPI: Web framework for building APIs
- MCP: Model Context Protocol implementation
- OpenAI: Client for Azure OpenAI services
- Uvicorn: ASGI server for running FastAPI applications
- Requests: HTTP library for API calls
License
[Specify your license here]
Contributing
[Instructions for contributing to the project]
Recommended Servers
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.
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.
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.

VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.

E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.