
MCP-Stichprobe
Ein Beispielpython -Projekt
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
mcp-sample
A Python-based weather application that provides weather alerts and forecasts using the National Weather Service (NWS) API.
Features
- Get active weather alerts for any US state
- Get detailed weather forecasts for any location using latitude and longitude within the US
- Uses official NWS API for accurate and reliable data
- Runs as an MCP server for seamless integration
Important Note
This application uses the National Weather Service (NWS) API, which only provides weather data for locations within the United States. For international weather data, you would need to modify the application to use a different weather service API.
Installation
This project requires Python 3.10 or higher. To install dependencies:
pip install .
Usage
The application can be used in two ways: as a Python module or as an MCP server.
Using as an MCP Server
The application is designed to run as an MCP server, which allows for seamless integration with MCP clients:
- Run the server:
python weather.py
- The server exposes two MCP tools:
-
get_alerts
: Get weather alerts for a US state# Example MCP client usage result = await mcp.invoke("get_alerts", {"state": "CA"})
-
get_forecast
: Get weather forecast for coordinates# Example MCP client usage result = await mcp.invoke("get_forecast", { "latitude": 37.7749, # San Francisco coordinates "longitude": -122.4194 })
Using as a Python Module
You can also import and use the functions directly in your Python code:
Get Weather Alerts
Get active weather alerts for a US state using its two-letter state code:
from weather import get_alerts
# Get alerts for California
alerts = await get_alerts("CA")
print(alerts)
Get Weather Forecast
Get a detailed weather forecast for a specific location using latitude and longitude:
from weather import get_forecast
# Get forecast for San Francisco (approximate coordinates)
forecast = await get_forecast(37.7749, -122.4194)
print(forecast)
The forecast includes:
- Temperature
- Wind conditions
- Detailed forecast description
- 5-period forecast (typically covering the next few days)
API Details
The application uses the National Weather Service (NWS) API. No API key is required, but we include a User-Agent header as per API requirements. The API only provides data for locations within the United States.
相关推荐
🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.
🧑🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.
⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.
Erstellen Sie einfach LLM -Tools und -Argarten mit einfachen Bash/JavaScript/Python -Funktionen.
😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / diskord / telegram / slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Diffy 、 Claude 、 Gemini 、 xai 、 ppio 、 、 ulama 、 lm Studio 、阿里云百炼、火山方舟、 siliconflow 、 qwen 、 mondshot 、 chatglm 、 sillytraven 、 mcp 等 llm 的机器人 / agent | LLM-basierte Instant Messaging Bots-Plattform, unterstützt Zwietracht, Telegramm, Wechat, Lark, Dingtalk, QQ, Slack
Reviews

user_5XWIEwlJ
I recently tried the mcp-sample and I'm genuinely impressed! The product, crafted by TomShlaim, showcases impeccable design and functionality. It seamlessly integrates and performs beyond expectations. Highly recommend for those in search of reliability and efficiency. A must-have in your tech arsenal!

user_xmq2PmpE
I have been using the mcp-sample for a while now and I must say, it's incredibly efficient and user-friendly. TomShlaim has done an excellent job with this product. Navigating through the interface is a breeze and the features provide great value. I highly recommend it to anyone looking for a reliable solution.

user_Q06K1ssh
I've been using mcp-sample created by TomShlaim for a while now, and it has significantly enhanced my productivity. The tool is intuitive and straightforward to use, making my tasks easier to manage. The initial setup through the provided URL was seamless, and the welcome information was clear and helpful. Overall, I highly recommend mcp-sample to anyone looking for an efficient productivity application!

user_OifWnsB7
As an avid user of the mcp application, I am thoroughly impressed with the mcp-sample by TomShlaim. The intuitive design and seamless functionality truly set it apart. This product has significantly optimised my workflow and provided exceptional value. Highly recommended for anyone seeking a reliable and efficient solution!

user_u8ECjxEK
As a dedicated user of MCP, I find the mcp-sample by TomShlaim to be a valuable resource. This product offers a streamlined experience with its clear instructions and user-friendly interface. Highly recommended for anyone looking to utilize MCP effectively!

user_LEGiXBhW
As a dedicated user of the mcp application, I am thoroughly impressed with mcp-sample by TomShlaim. This tool stands out due to its remarkable efficiency and user-friendly interface. Navigating through its features is seamless, thanks to the intuitive design. The application's performance consistently meets my expectations, making it an invaluable resource for my daily tasks. Highly recommended for anyone seeking reliability and ease of use!

user_8C9TW5Jg
As a loyal user of the mcp-sample, I can confidently say that it's an outstanding product by TomShlaim. The seamless integration and user-friendly interface make it one of the best in its category. The attention to detail and consistent updates reflect the dedication of the author. Highly recommended for anyone looking for a reliable solution!

user_6okCNSXg
I have been using the mcp-sample by TomShlaim, and I am thoroughly impressed with its functionality. The user-friendly interface and efficient performance have greatly simplified my workflow. I highly recommend this product to anyone looking for a reliable solution in this category. The welcome message is a nice touch, creating an inviting experience from the start. Overall, an excellent tool that meets my needs perfectly!