Skip to main content
Glama

다중 서버 모델 컨텍스트 프로토콜(MCP) 데모

Groq와 실시간 OpenWeatherMap 데이터로 구동되는 LangGraph ReAct 에이전트와 함께 여러 모델 컨텍스트 프로토콜(MCP) 서버를 구축하고 통합하는 완전한 데모입니다.

이 프로젝트는 LLM 에이전트가 단일 통합 워크플로우에서 서로 다른 MCP 서버와 전송 프로토콜(stdiostreamable-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

구성 요소

  1. 수학 MCP 서버 (mathserver.py) :

    • FastMCP로 구축되었습니다.

    • stdio 전송을 통해 실행됩니다.

    • 산술 도구를 노출합니다: add, sub, mul, div.

    • MCP 클라이언트에 의해 백그라운드 하위 프로세스로 자동 실행됩니다.

  2. 날씨 MCP 서버 (weatherserver.py) :

    • http://127.0.0.1:8000/mcp에서 streamable-http 전송을 통해 실행되는 FastMCP로 구축되었습니다.

    • httpx를 사용하여 OpenWeatherMap API에서 실시간 기상 데이터를 가져옵니다.

    • get_weather 도구를 노출합니다 (온도, 날씨 설명, 체감 온도, 습도 반환).

  3. 오케스트레이터 클라이언트 (client.py) :

    • langchain-mcp-adaptersMultiServerMCPClient를 사용하여 두 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. 사전 요구 사항

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.txt

3. 환경 구성

루트 디렉토리에 .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 라이선스에 따라 사용 가능합니다.

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sreeshanthkprakash-stack/MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server