Get the FREE Ultimate OpenClaw Setup Guide →

fastapi-multi

A comprehensive FastAPI application that hosts multiple MCP servers, each providing access to different public APIs and services.(Multi server MCP)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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)
  1. Clone the repository
git clone <your-repo-url>
cd fastapi-multi-server-mcp
  1. 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
  1. 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
  1. 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
  1. 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

Sponsor this space

Reach thousands of developers