A Python project demonstrating the use of OpenAI GPT models and MCP (Model Context Protocol) agents to fetch and process real-world data.
This project provides an example of using a custom agent to retrieve weather forecasts for Hintertux, Austria, by fetching data from the meteoblue.com website. It leverages the openai-agents
library and its capabilities to run and expose MCP Servers.
- Custom agent implementation using OpenAI GPT models
- Integration with MCP server for data fetching
- Example function tool (
get_time
) for current time retrieval - Returns structured JSON output
- Python 3.13+
- OpenAI API key
- Clone the repository:
git clone ... cd mcp-lightning-lesson
- Create a venv using uv:
uv venv
- Copy the example environment file and add your OpenAI API key:
cp .env.example .env # Edit .env and set your OPENAI_API_KEY
Run the main script:
uv run python main.py
The agent will:
- Fetch the weather forecast for Hintertux, Austria
- Get the current time
- Return the results as a JSON payload
main.py
– Main application logicpyproject.toml
– Project dependencies and metadata.env.example
– Example environment variable file
- openai-agents >= 0.0.15
- python-dotenv >= 1.1.0
Coming soon!