README.mdโข4.11 kB
# MCP Demo: Country Explorer with LangGraph
<p align="center">
<img src="https://github.com/AI-Maker-Space/LLM-Dev-101/assets/37101144/d1343317-fa2f-41e1-8af1-1dbb18399719"
width="200px" height="auto"/>
</p>
## ๐ Country Explorer: MCP + LangGraph Integration
This project demonstrates a complete **MCP (Model Context Protocol) server** integrated with **LangGraph** to create beautiful country profiles with embedded images.
## โจ Features
- ๐ **MCP Server** with Unsplash Search API integration
- ๐ค **LangGraph Agent** for intelligent country exploration
- ๐ผ๏ธ **10 Images per Country** with photographer credits
- ๐ **Beautiful Markdown Profiles** with embedded images
- ๐งช **Comprehensive Test Suite** for validation
- ๐ **Organized Project Structure** with `profiles/` and `tests/` folders
## ๐๏ธ Project Structure
```
mcp-demo/
โโโ country_explorer.py # Main LangGraph app (10 images)
โโโ server.py # MCP server with Unsplash API
โโโ profiles/ # ๐ Generated country profiles
โ โโโ india_profile.md
โ โโโ japan_profile.md
โ โโโ uganda_profile.md
โ โโโ usa_profile.md
โโโ tests/ # ๐ Test files
โ โโโ test_country_explorer.py
โ โโโ test_unsplash.py
โ โโโ search_5_mountains.py
โโโ .env # API keys
```
## ๐ Quick Start
### Prerequisites
- Python 3.13+
- Unsplash API key
- OpenAI API key
### Installation
1. **Clone the repository**:
```bash
git clone https://github.com/anilsharmay/mcp-demo.git
cd mcp-demo
```
2. **Install dependencies**:
```bash
uv sync
```
3. **Configure environment variables**:
Create `.env` file with your API keys:
```bash
UNSPLASH_API_KEY=your_unsplash_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here
```
### Running the Country Explorer
1. **Start the MCP server**:
```bash
uv run mcp dev server.py
```
2. **Run the Country Explorer**:
```bash
uv run python country_explorer.py
```
3. **Run tests**:
```bash
cd tests && uv run python test_country_explorer.py
```
## ๐ฏ MCP Server Tools
The MCP server provides these tools:
- **`unsplash_search`**: Search for beautiful images with orientation filters
- **`web_search`**: Search the web for country information
- **`roll_dice`**: Roll dice with custom notation
## ๐ค LangGraph Agent
The Country Explorer agent:
- Researches countries using web search
- Finds 10 beautiful images via Unsplash
- Creates rich markdown profiles with embedded images
- Includes photographer credits and links
## ๐ธ Sample Output
Each country profile includes:
- **Cultural information** and history
- **Geographic details** and landmarks
- **10 high-quality images** with credits
- **Clean markdown formatting** for easy viewing
## ๐งช Testing
Run the comprehensive test suite:
```bash
# Test MCP server
uv run python tests/test_unsplash.py
# Test Country Explorer
cd tests && uv run python test_country_explorer.py
# Test mountain search
uv run python tests/search_5_mountains.py
```
## ๐ง MCP Configuration
Add to your Cursor MCP settings:
```json
{
"mcpServers": {
"unsplash-mcp-server": {
"command": "uv",
"args": ["--directory", ".", "run", "server.py"]
}
}
}
```
## ๐ Technologies Used
- **MCP (Model Context Protocol)** - Server framework
- **LangGraph** - Agent orchestration
- **LangChain MCP Adapters** - Tool integration
- **Unsplash API** - Image search
- **OpenAI GPT-4** - Language model
- **Python 3.13** - Runtime environment
## ๐ Showcase
This project demonstrates:
- โ
**MCP Server Development** with custom API integration
- โ
**LangGraph Agent Creation** with tool orchestration
- โ
**Beautiful Output Generation** with embedded images
- โ
**Clean Project Organization** and testing
- โ
**Real-world Application** of AI agent frameworks
**Perfect for showcasing MCP + LangGraph integration!** ๐โจ