MCP服务器

MCP服务器是一个用于处理天气数据和计算的服务,支持多服务器并行运行。

  • by NilupulNishan
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 NilupulNishan/mcp-server-langgraph

使用说明

MCP 服务器

视频教程(印地语):https://youtu.be/_KB2146fFYs

这里有一个公共MCP服务器列表:

👉 https://github.com/modelcontextprotocol/servers

👉 Weather MCP Server — https://github.com/mschneider82/mcp-openweather

环境设置:

设置天气MCP服务器:
Step 1 – Install Go: https://go.dev/dl/

Step 2 - Clone and Build

	git clone https://github.com/mschneider82/mcp-openweather.git

	cd mcp-openweather
	
	go build -o mcp-weather

Step 3 – Get OpenWeatherMap API Key
	1.	Visit https://openweathermap.org/api
	2.	Create a free account.
	3.	Copy your API key (called appid).
	4.	If it doesn’t work right away — wait a few hours.
在本地运行MCP服务器:
./mcp-weather  (⚠️ Keep this terminal running, this is your MCP server.)


pip install python-dotenv langchain-mcp-adapters langgraph "langchain[openai]" mcp 
pip install mcp-server-calculator
添加第二个MCP服务器-计算器
Install:

	pip install mcp-server-calculator
	
Run in separate terminals:

	Terminal 1 — Weather MCP Server
	
		.\mcp-weather.exe

	Terminal 2 — Calculator MCP Server
	
		python -m mcp_server_calculator

	Terminal 3 — Your Client
	
		python 1.py