Skip to main content
Glama
README.md
# ๐Ÿ  A2A MCP Real Estate

> Korean Real Estate Recommendation System using FastMCP  
> AI-powered property analysis with investment value and quality of life evaluation

[![FastMCP](https://img.shields.io/badge/FastMCP-2.10.6-blue.svg)](https://github.com/jlowin/fastmcp)
[![Python](https://img.shields.io/badge/Python-3.12+-green.svg)](https://www.python.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.116+-red.svg)](https://fastapi.tiangolo.com/)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

## ๐Ÿ“‹ Overview

A2A MCP Real Estate๋Š” ํ•œ๊ตญ ๋ถ€๋™์‚ฐ ์‹œ์žฅ์„ ์œ„ํ•œ AI ๊ธฐ๋ฐ˜ ์ถ”์ฒœ ์‹œ์Šคํ…œ์ž…๋‹ˆ๋‹ค. FastMCP(Model Context Protocol) ์„œ๋ฒ„๋ฅผ ํ†ตํ•ด ๋ถ€๋™์‚ฐ ์‹ค๊ฑฐ๋ž˜๊ฐ€ ๋ฐ์ดํ„ฐ ๋ถ„์„, ์œ„์น˜ ๊ธฐ๋ฐ˜ ์„œ๋น„์Šค, ๊ทธ๋ฆฌ๊ณ  ํˆฌ์ž๊ฐ€์น˜์™€ ์‚ถ์˜์งˆ์„ ์ข…ํ•ฉํ•œ ๋งž์ถคํ˜• ๋ถ€๋™์‚ฐ ์ถ”์ฒœ ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

### โœจ Key Features

- ๐Ÿข **์‹ค๊ฑฐ๋ž˜๊ฐ€ ๋ฐ์ดํ„ฐ ์กฐํšŒ**: ๊ตญํ† ๊ตํ†ต๋ถ€ ๊ณต๊ณต๋ฐ์ดํ„ฐ API ์—ฐ๋™
- ๐Ÿ“ **์œ„์น˜ ๊ธฐ๋ฐ˜ ๋ถ„์„**: ์ง€ํ•˜์ฒ ์—ญ ๊ฑฐ๋ฆฌ, ํŽธ์˜์‹œ์„ค, ๊ณต์› ์ ‘๊ทผ์„ฑ ๋ถ„์„
- ๐Ÿ’ฐ **ํˆฌ์ž๊ฐ€์น˜ ํ‰๊ฐ€**: AI ๊ธฐ๋ฐ˜ ํˆฌ์ž ์ˆ˜์ต์„ฑ ๋ถ„์„
- ๐ŸŒฟ **์‚ถ์˜์งˆ ํ‰๊ฐ€**: ๊ฑฐ์ฃผ ํ™˜๊ฒฝ์˜ ํŽธ์˜์„ฑ๊ณผ ์•ˆ์ „์„ฑ ๋ถ„์„
- ๐ŸŽฏ **๋งž์ถคํ˜• ์ถ”์ฒœ**: ์‚ฌ์šฉ์ž ์„ฑํ–ฅ๋ณ„ ๋ถ€๋™์‚ฐ ์ถ”์ฒœ (ํˆฌ์ž/์‚ถ์˜์งˆ/๊ท ํ˜•)
- ๐ŸŒ **์›น ์ธํ„ฐํŽ˜์ด์Šค**: ์ง๊ด€์ ์ธ ๋ถ€๋™์‚ฐ ๋ถ„์„ ๋„๊ตฌ

## ๐Ÿš€ Quick Start

### Prerequisites

- Python 3.12+
- ๊ตญํ† ๊ตํ†ต๋ถ€ ๊ณต๊ณต๋ฐ์ดํ„ฐํฌํ„ธ API ํ‚ค
- ๋„ค์ด๋ฒ„ ํด๋ผ์šฐ๋“œ ํ”Œ๋žซํผ API ํ‚ค

### Installation

```bash
# Clone the repository
git clone https://github.com/your-username/A2A-MCP-RealEstate.git
cd A2A-MCP-RealEstate

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\\Scripts\\activate

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env file with your API keys
```

### Environment Variables

```bash
# .env file
MOLIT_API_KEY=your_molit_api_key_here
NAVER_CLIENT_ID=your_naver_client_id_here
NAVER_CLIENT_SECRET=your_naver_client_secret_here
PORT=8080
AGENT_ID=agent-py-001
AGENT_NAME=A2A_Python_Agent
LOG_LEVEL=INFO
ENVIRONMENT=development
```

### Running the Application

#### 1. Web Interface (Recommended)
```bash
# Start the web server
python runner.py

# Access the web interface
open http://localhost:8080/web/
```

#### 2. MCP Servers (Standalone)
```bash
# Real Estate Recommendation MCP Server
python app/mcp/real_estate_recommendation_mcp.py

# Location Service MCP Server
python app/mcp/location_service.py
```

#### 3. Claude Desktop Integration
Add to your Claude Desktop MCP configuration:

```json
{
  "mcpServers": {
    "korean-realestate": {
      "command": "python",
      "args": ["app/mcp/real_estate_recommendation_mcp.py"],
      "cwd": "/path/to/A2A-MCP-RealEstate"
    }
  }
}
```

## ๐Ÿ› ๏ธ MCP Tools

### Real Estate Recommendation Server

| Tool Name | Description | Parameters |
|-----------|-------------|------------|
| `get_real_estate_data` | ๋ถ€๋™์‚ฐ ์‹ค๊ฑฐ๋ž˜๊ฐ€ ์กฐํšŒ | `lawd_cd`, `deal_ymd`, `property_type` |
| `analyze_location` | ์œ„์น˜ ๋ถ„์„ (์ง€ํ•˜์ฒ , ํŽธ์˜์‹œ์„ค) | `address`, `lat`, `lon` |
| `evaluate_investment_value` | ํˆฌ์ž๊ฐ€์น˜ ํ‰๊ฐ€ | Property details + preferences |
| `evaluate_life_quality` | ์‚ถ์˜์งˆ๊ฐ€์น˜ ํ‰๊ฐ€ | Property details + preferences |
| `recommend_property` | ์ข…ํ•ฉ ๋ถ€๋™์‚ฐ ์ถ”์ฒœ | All property details + `user_preference` |

### Location Service Server

| Tool Name | Description | Parameters |
|-----------|-------------|------------|
| `find_nearest_subway_stations` | ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ์ง€ํ•˜์ฒ ์—ญ ๊ฒ€์ƒ‰ | `address`, `lat`, `lon`, `limit` |
| `address_to_coordinates` | ์ฃผ์†Œ๋ฅผ ์ขŒํ‘œ๋กœ ๋ณ€ํ™˜ | `address` |
| `find_nearby_facilities` | ์ฃผ๋ณ€ ํŽธ์˜์‹œ์„ค ๊ฒ€์ƒ‰ | `lat`, `lon`, `category`, `radius` |
| `calculate_location_score` | ์œ„์น˜ ์ ์ˆ˜ ๊ณ„์‚ฐ | `subway_distance`, `facilities_count`, `park_distance` |

## ๐Ÿ“Š Evaluation System

### Investment Value Analysis (ํˆฌ์ž๊ฐ€์น˜ ํ‰๊ฐ€)

| Factor | Weight | Description |
|--------|--------|-------------|
| ๐Ÿท๏ธ Price | 25% | ์‹œ์„ธ ๋Œ€๋น„ ๊ฐ€๊ฒฉ ํ•ฉ๋ฆฌ์„ฑ |
| ๐Ÿ“ Area | 20% | ํˆฌ์ž ์„ ํ˜ธ ๋ฉด์ ๋Œ€ (20-35ํ‰) |
| ๐Ÿข Floor | 15% | ์ค‘๊ฐ„์ธต~์ค‘์ƒ์ธต ์„ ํ˜ธ๋„ |
| ๐Ÿš‡ Transportation | 25% | ์ง€ํ•˜์ฒ  ์ ‘๊ทผ์„ฑ |
| ๐Ÿ”ฎ Future Value | 15% | ์žฌ๊ฑด์ถ•/๊ฐœ๋ฐœ ๊ฐ€๋Šฅ์„ฑ |

### Quality of Life Analysis (์‚ถ์˜์งˆ๊ฐ€์น˜ ํ‰๊ฐ€)

| Factor | Weight | Description |
|--------|--------|-------------|
| ๐ŸŒณ Environment | 25% | ๊ณต์›, ๋…น์ง€ ์ ‘๊ทผ์„ฑ |
| ๐Ÿช Convenience | 25% | ํŽธ์˜์‹œ์„ค ๊ฐœ์ˆ˜ ๋ฐ ์ ‘๊ทผ์„ฑ |
| ๐Ÿ›ก๏ธ Safety | 20% | ์ธต์ˆ˜, ์น˜์•ˆ, ๊ตํ†ต์•ˆ์ „ |
| ๐ŸŽ“ Education | 15% | ํ•™๊ต, ํ•™์›๊ฐ€ ์ ‘๊ทผ์„ฑ |
| ๐ŸŽญ Culture | 15% | ๋ฌธํ™”์‹œ์„ค ์ ‘๊ทผ์„ฑ |

### Grading System

- **A+ (90-100์ )**: ๋งค์šฐ ์šฐ์ˆ˜ - ๊ฐ•๋ ฅ ์ถ”์ฒœ
- **A (80-89์ )**: ์šฐ์ˆ˜ - ์ถ”์ฒœ
- **B+ (70-79์ )**: ์–‘ํ˜ธ - ์กฐ๊ฑด๋ถ€ ์ถ”์ฒœ
- **B (60-69์ )**: ๋ณดํ†ต - ์‹ ์ค‘ ๊ฒ€ํ† 
- **C (60์  ๋ฏธ๋งŒ)**: ๊ฐœ์„  ํ•„์š” - ๋ณด๋ฅ˜

## ๐Ÿ—๏ธ Architecture

```
๐Ÿ“ A2A-MCP-RealEstate/
โ”œโ”€โ”€ ๐Ÿ“‚ app/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ mcp/                    # FastMCP Servers
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ  real_estate_recommendation_mcp.py  # Main recommendation server
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ location_service.py                # Location analysis server
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ routes/                 # Web API Routes
โ”‚   โ”‚   โ”œโ”€โ”€ ๐ŸŒ web_routes.py       # Web interface routes
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ”ง mcp_routes.py       # MCP API routes
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ utils/                  # Utilities
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ”Œ mcp_client.py       # MCP client utilities
โ”‚   โ”‚   โ”œโ”€โ”€ โš™๏ธ config.py           # Configuration management
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ logger.py           # Logging utilities
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ templates/              # HTML Templates
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ  index.html          # Home page
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿงช mcp_test.html       # MCP testing interface
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿค– agent_test.html     # Agent testing interface
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“Š result templates    # Result display templates
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ main.py                 # FastAPI application
โ”œโ”€โ”€ ๐Ÿ“„ runner.py                   # Application runner
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt            # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ task.md                     # Development tasks
โ””โ”€โ”€ ๐Ÿ“„ README.md                   # This file
```

## ๐Ÿ“ฑ Web Interface

### Home Page
- ์‹œ์Šคํ…œ ๊ฐœ์š” ๋ฐ ์ฃผ์š” ๊ธฐ๋Šฅ ์†Œ๊ฐœ
- MCP ํ…Œ์ŠคํŠธ์™€ Agent ํ…Œ์ŠคํŠธ๋กœ์˜ ์ง์ ‘ ๋งํฌ

### MCP Testing Interface
- ์‹ค๊ฑฐ๋ž˜๊ฐ€ ์กฐํšŒ ๋„๊ตฌ ํ…Œ์ŠคํŠธ
- ์ง€ํ•˜์ฒ ์—ญ ๊ฒ€์ƒ‰ ๋„๊ตฌ ํ…Œ์ŠคํŠธ
- ํŽธ์˜์‹œ์„ค ๊ฒ€์ƒ‰ ๋„๊ตฌ ํ…Œ์ŠคํŠธ
- ์œ„์น˜ ์ ์ˆ˜ ๊ณ„์‚ฐ ๋„๊ตฌ ํ…Œ์ŠคํŠธ

### Agent Testing Interface
- ๋ถ€๋™์‚ฐ ์ •๋ณด ์ž…๋ ฅ ํผ
- ์‹ค์‹œ๊ฐ„ ํˆฌ์ž๊ฐ€์น˜ ๋ฐ ์‚ถ์˜์งˆ ๋ถ„์„
- ์ข…ํ•ฉ ์ถ”์ฒœ ๊ฒฐ๊ณผ ์‹œ๊ฐํ™”
- ์ƒ์„ธ ํ‰๊ฐ€ ๋ฆฌํฌํŠธ

## ๐Ÿ”ง API Keys Setup

### 1. ๊ตญํ† ๊ตํ†ต๋ถ€ ๊ณต๊ณต๋ฐ์ดํ„ฐํฌํ„ธ
1. [๊ณต๊ณต๋ฐ์ดํ„ฐํฌํ„ธ](https://www.data.go.kr/) ํšŒ์›๊ฐ€์ž…
2. "์•„ํŒŒํŠธ ์‹ค๊ฑฐ๋ž˜๊ฐ€ ์ •๋ณด" ํ™œ์šฉ์‹ ์ฒญ
3. ์Šน์ธ๋œ API ํ‚ค๋ฅผ `MOLIT_API_KEY`์— ์„ค์ •

### 2. ๋„ค์ด๋ฒ„ ํด๋ผ์šฐ๋“œ ํ”Œ๋žซํผ
1. [๋„ค์ด๋ฒ„ ํด๋ผ์šฐ๋“œ ํ”Œ๋žซํผ](https://www.ncloud.com/) ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ
2. "Application > Maps" ์„œ๋น„์Šค ์‹ ์ฒญ
3. ํด๋ผ์ด์–ธํŠธ ID๋ฅผ `NAVER_CLIENT_ID`์— ์„ค์ •
4. ํด๋ผ์ด์–ธํŠธ ์‹œํฌ๋ฆฟ์„ `NAVER_CLIENT_SECRET`์— ์„ค์ •

## ๐Ÿ“ˆ Usage Examples

### CLI Example (MCP Server)
```bash
# Start the MCP server
python app/mcp/real_estate_recommendation_mcp.py

# The server will be available for MCP clients
# Example tools: get_real_estate_data, recommend_property, etc.
```

### Web Interface Example
```bash
# Start web server
python runner.py

# Navigate to http://localhost:8080/web/
# 1. Go to "MCP ํ…Œ์ŠคํŠธ" for data query testing
# 2. Go to "Agent ํ…Œ์ŠคํŠธ" for property recommendation
```

### API Example
```python
import httpx

# Get apartment trade data
response = await httpx.post("http://localhost:8080/web/api/mcp/test", json={
    "tool_name": "get_real_estate_data",
    "parameters": {
        "lawd_cd": "11680",  # Gangnam-gu, Seoul
        "deal_ymd": "202401",  # January 2024
        "property_type": "์•„ํŒŒํŠธ"
    }
})
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## ๐Ÿ“ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- **FastMCP**: FastMCP framework for rapid MCP server development
- **๊ตญํ† ๊ตํ†ต๋ถ€**: Real estate transaction data via public data portal
- **์นด์นด์˜ค**: Location and mapping services
- **FastAPI**: Modern web framework for building APIs
- **Bootstrap**: Frontend framework for responsive web design

## ๐Ÿ“ž Support

- ๐Ÿ“ง Issues: [GitHub Issues](https://github.com/your-username/A2A-MCP-RealEstate/issues)
- ๐Ÿ“– Documentation: See `/docs` endpoint when running the server
- ๐Ÿ’ฌ Discussions: [GitHub Discussions](https://github.com/your-username/A2A-MCP-RealEstate/discussions)

---

**๐Ÿ  A2A MCP Real Estate** - Making Korean real estate investment decisions smarter with AI and MCP technology.