
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
yujie-weather-mcp-server
Advanced tools
A simple MCP server for weather queries with AI integration
一个简单的 MCP (Model Context Protocol) 服务器,提供天气查询功能并集成AI模型生成友好的天气报告。
cd weather-mcp-server
npm install
npm start
或者使用开发模式(自动重启):
npm run dev
目前支持以下城市(中英文均可):
获取指定城市的天气信息并生成AI增强的天气报告。
参数:
city
(string, 必需): 城市名称示例调用:
{
"name": "get_weather",
"arguments": {
"city": "北京"
}
}
返回示例:
🌤️ 北京 天气报告
今天北京的天气晴天,温度15°C,湿度45%。天气有点凉,建议多穿一件衣服。
📊 详细数据:
• 温度:15°C
• 天气:晴天
• 湿度:45%
@modelcontextprotocol/sdk
实现标准的 MCP 协议替换 WEATHER_DATA
为真实的天气API调用:
async function getWeatherData(city) {
const response = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=YOUR_API_KEY`);
return await response.json();
}
替换 callAIModel
函数为真实的AI API调用:
async function callAIModel(weatherData, city) {
const response = await fetch('https://api.openai.com/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-3.5-turbo',
messages: [
{
role: 'user',
content: `请根据天气信息生成友好的天气报告:${JSON.stringify(weatherData)}`
}
]
})
});
const data = await response.json();
return data.choices[0].message.content;
}
MIT License
FAQs
A simple MCP server for weather queries with AI integration
The npm package yujie-weather-mcp-server receives a total of 0 weekly downloads. As such, yujie-weather-mcp-server popularity was classified as not popular.
We found that yujie-weather-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.