Token导航 LogoToken导航TokenDH.com
Agent Weatherman logo
AI代理未说明官方级别未说明来源级核验

Agent Weatherman

MCP Server

一个基于AI的天气代理,结合GitHub Models LLM和MCP服务器提供实时天气数据和对话式天气预报。

工具数

2

提示词数

0

GitHub Stars

0

资源数

0
C#实时数据Docker

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

StephenDryden

提供方

StephenDryden

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

气象员🌤️

一个用C#构建的复杂的人工智能天气代理,将GitHub Models LLM与MCP(模型上下文协议)服务器相结合,用于实时天气数据。该代理充当友好的气象员,提供对话式的天气预报和见解。

特性

  • 🤖 AI驱动的对话:使用GitHub模型API(GPT-4o-mini)进行自然语言交互
  • 🌦️ 实时天气数据:连接到MCP服务器以获取当前天气和预报
  • 🐳 Docker就绪:容器化,便于部署到AWS ECS或任何容器平台
  • 最小配置:使用环境变量进行简单设置
  • 📱 交互式控制台:类似聊天的天气查询界面
  • 🔗 MCP协议:与气象数据源进行基于标准的通信

建筑

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│  Weather Agent  │───▶│  GitHub Models  │    │   MCP Server    │
│   (Console UI)  │    │   LLM API       │    │ (Weather Data)  │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                        │                        │
         └────────────────────────┼────────────────────────┘
                                  │
                            WebSocket/HTTP

先决条件

  • .NET 8.0 SDK
  • 码头工人 (用于集装箱化)
  • 具有适当的权限
  • MCP天气服务器在WebSocket上运行(默认: ws://localhost:3000)

快速开始

1.克隆和构建

git clone https://github.com/StephenDryden/agent-weatherman.git
cd agent-weatherman
make all  # or: dotnet build && docker build -t agent-weatherman .

2.配置

设置您的GitHub令牌:

export GITHUB_TOKEN="your-github-personal-access-token"

3.运行代理

选项A:在本地运行

make run
# or manually:
export WEATHERAGENT_AgentSettings__GitHubToken="$GITHUB_TOKEN"
export WEATHERAGENT_AgentSettings__McpServerUrl="ws://localhost:3000"
dotnet run --project AgentWeatherman/AgentWeatherman.csproj

选项B:使用Docker运行

make docker-build
make docker-run-local

配置

代理可以通过环境变量或 appsettings.json:

环境变量

变量描述默认值
WEATHERAGENT_AgentSettings__GitHubTokenGitHub个人访问令牌必填
WEATHERAGENT_AgentSettings__McpServerUrlMCP服务器WebSocket URLws://localhost:3000
WEATHERAGENT_AgentSettings__ModelNameGitHub模型名称gpt-4o-mini
WEATHERAGENT_AgentSettings__MaxTokens每个响应的最大令牌数1000
WEATHERAGENT_AgentSettings__TemperatureLLM温度(0.0-1.0)0.7

应用程序参数

{
  "AgentSettings": {
    "GitHubToken": "your-token-here",
    "GitHubModelsEndpoint": "https://models.inference.ai.azure.com",
    "ModelName": "gpt-4o-mini",
    "McpServerUrl": "ws://localhost:3000",
    "MaxTokens": 1000,
    "Temperature": 0.7
  }
}

使用示例

运行后,您可以自然地与天气代理交互:

You: What's the weather like in London today?

🌤️ Weather Agent: Good morning! Let me check the current weather in London for you.

Looking at the conditions right now, London is experiencing partly cloudy skies with a temperature of 18°C (64°F). There's a gentle breeze from the southwest at about 12 km/h, and humidity is sitting at a comfortable 65%.

For today, you can expect the temperature to reach a pleasant 22°C (72°F) this afternoon with the clouds gradually clearing. It's a great day for outdoor activities! I'd recommend a light jacket for the morning, but you should be comfortable in just a t-shirt by midday.

Would you like me to check the forecast for the next few days as well?

Docker部署

构建并运行

# Build the Docker image
make docker-build

# Run with local MCP server
make docker-run-local

# Run with remote MCP server
MCP_SERVER_URL="ws://your-mcp-server:3000" make docker-run

AWS ECR部署

# Set AWS credentials and region
export AWS_ACCOUNT_ID="123456789012"
export AWS_REGION="us-west-2"

# Login to ECR and push
make ecr-login
make ecr-push

MCP服务器集成

代理需要一个提供天气工具的MCP服务器。服务器应实现:

所需工具

  1. get_current天气

- 参数: location (字符串) - 返回:当前天气状况

  1. get_weather_forecast

- 参数: location (字符串), days (编号) - 返回:多日天气预报

MCP协议

代理通过WebSocket使用标准MCP协议进行通信:

{
  "jsonrpc": "2.0",
  "id": "unique-id",
  "method": "tools/call",
  "params": {
    "name": "get_current_weather",
    "arguments": {
      "location": "London, UK"
    }
  }
}

发展

项目结构

AgentWeatherman/
├── Models/
│   ├── Configuration/     # Settings and configuration
│   ├── GitHub/           # GitHub Models API DTOs
│   └── Mcp/             # MCP protocol models
├── Services/
│   ├── GitHubLlmService.cs      # GitHub Models API client
│   ├── McpClientService.cs      # MCP protocol client
│   └── WeatherAgentService.cs   # Main agent orchestrator
├── Program.cs           # Application entry point
└── appsettings.json    # Default configuration

可用的生成命令

make help              # Show all available commands
make build             # Build the solution
make run               # Run locally
make docker-build      # Build Docker image
make docker-run-local  # Run container with local MCP server
make clean             # Clean build artifacts
make test              # Run tests

添加新功能

  1. 新型LLM模型:更新 ModelName 在配置中
  2. 其他天气工具:扩展 McpClientService 采用新的工具方法
  3. 增强对话:修改中的系统提示 WeatherAgentService

故障排除

常见问题

  1. GitHub API身份验证错误

- 验证您的GitHub令牌是否具有正确的权限 - 支票令牌尚未过期

  1. MCP服务器连接失败

- 确保MCP服务器正在运行且可访问 - 验证WebSocket URL格式: ws://host:port

  1. Docker网络问题

- 使用 --network host 用于本地MCP服务器 - 确保远程服务器的容器网络正常

日志记录

该应用程序使用结构化日志记录。通过以下方式设置日志级别:

export DOTNET_ENVIRONMENT="Development"  # Verbose logging
# or
export Logging__LogLevel__Default="Debug"

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 如果适用,添加测试
  5. 提交拉取请求

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

支持

对于问题和疑问:

  • 在GitHub上创建问题
  • 检查上面的故障排除部分
  • 查看MCP服务器文档以了解集成详细信息

目录标签

目录标签

C#实时数据DockerAI天气本地部署对话交互Docker部署MCP协议

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP