MCP Servers

模型上下文协议服务器、框架、SDK 和模板的综合目录。

L
Llamaindex MCP Openweather Agent

This project demonstrates how to use LlamaIndex with the MCP tool integration to enable LLM agents to fetch live weather information using the OpenWeather API.

创建于 10/6/2025
更新于 2 months ago
Repository documentation and setup instructions

MCP + LlamaIndex Example: Weather Agent with OpenWeather API

Overview

This project demonstrates how to use LlamaIndex with the MCP tool integration to enable LLM agents to fetch live weather information using the OpenWeather API.

Features

  • Real-Time Weather Retrieval:
    The agent dynamically accesses the OpenWeather API via an MCP server and can answer any location-based weather query.

  • LlamaIndex & MCP Integration:
    Leverages the FunctionAgent workflow with external tool calls for flexible and scalable augmentation of LLM agents.

  • Fully Customizable:
    Adapt the agent to any external API simply by exposing new MCP tools—demonstrates rapid AI engineering capability.


Usage

# get the code
git clone https://github.com/teddytesfa/llamaindex-mcp-openweather-agent
cd llamaindex-mcp-openweather-agent

# create a virtual environment
python3 -m venv venv
source venv/bin/activate

# install dependencies
pip install  "mcp>=1.9.1,<2" python-dotenv llama_index llama-index-tools-mcp llama-index-llms-google-genai

cp .env.example .env
# NOTE: edit the .env file to have the correct values!

# run the server
python mcp_server.py --server_type=sse
  • Setup .env containing your OpenAI API key and OpenWeather API key.

  • Ensure a valid MCP server is running and exposes a fetch_weather tool using OpenWeather API.

  • Run the notebook (mcp_openweather.ipynb) and ask weather-related questions interactively.


Example

User: What's the weather in Addis Ababa? Agent: The current weather in Addis Ababa is clear sky, with a temperature of 21.7°C and 37% humidity.


Author: Teddy Tesfa | AI Engineer
See more at https://github.com/teddytesfa

快速设置
此服务器的安装指南

安装命令 (包未发布)

git clone https://github.com/teddytesfa/llamaindex-mcp-openweather-agent
手动安装: 请查看 README 获取详细的设置说明和所需的其他依赖项。

Cursor 配置 (mcp.json)

{ "mcpServers": { "teddytesfa-llamaindex-mcp-openweather-agent": { "command": "git", "args": [ "clone", "https://github.com/teddytesfa/llamaindex-mcp-openweather-agent" ] } } }