MCP-Server
マルチサーバー Model Context Protocol (MCP) デモ
複数の Model Context Protocol (MCP) サーバーを構築し、Groq とリアルタイム OpenWeatherMap データを活用した LangGraph ReAct エージェントと統合する完全なデモンストレーションです。
このプロジェクトは、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コンポーネント
Math MCP サーバー (
mathserver.py):FastMCP で構築。
stdioトランスポート上で動作。算術ツール
add、sub、mul、divを公開。MCP クライアントによってバックグラウンドサブプロセスとして自動起動。
Weather MCP サーバー (
weatherserver.py):FastMCP で構築、
streamable-httpトランスポート(http://127.0.0.1:8000/mcp)上で動作。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: Weather MCP サーバーを起動
気象サーバーは HTTP 経由で通信するため、まずターミナルで起動:
python weatherserver.py気象サーバーは
http://127.0.0.1:8000/mcpで待機を開始します。
ステップ 2: エージェントクライアントを実行
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:公式 Model Context Protocol SDK (FastMCP)langchain-mcp-adapters:LangChain を MCP サーバーに接続langgraph:グラフベースのエージェントオーケストレーションランタイムlangchain-groq:Groq による高速 LLM 推論httpx:非同期 HTTP クライアント(気象 API リクエスト用)python-dotenv:安全な環境変数の読み込み
📄 ライセンス
このプロジェクトはオープンソースで、MIT ライセンス の下で利用可能です。
This server cannot be installed
Maintenance
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
- Flicense-qualityDmaintenanceDemonstrates 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
- Flicense-qualityCmaintenanceA 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.
- Flicense-qualityDmaintenanceAn MCP server that provides weather and web search tools, orchestrated by a LangGraph agent with OpenAI for natural language interaction.8
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.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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