Skip to main content
Glama
README.md
# ๐ŸŒค๏ธ Weather Bot with AI-Powered Research

> An intelligent AI assistant that combines real-time weather data, smart web research, and graph database capabilities - all through a simple chat interface.

[![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-green.svg)](https://fastapi.tiangolo.com/)
[![Docker](https://img.shields.io/badge/Docker-Ready-blue.svg)](https://www.docker.com/)
[![MCP](https://img.shields.io/badge/MCP-Enabled-purple.svg)](https://modelcontextprotocol.io/)

---

## ๐ŸŽฏ What is This?

Weather Bot is a smart AI assistant that can:

- ๐ŸŒก๏ธ **Tell you the weather** - Current conditions and forecasts for any city
- ๐Ÿ” **Research topics** - Searches the web and gives you intelligent, grounded answers
- ๐Ÿ—„๏ธ **Store data** - Saves information in a graph database (Neo4j)
- ๐Ÿ’ฌ **Chat naturally** - Just ask questions in plain English

Built using the **Model Context Protocol (MCP)**, it demonstrates how AI can seamlessly interact with multiple tools and data sources.

---

## โœจ Features at a Glance

### ๐ŸŒก๏ธ Weather Information
- Current weather for any city worldwide
- Multi-day weather forecasts
- Temperature, humidity, and detailed conditions

### ๐Ÿง  Intelligent Research
- Automatically searches the web using **Firecrawl**
- Analyzes content with **Ragie** (RAG technology)
- Generates smart answers using **OpenRouter** AI
- All answers are based on real, up-to-date information

### ๐Ÿ—„๏ธ Data Storage
- Uses **Neo4j** graph database
- Store and connect information
- Query your data anytime

### ๐ŸŽจ Beautiful Interface
- Clean **Streamlit** chat UI
- No coding required - just chat!
- Works in your web browser

---

## ๐Ÿ—๏ธ How It Works

```mermaid
graph TB
    User[๐Ÿ‘ค You] -->|Chat| UI[๐Ÿ–ฅ๏ธ Beautiful Chat Interface]
    UI -->|Sends Request| Server[โš™๏ธ AI Brain]
    Server -->|Gets Weather| Weather[๐ŸŒค๏ธ Weather API]
    Server -->|Searches Web| Web[๐Ÿ” Web Scraper]
    Server -->|Analyzes| RAG[๐Ÿ“š Smart Retrieval]
    Server -->|Generates Answer| AI[๐Ÿค– AI Model]
    Server -->|Stores Data| DB[(๐Ÿ—„๏ธ Database)]
    
    style UI fill:#4CAF50,stroke:#333,stroke-width:2px,color:#fff
    style Server fill:#2196F3,stroke:#333,stroke-width:2px,color:#fff
    style DB fill:#FF9800,stroke:#333,stroke-width:2px,color:#fff
```

### Three Main Parts

| Component | What It Does | Where to Access |
|-----------|--------------|-----------------|
| ๐Ÿ–ฅ๏ธ **Chat Interface** | Where you type and see responses | http://localhost:8501 |
| โš™๏ธ **AI Server** | The brain that handles your requests | http://localhost:8000 |
| ๐Ÿ—„๏ธ **Database** | Stores your data | http://localhost:7474 |

---

## ๐Ÿ› ๏ธ Technologies Used

### AI & APIs
- ๐Ÿค– **OpenRouter** - Powers the AI responses (supports GPT, Claude, etc.)
- ๐Ÿ”ฅ **Firecrawl** - Searches and scrapes the web
- ๐Ÿ“š **Ragie** - Smart document retrieval (RAG)
- ๐ŸŒค๏ธ **OpenWeatherMap** - Real-time weather data

### Core Tech
- ๐Ÿš€ **FastMCP** - Model Context Protocol framework
- โšก **FastAPI** - High-performance backend
- ๐ŸŽจ **Streamlit** - Interactive user interface
- ๐Ÿ—„๏ธ **Neo4j** - Graph database

### Infrastructure
- ๐Ÿณ **Docker** - Easy setup and deployment
- ๐Ÿ **Python** - Programming language

---

## ๐Ÿ“ฆ What You Need

Before starting, you'll need:

### Required Software
- โœ… **Docker Desktop** - [Download here](https://www.docker.com/products/docker-desktop/)

### API Keys (All Free to Start!)
You'll need to sign up for these services and get free API keys:

1. ๐ŸŒค๏ธ **OpenWeatherMap** - [Get free key](https://openweathermap.org/api)
2. ๐Ÿ”ฅ **Firecrawl** - [Get free key](https://firecrawl.dev/)
3. ๐Ÿ“š **Ragie** - [Get free key](https://ragie.ai/)
4. ๐Ÿค– **OpenRouter** - [Get key](https://openrouter.ai/) (Pay-as-you-go, very cheap)

> ๐Ÿ’ก **Don't worry!** All services have free tiers or are very inexpensive to use.

---

## ๐Ÿš€ Quick Start

### Step 1: Get the Project

Download or clone this project to your computer.

### Step 2: Set Up Your Keys

1. Find the file named `.env.example`
2. Make a copy and rename it to `.env`
3. Open `.env` in any text editor
4. Add your API keys where indicated:

```
OPENWEATHER_API_KEY=paste_your_key_here
FIRECRAWL_API_KEY=paste_your_key_here
RAGIE_API_KEY=paste_your_key_here
OPENROUTER_API_KEY=paste_your_key_here
NEO4J_PASSWORD=choose_a_strong_password
```

### Step 3: Start Everything

Open your terminal/command prompt in the project folder and run:

```
docker-compose up
```

โณ **Wait 1-2 minutes** for everything to start...

### Step 4: Start Chatting!

Open your web browser and go to:

**http://localhost:8501**

That's it! ๐ŸŽ‰

---

## ๐Ÿ’ฌ What Can You Ask?

### Weather Questions
- "What's the weather in Paris?"
- "Give me a 5-day forecast for Tokyo"
- "Is it raining in London right now?"

### Research Questions
- "What are the latest developments in AI?"
- "Research quantum computing advancements"
- "Tell me about climate change solutions"

### Database Commands
- "Store this: Person named Alice, age 30"
- "Show me all the people in the database"
- "Create a connection between Alice and Bob"

> ๐Ÿ’ก **Pro Tip:** Just ask naturally! The AI will figure out which tool to use.

---

## ๐ŸŽฏ The 4 Smart Tools

### 1๏ธโƒฃ Current Weather
Tells you what the weather is like **right now** in any city.

**Ask:** "What's the weather in New York?"

---

### 2๏ธโƒฃ Weather Forecast
Shows you the weather for the **next few days**.

**Ask:** "Give me a 3-day forecast for Paris"

---

### 3๏ธโƒฃ Web Research
This is the smart one! It:
1. Searches the web for information
2. Reads and understands the content
3. Gives you a clear, accurate answer

**Ask:** "Research the benefits of meditation"

---

### 4๏ธโƒฃ Database Storage
Stores information in a graph database (great for connected data).

**Ask:** "Store a person named Alice who knows Bob"

---

## ๐Ÿ“‚ Project Files

```
weather_bot_gg/
โ”œโ”€โ”€ ๐ŸŽจ client.py              # Chat interface
โ”œโ”€โ”€ โš™๏ธ server.py              # AI brain with all the tools
โ”œโ”€โ”€ ๐Ÿณ docker-compose.yml     # Starts everything together
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt       # Python packages needed
โ”œโ”€โ”€ ๐Ÿ”’ .env                   # Your API keys (keep secret!)
โ””โ”€โ”€ ๐Ÿ“– README.md              # This guide
```

---

## ๐ŸŒ Access Points

Once everything is running, you can access:

| Service | URL | What It's For |
|---------|-----|---------------|
| ๐Ÿ’ฌ **Chat Interface** | http://localhost:8501 | Talk to the AI |
| ๐Ÿ”ง **API Server** | http://localhost:8000 | Backend server |
| ๐Ÿ“Š **API Docs** | http://localhost:8000/docs | Interactive API documentation |
| ๐Ÿ—„๏ธ **Database Browser** | http://localhost:7474 | View stored data visually |

> ๐Ÿ” For Neo4j Browser, login with username `neo4j` and your password from `.env`

---

## ๐Ÿ› Common Issues

### โŒ Port Already in Use
**Problem:** Another program is using the same port.

**Fix:** Close other applications or change the port in `docker-compose.yml`

---

### โŒ API Key Errors
**Problem:** "API key not set" message appears.

**Fix:** 
1. Check your `.env` file exists
2. Make sure all keys are filled in
3. No extra spaces or quotes around keys
4. Restart Docker: `docker-compose restart`

---

### โŒ Can't Connect to Database
**Problem:** Neo4j errors or connection refused.

**Fix:** Wait! Neo4j takes 30-60 seconds to fully start. Check if it's ready:

```
docker-compose logs neo4j
```

Look for "Started" message.

---

### โŒ Docker Won't Start
**Fix:** Try a clean restart:

```
docker-compose down
docker-compose up --build
```

---

## ๐Ÿ“Š Viewing Your Database

1. Go to **http://localhost:7474**
2. Login with:
   - Username: `neo4j`
   - Password: (what you set in `.env`)
3. You'll see a visual interface to explore your data!

---

## ๐Ÿงช Testing

### Quick Health Check

Make sure everything works:

1. **Chat Interface:** Go to http://localhost:8501 - You should see the chat
2. **Server:** Go to http://localhost:8000/health - Should say "healthy"
3. **Database:** Go to http://localhost:7474 - Should load the login page

### Try These Questions

1. "What's the weather in London?" โ†’ Should get actual weather
2. "Research artificial intelligence" โ†’ Should search and answer
3. Simple questions work best at first!

---

## ๐Ÿ’ก Tips & Best Practices

### For Best Results
- โœ… Be specific in your questions
- โœ… One question at a time works best
- โœ… Weather: Use city names (not coordinates)
- โœ… Research: Ask clear, focused questions

### Cost Management
- ๐Ÿ’ฐ Most API calls cost less than $0.01
- ๐Ÿ’ฐ OpenWeatherMap is free (up to 1000 calls/day)
- ๐Ÿ’ฐ Research tool is the most expensive (uses AI generation)
- ๐Ÿ’ฐ Monitor your usage in each service's dashboard

### Performance
- โšก Weather queries: ~1 second
- โšก Research queries: 10-30 seconds (lots of processing!)
- โšก Database queries: ~1 second

---

## ๐Ÿ”’ Security Notes

### Keep These Private
- โŒ Never share your `.env` file
- โŒ Never commit API keys to GitHub
- โŒ Change default Neo4j password
- โœ… The `.gitignore` file protects your `.env` automatically

---

## ๐ŸŽ“ Learn More

### About the Technology
- **Model Context Protocol:** https://modelcontextprotocol.io/
- **RAG (Retrieval-Augmented Generation):** AI technique for grounded answers
- **Neo4j:** Graph database for connected information
- **Docker:** Containerization for easy deployment

### Useful Resources
- [FastMCP Documentation](https://github.com/jlowin/fastmcp)
- [Streamlit Docs](https://docs.streamlit.io/)
- [Neo4j Cypher Guide](https://neo4j.com/docs/cypher-manual/current/)

---

## ๐Ÿค Contributing

Want to improve this project?

1. Fork the repository
2. Make your changes
3. Test everything works
4. Submit a pull request

Ideas for contributions:
- ๐ŸŽจ Improve the UI design
- ๐Ÿ”ง Add new tools
- ๐Ÿ“š Better documentation
- ๐Ÿ› Fix bugs

---

## ๐Ÿ“ License

MIT License - Free to use and modify!

---

## ๐Ÿ™ Credits

**Built with:**
- **Model Context Protocol** by Anthropic
- **FastMCP** by Marvin
- All the amazing open-source communities

**Special Thanks:**
- OpenAI, Anthropic, and the AI community
- Docker and Python communities
- Everyone who contributed to the libraries used

---

<div align="center">

### Built with โค๏ธ using the Model Context Protocol

**Combining AI, Real-Time Data, and Smart Research**

---

โญ **Star this repo if you found it useful!**

๐Ÿ“ง **Questions?** Open an issue on GitHub

๐Ÿš€ **Happy Chatting!**

</div>