mcp-lightning-lesson
MCP server from rafaelpierre/mcp-lightning-lesson
claude mcp add --transport stdio rafaelpierre-mcp-lightning-lesson python main.py \ --env OPENAI_API_KEY="your-openai-api-key"
How to use
This MCP server demonstrates running a Python-based agent system that uses OpenAI GPT models to query real-world data. The main workflow fetches a weather forecast for Hintertux, Austria from meteoblue via a custom agent and also retrieves the current time using an example tool (get_time). The server exposes structured JSON output suitable for downstream consumption by applications that expect machine-readable weather, time, and related context. To operate, ensure your environment has Python and the required dependencies installed, and provide your OpenAI API key so the agent can perform reasoning with the GPT models. You can interact with the running MCP server by executing the main.py script; it will orchestrate the agent, fetch data, and emit a JSON payload containing the results.
How to install
Prerequisites:
- Python 3.13+
- OpenAI API key
- Internet access to fetch data from meteoblue and call OpenAI endpoints
Installation steps:
-
Clone the repository: git clone ... cd mcp-lightning-lesson
-
Create and activate a virtual environment (using your preferred tool; uv is demonstrated in the project): python -m venv venv source venv/bin/activate # on Unix/macOS
On Windows use: venv\Scripts\activate
-
Install dependencies: pip install -r requirements.txt # if such a file exists
If no requirements.txt is present, install explicitly:
pip install openai-agents>=0.0.15 python-dotenv>=1.1.0
-
Copy the example environment file and set your API key: cp .env.example .env
Edit .env and set OPENAI_API_KEY
-
Run the application (as shown in the project): uv run python main.py
Notes:
- If you prefer a direct Python execution without uv, you can run: python main.py
- Ensure your OpenAI API key is valid and has access to the needed models.
Additional notes
Tips and common considerations:
- Environment variable OPENAI_API_KEY is required for the agent to access OpenAI models.
- The workflow fetches a weather forecast for Hintertux, Austria and also retrieves the current time via a tool; ensure network access to meteoblue data sources as configured by the agent.
- If you encounter rate limits or API key issues, check your OpenAI usage limits and the meteoblue data source accessibility.
- The output is a structured JSON payload; adapt downstream consumers to parse fields representing weather, time, and related context.
- If you modify dependencies, re-install and re-test to ensure compatibility with openai-agents and python-dotenv.
Related MCP Servers
mcp-agent
Build effective agents using Model Context Protocol and simple workflow patterns
nerve
The Simple Agent Development Kit.
MCP-Bridge
A middleware to provide an openAI compatible endpoint that can call MCP tools
AutoDocs
We handle what engineers and IDEs won't: generating and maintaining technical documentation for your codebase, while also providing search with dependency-aware context to help your AI tools understand your codebase and its conventions.
ScreenMonitorMCP
A REVOLUTIONARY Model Context Protocol (MCP) server! Gives AI real-time vision capabilities and enhanced UI intelligence power. This isn't just screen capture - it gives AI the power to truly "see" and understand your digital world!
symfony
A Symfony package designed for building secure servers based on the Model Context Protocol, utilizing Server-Sent Events (SSE) and/or StreamableHTTP for real-time communication. It offers a scalable tool system tailored for enterprise-grade applications.