loading…
Search for a command to run...
loading…
Provides integrated access to location-based weather, reporting history, and infrastructure status data for safety reporting systems. It supports both SSE and s
Provides integrated access to location-based weather, reporting history, and infrastructure status data for safety reporting systems. It supports both SSE and stdio protocols for flexible integration with various AI agents and clients.
신고 접수 시스템의 외부 데이터 조회 기능을 Model Context Protocol (MCP)로 제공하는 독립 실행 HTTP 서버입니다.
이 MCP 서버는 SSE (Server-Sent Events) 방식으로 동작하는 독립 HTTP 서버입니다:
cd mcp_server
python3.10 -m venv .venv
# macOS/Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
./start_mcp_server.sh
서버가 http://localhost:3000/sse에서 시작됩니다.
# SSE 서버 (독립 실행 - 권장)
python server_sse.py
# 또는 stdio 서버 (레거시, subprocess 전용)
python server.py
MCP Server (독립 프로세스)
↓ HTTP Server (localhost:3000)
↓ SSE Protocol
Agentic AI Client
↓ HTTP Request
Config: mcp_config.json
Agentic AI 클라이언트는 config/mcp_config.json으로 연결:
{
"mcp_server": {
"url": "http://localhost:3000/sse",
"type": "sse",
"enabled": true,
"timeout": 30
}
}
{
"mcp_server": {
"url": "http://production-server.com:3000/sse",
...
}
}
기존 stdio 방식 server.py를 Claude Desktop에서 사용하는 경우:
~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"external-data-connector": {
"command": "/Users/swkeum/work/mcp_server/.venv/bin/python",
"args": ["/Users/swkeum/work/mcp_server/server.py"]
}
}
}
Note: Agentic AI는 SSE 방식(
server_sse.py)을 사용하므로 Claude Desktop 설정이 필요 없습니다.
MCP 서버의 능력을 조회합니다.
입력: 없음
출력:
{
"server_name": "external-data-connector",
"version": "1.0.0",
"transport": "sse",
"capabilities": {
"tools": [...],
"data_sources": ["weather", "history", "infrastructure"]
}
}
기상 정보를 조회합니다.
입력:
latitude (number): 위도longitude (number): 경도출력:
{
"temperature": 15.5,
"humidity": 65,
"rainfall": 0.0,
"wind_speed": 3.2,
"conditions": "맑음",
"forecast_3h": {
"temperature": 14.0,
"rainfall_probability": 10
}
}
과거 신고 이력을 조회합니다.
입력:
latitude (number): 위도longitude (number): 경도keywords (array): 검색 키워드 리스트radius_km (number, optional): 검색 반경 (기본값: 1.0)출력:
[
{
"report_id": "R001",
"date": "2024-01-15",
"keywords": ["빗물받이", "막힘"],
"risk_level": "보통",
"status": "처리완료",
"distance_km": 0.3
}
]
주변 인프라 상태를 조회합니다.
입력:
latitude (number): 위도longitude (number): 경도keywords (array): 검색 키워드 리스트출력:
{
"drainage_system": {
"status": "정상",
"last_maintenance": "2024-01-01",
"capacity_usage": 45
},
"road_conditions": {
"status": "양호",
"recent_repairs": 2
},
"nearby_facilities": [...]
}
모든 외부 데이터를 한 번에 조회합니다.
입력:
latitude (number): 위도longitude (number): 경도keywords (array): 검색 키워드 리스트출력:
{
"weather": {...},
"history": [...],
"infrastructure": {...}
}
# 서버가 실행 중인지 확인
curl http://localhost:3000/sse
# Agentic AI API를 통해 MCP 능력 조회
curl http://localhost:8000/api/v1/mcp/capabilities
mcp_server/
├── server.py # Stdio 방식 MCP 서버 (레거시)
├── server_sse.py # SSE 방식 MCP 서버 (현재)
├── start_mcp_server.sh # 서버 시작 스크립트
├── requirements.txt # 의존성
├── README.md # 이 파일
├── SSE_GUIDE.md # SSE 방식 상세 가이드
└── .venv/ # 가상 환경
현재는 더미 데이터를 반환하지만, 실제 외부 API와 연동 가능:
# 3000번 포트 사용 중인 프로세스 확인
lsof -i :3000
# 프로세스 종료
kill -9 <PID>
ConnectionError: MCP 서버에 연결할 수 없습니다
해결:
mcp_config.json의 URL 확인MIT License - 자유롭게 사용, 수정, 배포 가능
longitude (number): 경도keywords (array): 검색 키워드 리스트출력:
{
"weather": { /* 기상 정보 */ },
"history": [ /* 신고 이력 */ ],
"infrastructure": { /* 인프라 상태 */ },
"query_timestamp": "2026-02-02T10:30:00"
}
┌─────────────────────┐
│ MCP Client │
│ (Claude Desktop 등) │
└──────────┬──────────┘
│ MCP Protocol
│ (stdio)
┌──────────▼──────────┐
│ MCP Server │
│ (server.py) │
├─────────────────────┤
│ - get_weather_info │
│ - get_report_history│
│ - get_infrastructure│
│ - fetch_all_data │
└──────────┬──────────┘
│
▼
[External APIs]
(향후 실제 API 연동)
agentic_ai 프로젝트의 external_data_connector.py를 MCP 클라이언트로 업데이트하여 이 서버를 호출하도록 수정할 수 있습니다.
from mcp.client import Client
# MCP 클라이언트로 서버에 연결
client = Client(server_path="server.py")
# 기상 정보 조회
result = await client.call_tool("get_weather_info", {
"latitude": 37.5665,
"longitude": 126.9780
})
내부 사용 목적
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"external-data-mcp-server": {
"command": "npx",
"args": []
}
}
}