fastapi-multi
A comprehensive FastAPI application that hosts multiple MCP servers, each providing access to different public APIs and services.(Multi server MCP)
claude mcp add --transport stdio alwayssany-fastapi-multi-server-mcp uvx run uvicorn main:app --reload --host 0.0.0.0 --port 10000 \ --env HOST="0.0.0.0" \ --env PORT="10000" \ --env NEWS_API_KEY="your_news_api_key" \ --env QUOTE_API_KEY="your_quotes_api_key" \ --env OPENWEATHER_API_KEY="your_openweather_api_key" \ --env EXCHANGE_RATES_API_KEY="your_exchange_rates_api_key"
How to use
This MCP server is a multi-host FastAPI application that exposes four distinct MCP servers under one project: Weather, News, Currency, and Quote. Each server provides endpoints to access third-party APIs such as OpenWeatherMap, NewsAPI, currency exchange services, and a quotes API. You can connect to each server through its dedicated path (for example, /weather, /news, /currency, /quotes) and use the MCP inspector to explore available operations, such as getting current weather, top headlines, exchange rates, and random quotes. To debug or inspect interactions, run the app locally with UV and then connect the inspector to the corresponding server endpoints using the provided transport types. The available tools per server include: Weather (get_current_weather, get_weather_forecast, get_weather_by_coordinates), News (get_top_headlines, search_news, get_news_by_category), Currency (get_exchange_rates, convert_currency, get_supported_currencies), and Quote (get_random_quote, get_quote_by_category, get_random_fact). When running in production, you can deploy the app with Gunicorn/Uvicorn workers and still access the same endpoints, e.g., /weather, /news, /currency, /quotes.
How to install
Prerequisites:
- Python 3.13+ installed
- UV package manager (https://github.com/astral-sh/uv)
- API keys for external services (OpenWeatherMap, NewsAPI, Exchange Rates, Quotes API)
- Clone the repository
git clone <your-repo-url>
cd fastapi-multi-server-mcp
- Create and activate a virtual environment, then install dependencies
Using UV:
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -r requirements.txt
Alternatively with pip:
pip install -r requirements.txt
- Prepare configuration Create a .env file in the repository root and add your API keys and server settings, for example:
# 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
# Quote API (optional)
QUOTE_API_KEY=your_quotes_api_key
# Server configuration
PORT=10000
HOST=0.0.0.0
- Run the application
Using UV (recommended during development):
uv run uvicorn main:app --reload --host 0.0.0.0 --port 10000 --reload
Or start the MCP server via the inspector for debugging:
npx @modelcontextprotocol/inspector uv run uvicorn main:app
- Optional production deployment with Gunicorn
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:10000
Additional notes
Environment variables control access to external APIs; ensure keys are kept secret. The MCP endpoints are hosted under /weather, /news, /currency, and /quotes. If using inspector for debugging, ensure Transport Type is compatible (stdio or /sse are recommended for Windsurf/Cursor integrations). In production, consider setting LOG_LEVEL, and adjust WORKERS as needed. The project structure includes dedicated MCP server modules in servers/ (weather_server.py, news_server.py, currency_server.py, quote_server.py) and shared utilities in utils/ (config.py, api_clients.py).
Related MCP Servers
fastapi_mcp
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!
mcp -qdrant
An official Qdrant Model Context Protocol (MCP) server implementation
mcp -azure-devops
An MCP server for Azure DevOps
mac_messages_mcp
An MCP server that securely interfaces with your iMessage database via the Model Context Protocol (MCP), allowing LLMs to query and analyze iMessage conversations. It includes robust phone number validation, attachment processing, contact management, group chat handling, and full support for sending and receiving messages.
knowledgegraph
MCP server for enabling persistent knowledge storage for Claude through a knowledge graph with multiple storage backends and fuzzy search
mcp-ssh-orchestrator
Secure SSH access for AI agents via MCP. Execute commands across your server fleet with policy enforcement, network controls, and comprehensive audit logging.