🌦️ MCP and Claude Desktop:Building an Agentic AI Weather Assistant,Is the weather good or bad?

Published by TechToGeek.com

In the era of intelligent automation, Agentic AI tools are redefining how we interact with information. One of the most fascinating frameworks emerging in this space is MCP and Claude Desktop — a modular architecture that allows developers to connect AI models with real-world tools and APIs seamlessly.

Recently, I built a small but powerful Agentic AI weather assistant using MCP, integrated directly into Claude Desktop. This tool fetches real-time weather data for any city you ask — demonstrating how simple code, smart protocol design, and modern LLM interfaces can create meaningful user experiences.

Let’s explore how this AI agent works, what Claude Desktop brings to the table, and how you can set it up yourself.


🌐 What is Claude Desktop?

Before diving into the tool, let’s understand Claude Desktop — a local client developed by Anthropic to bring the power of the Claude AI model to your desktop environment.

Claude Desktop is designed to let users interact with Claude directly through a clean, minimal interface — perfect for developers who want to prototype AI integrations locally.

💡 Key Features of Claude Desktop:

  • Simple and distraction-free chat interface.
  • Built-in support for MCP (Model Context Protocol).
  • Can connect to external tools, APIs, and data sources.
  • Runs locally — ideal for testing and experimentation.

In essence, Claude Desktop acts as a sandbox for your AI agents, allowing you to embed logic, run commands, or query APIs in real-time, right from the chat window.


🤖 About MCP (Model Context Protocol)

MCP (Model Context Protocol) is a lightweight framework that enables Large Language Models (LLMs) to interact with external tools securely.

Think of MCP as the bridge between your AI model and the outside world — databases, APIs, or any Python logic you define.

For example:

  • You can build an agent that retrieves weather, stock prices, or news updates.
  • You can connect the model to APIs or command-line tools.
  • You can extend Claude’s abilities without retraining the model.

My weather agent uses MCP to call a simple Python weather API client, fetch data dynamically, and display it inside Claude Desktop.


🌦️ Introducing the AI Weather Agent

The goal of this project was simple:

“Ask Claude Desktop for the weather in any city, and get a real-time response.”

Using Python, I created an MCP tool that fetches live weather data (temperature, condition, and description). The entire project is available on GitHub:
🔗 https://github.com/subasen85/MCP-Claude


📸 From the Screenshot

MCP and Claude Desktop

As shown in the screenshot, when I asked:

“What is weather in Chennai?”

Claude Desktop responded:

“The current weather in Chennai is showing thunderstorms with a temperature of 26.37°C (about 79°F). It’s a typical warm day with active weather, so if you’re heading out, you might want to carry an umbrella!”

This isn’t a static reply — it’s generated dynamically from live data using the MCP tool.

Behind the scenes, the system automatically:

  1. Recognizes the user’s intent (fetch weather).
  2. Calls the registered MCP Python tool.
  3. Displays the weather data in natural language.

It feels less like a chatbot and more like an intelligent digital assistant.


🛠️ Installation Guide

Follow these steps to set up your own MCP-based Agentic Weather Tool in Claude Desktop.

Step 1: Clone the Repository

git clone https://github.com/subasen85/MCP-Claude.git
cd MCP-Claude

This repository contains all the MCP configuration and Python source files.


Step 2: Set Up Python Environment

Create a virtual environment and install dependencies:

python -m venv venv
source venv/bin/activate  # For Linux/Mac
venv\Scripts\activate     # For Windows

pip install -r requirements.txt

Step 3: Configure Your MCP Tool

In Claude Desktop’s MCP configuration file, define your tool.
You’ll find a mcp.json like this:

{
  "name": "weather-agent",
  "description": "Get real-time weather details for any city",
  "command": "python",
  "args": ["weather_agent.py"]
}

This lets Claude recognize your Python script as an available MCP tool.


Step 4: Run Claude Desktop

Launch Claude Desktop. It will automatically load the MCP tools defined in your configuration.

When you type:

“What’s the weather in Chennai?”

Claude will internally execute:

Get weather

…and your Python code will handle the rest.


Step 5: Test Your Agent

If everything is configured correctly, Claude will display weather results like:

“The current weather in Chennai is showing thunderstorms with a temperature of 26.37°C.”

Congratulations — you’ve just built your first Agentic AI tool with MCP!


⚙️ How It Works

Let’s break down the workflow:

1. User Query

You ask Claude Desktop a question, e.g.,

“What is the weather in Chennai?”

2. Intent Recognition

Claude interprets your question and detects that it needs external weather data.

3. MCP Trigger

Claude calls your registered MCP tool — in this case, a Python function that retrieves weather info.

4. API Call (Python Backend)

The script sends an HTTP request to a weather API (e.g., OpenWeatherMap) and retrieves real-time data.

5. Response Generation

Claude formats the data into human-readable text and replies naturally.


🧠 Sample Python Code

Here’s a simplified version of the Python MCP weather script:

import requests
import sys

def get_weather(city):
    api_key = "YOUR_API_KEY"
    url = f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
    response = requests.get(url)
    data = response.json()

    temp = data["main"]["temp"]
    condition = data["weather"][0]["description"]
    return f"The current weather in {city} is showing {condition} with a temperature of {temp}°C."

if __name__ == "__main__":
    city = sys.argv[1]
    print(get_weather(city))

This script is called by Claude via MCP when you trigger the “Get weather” command.


🌍 MCP and Claude Desktop

The screenshot captures the human-like conversation that happens between Claude and the MCP weather agent.

When I typed:

“What is weather in Chennai?”

Claude didn’t just fetch data — it interpreted the context, verified the query, called the agent, and formatted the answer conversationally.
That’s the power of Agentic AI — it performs tasks autonomously while maintaining natural dialogue.

This small example demonstrates how even a simple task like weather lookup becomes interactive and contextual through MCP integration.


💡 Why This Project Matters

  • Bridges AI and APIs: Demonstrates how LLMs can call Python tools to interact with real-world data.
  • Runs Locally: No cloud deployment needed — works directly inside Claude Desktop.
  • Extensible: You can expand the same architecture to stock data, news summaries, or IoT devices.
  • Agentic by Design: Each action (like fetching weather) becomes a self-contained “agent” you can re-use.

🧩 Advanced Ideas

Want to go further? Here are some ideas:

  • Add voice input/output for a personal AI weather assistant.
  • Use multiple MCP tools (e.g., Weather + News + Calendar).
  • Store history and let Claude summarize weather trends.
  • Combine with RAG to provide city guides with contextual weather information.

🧰 Troubleshooting Tips

  • If Claude says “Tool not found”, double-check your MCP configuration path.
  • Ensure your API key is valid and not expired.
  • Verify that Python and requests library are installed correctly.
  • Use print() statements in your Python file to debug the tool.

❓ FAQ: MCP + Claude Weather Agent

1. What is MCP in simple terms?
MCP (Model Context Protocol) allows AI models like Claude to execute local scripts or external API calls — bridging natural language and real-world actions.


2. Why use Claude Desktop?
Claude Desktop gives you a sandbox for developing and testing AI tools locally — perfect for building and debugging agentic products.


3. Is this tool Agentic?
Yes! The tool autonomously takes an input (“What’s the weather?”), determines an action (fetch weather data), and produces an intelligent response — making it Agentic by design.


4. Can I customize it for other APIs?
Absolutely. Just replace the weather API logic with your desired API endpoint — e.g., stock data, news, or chat analytics.


5. Does it work offline?
Partially — the tool logic runs locally, but it needs internet connectivity to fetch weather data.


6. Is Claude Desktop free?
Yes, the Claude Desktop app itself is free to use for prototyping, though certain APIs or AI calls may have usage limits.


🏁 Conclusion

This project showcases how MCP and Claude Desktop empower developers to build Agentic AI tools — where LLMs don’t just talk but actually act.

Using simple Python scripts and a clean desktop interface, you can create assistants that:

  • Fetch real-time data
  • Perform actions
  • Communicate naturally

My AI Weather Agent is just one example — but it represents the future of AI-driven automation, where natural language becomes the ultimate user interface.

If you want to explore the full code or try it yourself, check out the GitHub repository here:
🔗 https://github.com/subasen85/MCP-Claude


Written and Published by TechToGeek.com
Author: SenthilNathan S — AI Developer & Blog writer

Leave a Reply

Your email address will not be published. Required fields are marked *