Prerequisites
Before you start, ensure you have the following prerequisites:- A Clouddley account
- A GitHub or Bitbucket account
- Python 3.8 or higher installed on your machine
- An account on OpenWeatherMap to get an API key
- Basic command line skills
- A virtual machine or server
Creating the FastAPI Weather Alert MCP Server
Set Up a Virtual Environment
It’s a good practice to use a virtual environment to manage your Python dependencies. Run the following commands to set up a virtual environment:Activate the virtual environment:
- On Windows:
- On macOS/Linux:
Install Required Packages
Create a Install the required packages using pip:
requirements.txt file in your project directory with the following content:Create a .gitignore File
Create a
.gitignore file in your project directory to exclude unnecessary files from version control:Set Up Environment Variables
Create a Make sure to replace
.env file in your project directory to store your OpenWeatherMap API key:your_openweather_api_key_here with your actual OpenWeatherMap API key. You can get an API key by signing up at OpenWeatherMap.Create the MCP server
Create a new file named This code sets up a FastAPI server that connects applications to real-time weather data using the Model Context Protocol (MCP).It provides three main functions:
main.py and add the following code:get_current_weather() for current conditions, get_weather_forecast() for 5-day forecasts, and get_weather_by_coordinates() for location-based weather using coordinates. The @mcp.tool() decorator makes these functions available to AI systems as discoverable tools.The make_openweather_request() function handles API communication with error handling, while formatting functions convert raw data into readable reports. Running on a Starlette server with Server-Sent Events, it creates /sse and /messages/ endpoints for real-time communication, allowing multiple AI applications to access weather data through one reliable service instead of managing API calls individually.Push Your Code to GitHub
Create a New Repository on GitHub
Go to GitHub and create a new repository. Give it a name and leave the rest of the settings as default (no README, no .gitignore, you already have those locally).
Create branch and add Remote Repository
Create a branch and link your local repository to the GitHub repository you created:
Deploying on Clouddley
Accessing Apps- Open your browser and log in to your Clouddley account
- Navigate to Apps and click on Deploy App

Step 1: Configure your service
- Choose your Git provider: either GitHub or Bitbucket. For this guide, we’ll use GitHub.
- Click on Continue with GitHub

Step 2: Connect Your Git Repository
- To connect your GitHub user or organization account, click the Select username/organization dropdown and Add GitHub account.
- Once connected, choose the repository and branch that contains your app.
- Click on Next to proceed

Step 3: Connect Your Virtual machine
- From the Choose or add server dropdown, select your VM if it appears in the list. If not, click + Add Virtual Machine.
- To add your VM, enter your VM’s IP address as VM host, VM user, and the VM port for SSH access.
- Once you’ve entered the details, verify the connection using the Clouddley CLI(recommended) or SSH.
How to Install Clouddley CLI to Verify your Virtual Machine
How to Install Clouddley CLI to Verify your Virtual Machine
- Open your local machine’s command line, then connect to the remote VM you want to configure with Clouddley. Use this command to SSH into your VM:
- Install Clouddley CLI by running the command:
- To add the SSH public key, run the command:
- Click Verify to test the connection to your VM.
- Once it’s verified, click on Next.

Step 4: Configure app settings
- Enter the name of your app and the port your app will run on.
- Click on Next

- Click on Add Variable
- Select an ENV mode: either single variable or import variables. Learn more about Environment Variables.
- Single Variable
- Import Variables

- Add the key-value pairs and click on Save
- Click on Next

Step 6: Setup Notifications (optional) You can set up notifications to receive updates about your app’s deployment status. This step is optional but recommended for monitoring your app.
- To configure the notifications settings of the application, click on Add Alert
- Select the Alert Type. For this guide, we will use Email.
- Toggle on the deployment events you want to be notified of, such as failed, timed out, or success.
- Enter your email address (or multiple, if needed) and click on Save.
- Click on Deploy

Step 7: Test and Verify the app
- Click on Go to Dashboard. Your app will be visible on the apps dashboard.
- Once deployment completes, its status will update from
DeployingtoOnline.

http://<your-vm-ip>:<port>/sse
Testing Locally with Cline
Use the Cline extension to test your FastAPI server locally. Cline interacts with your MCP server through the Model Context Protocol (MCP), letting you send requests and receive real-time responses. Follow these steps to test:Install Cline extension on Vscode
- Open Visual Studio Code and go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
- Search for “Cline” in the Extensions Marketplace.
- Click on the Install button to install the Cline extension.
- Once installed, you can access Cline from the Command Palette (Ctrl+Shift+P) by typing “Cline”.
Add your API key to VS Code settings
- Open the Command Palette (Ctrl+Shift+P) and type “Preferences: Open Settings (JSON)”.
- Add your Cline API key to the settings:
your-api-key-here with your actual API key.Set up MCP configuration
- In VS Code, open Command Palette (Ctrl+Shift+P)
- Type “Cline: Open MCP Settings” to open
cline_mcp_settings.json - Add your MCP server configuration:
Test your MCP server
- Open a new task in Cline in VS Code
- Ask: “What is the weather in London?”
- Verify Cline can:
- Connect to your FastAPI weather MCP server
- Make weather API calls
- Return formatted weather data

Conclusion
You’ve created a weather alert MCP server and deployed it on a virtual machine using Clouddley, connecting real-time weather data with AI assistance. Your server demonstrates how to integrate external APIs with the Model Context Protocol, giving Cline access to current weather conditions and enabling users to ask detailed questions about forecasts. This approach works beyond weather data. Apply the same pattern to build MCP servers for any external data source your applications need. Continue developing MCP servers that connect AI with real-world data to solve practical problems.Getting started with Clouddley?
A backend infrastructure for your own compute. Run apps, databases, brokers, and AI workloads on your VMs, bare metal, or VPS.


