MCP-Server
다중 서버 모델 컨텍스트 프로토콜(MCP) 데모
Groq와 실시간 OpenWeatherMap 데이터로 구동되는 LangGraph ReAct 에이전트와 함께 여러 모델 컨텍스트 프로토콜(MCP) 서버를 구축하고 통합하는 완전한 데모입니다.
이 프로젝트는 LLM 에이전트가 단일 통합 워크플로우에서 서로 다른 MCP 서버와 전송 프로토콜(stdio 및 streamable-http)을 통해 동적으로 도구를 발견하고 소비할 수 있는 방법을 보여줍니다.
🏗️ 아키텍처
flowchart LR
subgraph Agent["LangGraph ReAct Agent (client.py)"]
ChatGroq["LLM: Groq (Qwen / ChatGroq)"]
MultiMCP["MultiServerMCPClient"]
end
subgraph MathServer["Math MCP Server (mathserver.py)"]
MathTools["Tools: add, sub, mul, div"]
end
subgraph WeatherServer["Weather MCP Server (weatherserver.py)"]
WeatherTools["Tool: get_weather (OpenWeatherMap API)"]
end
MultiMCP -- "stdio transport (subprocess)" --> MathServer
MultiMCP -- "streamable-http (http://127.0.0.1:8000/mcp)" --> WeatherServer구성 요소
수학 MCP 서버 (
mathserver.py) :FastMCP로 구축되었습니다.
stdio전송을 통해 실행됩니다.산술 도구를 노출합니다:
add,sub,mul,div.MCP 클라이언트에 의해 백그라운드 하위 프로세스로 자동 실행됩니다.
날씨 MCP 서버 (
weatherserver.py) :http://127.0.0.1:8000/mcp에서streamable-http전송을 통해 실행되는 FastMCP로 구축되었습니다.httpx를 사용하여 OpenWeatherMap API에서 실시간 기상 데이터를 가져옵니다.get_weather도구를 노출합니다 (온도, 날씨 설명, 체감 온도, 습도 반환).
오케스트레이터 클라이언트 (
client.py) :langchain-mcp-adapters의MultiServerMCPClient를 사용하여 두 MCP 서버에 동시에 연결합니다.도구를 조합하고 Groq의 빠른 LLM 추론(
ChatGroq)을 사용하여 LangGraph ReAct 에이전트를 구동합니다.
Related MCP server: AIE8-MCP Server
📁 프로젝트 구조
Mcp_demo/
├── client.py # ReAct Agent & Multi-Server MCP client orchestrator
├── mathserver.py # FastMCP server running on stdio transport
├── weatherserver.py # FastMCP server with OpenWeatherMap API on HTTP transport
├── requirements.txt # Python package dependencies
├── pyproject.toml # Project configuration & metadata
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules (protects .env and caches)
└── README.md # Project documentation🚀 시작하기
1. 사전 요구 사항
Python 3.10+
OpenWeatherMap API 키 (무료 티어)
2. 설치
저장소를 클론하고 종속성을 설치합니다:
git clone https://github.com/sreeshanthkprakash-stack/MCP-Server.git
cd MCP-Server
# Create and activate virtual environment
python -m venv .venv
# On Windows:
.venv\Scripts\activate
# On Linux/macOS:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt3. 환경 구성
루트 디렉토리에 .env 파일을 생성합니다 (또는 .env.example에서 복사):
GROQ_API_KEY=your_groq_api_key_here
OPENWEATHER_API_KEY=your_openweather_api_key_here🧪 애플리케이션 실행
1단계: 날씨 MCP 서버 시작
날씨 서버는 HTTP를 통해 통신하므로, 먼저 터미널에서 시작합니다:
python weatherserver.py날씨 서버가
http://127.0.0.1:8000/mcp에서 수신을 시작합니다.
2단계: 에이전트 클라이언트 실행
두 번째 터미널 창을 열고 (가상 환경이 활성화되어 있는지 확인), 다음을 실행합니다:
python client.py예상 출력 예시
math_response The result of the expression ((15*20)+200)/4 is 125.
weather_response Weather in Hyderabad: haze, temperature 29.5°C (feels like 32.1°C), humidity 65%📦 종속성
mcp: 공식 모델 컨텍스트 프로토콜 SDK (FastMCP)langchain-mcp-adapters: LangChain을 MCP 서버에 연결langgraph: 그래프 기반 에이전트 오케스트레이션 런타임langchain-groq: Groq를 사용한 고속 LLM 추론httpx: 날씨 API 요청을 위한 비동기 HTTP 클라이언트python-dotenv: 안전한 환경 변수 로딩
📄 라이선스
이 프로젝트는 오픈 소스이며 MIT 라이선스에 따라 사용 가능합니다.
This server cannot be deployed
Maintenance
Related MCP Connectors
LLM Orchestration Agent (Mcp)
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
LLM Orchestration MCP Agent
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceDemonstrates custom MCP servers for math and weather operations, enabling multi-agent orchestration using LangChain, Groq, and MCP adapters for both local and remote tool integration.1-
- FlicenseBqualityDmaintenanceAn MCP server that provides web search capabilities through the Tavily API and weather data retrieval tools. It demonstrates how to integrate external APIs into AI applications and build agentic workflows with LangGraph.3-
- FlicenseNot gradedqualityDmaintenanceA demonstration MCP server that provides math (add/multiply) and weather tools, connecting via stdio and streamable HTTP, and integrates with LangChain and LangGraph for agentic workflows.-
- FlicenseNot gradedqualityCmaintenanceAn MCP server that provides math tools (add, subtract, multiply) and a weather tool, with a LangChain agent client that uses Groq to answer natural language queries.-