loading…
Search for a command to run...
loading…
A FastAPI application that hosts multiple MCP servers for weather, news, currency, and quotes APIs.
A FastAPI application that hosts multiple MCP servers for weather, news, currency, and quotes APIs.
A comprehensive FastAPI application that hosts multiple Model Context Protocol (MCP) servers, each providing access to different public APIs and services.
This project includes 5 different MCP servers:
📁 Project Structure
fastapi-multi-server-mcp/
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── pyproject.toml # UV project configuration
├── .env.example # Environment variables template
├── README.md # This file
├── servers/ # MCP servers directory
│ ├── __init__.py
│ ├── weather_server.py # Weather API MCP server
│ ├── news_server.py # News API MCP server
│ ├── currency_server.py # Currency API MCP server
│ └── quote_server.py # Quotes API MCP server
├── utils/ # Utility modules
│ ├── __init__.py
│ ├── api_clients.py # HTTP client utilities
│ └── config.py # Configuration management
├── tests/ # Test suite
│ ├── __init__.py
│ ├── test_weather.py
│ ├── test_news.py
│ ├── test_currency.py
│ └── test_quote.py
└── docs/ # Documentation
├── api_reference.md
└── deployment.md
# Clone the repository
git clone <your-repo-url>
cd fastapi-multi-server-mcp
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -r requirements.txt
pip install -r requirements.txt
Create a .env file in the root directory with your API keys:
# Weather API (OpenWeatherMap)
OPENWEATHER_API_KEY=your_openweather_api_key
# News API
NEWS_API_KEY=your_news_api_key
# Exchange Rates API
EXCHANGE_RATES_API_KEY=your_exchange_rates_api_key
# Server Configuration
PORT=10000
HOST=0.0.0.0
# Using UV
uv run uvicorn main:app --reload --host 0.0.0.0 --port 10000 --reload
# Using `npx` to debug the running application,
npx @modelcontextprotocol/inspector uv run uvicorn main:app
To connect specific server to inspector,
Set,
Transport Type: StreamableHTTP
URLs:
Quotes server:

News server:

Weather server:

Currency server:

As of June 2025, Windsurf and Cursor supports two transport types for MCP servers: stdio and /sse, but not StreamableHTTP. So using stdio or /sse as transport type is recommended. But with inspector, you can connect to the MCP server running on FastAPI with any transport type.
# Using Gunicorn
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:10000
Once running everything successfully,
Your FastAPI server will be available at: http://localhost:10000, docs at http://localhost:10000/docs and your MCP servers will be available at:
# Run all tests
pytest
# Run with coverage
pytest --cov=.
# Run specific server tests
pytest tests/test_weather.py
get_current_weather - Get current weather for a city
get_weather_forecast - Get 5-day weather forecast
get_weather_by_coordinates - Get weather by latitude/longitude
get_top_headlines - Get top news headlines
search_news - Search news articles by keyword
get_news_by_category - Get news by category (business, tech, sports, etc.)
get_exchange_rates - Get current exchange rates
convert_currency - Convert between currencies
get_supported_currencies - List all supported currencies
get_random_quote - Get a random inspirational quote
get_quote_by_category - Get quotes by category
get_random_fact - Get a random interesting fact
🚀 Deployment
You can deploy this project using Docker. Example Dockerfile is included:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 10000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "10000"]
PORT=10000
HOST=0.0.0.0
LOG_LEVEL=info
WORKERS=4
📝 License
This project is licensed under the MIT License - see the LICENSE.md file for details.
📚 Support & Documentation
docs/ directory🔄 Updates and Roadmap
Run in your terminal:
claude mcp add multi-server-mcp-fastapi-project -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.