Weather & Web Search Agent

Weather & Web Search Agent

Provides weather information and web search capabilities with special support for Hugging Face inference providers. Integrates seamlessly with tiny-agents framework for conversational AI interactions.

Category
访问服务器

README

MCP Weather & Web Search Agent

A Model Context Protocol (MCP) server that provides weather information and web search capabilities, designed to work with Hugging Face's tiny-agents framework.

Features

  • Weather Service: Get weather information for any location
  • Web Search: Search the web for information (with special support for Hugging Face inference providers)
  • AI Agent Integration: Works seamlessly with tiny-agents for conversational AI
  • MCP Inspector Support: Debug and inspect server capabilities

Prerequisites

  • Python 3.10 or higher
  • uv package manager
  • Node.js (for MCP inspector)
  • Hugging Face account (for tiny-agents)

Installation

  1. Clone or download this project

    git clone https://github.com/Deon62/mcp.git
    cd mcps
    
  2. Install Python dependencies

    uv pip install mcp[cli] requests
    
  3. Install tiny-agents (if not already installed)

    pip install tiny-agents
    

Quick Start

1. Run the MCP Server

Start the MCP server in one terminal:

uv run --with mcp mcp run server.py

The server will start and wait for connections.

2. Run the AI Agent

In another terminal, start the agent:

tiny-agents run agent.json

You should see:

Agent loaded with 3 tools:
 • get_weather
 • web_search
 • get_hf_inference_providers
»

3. Chat with the Agent

Once the agent is running, you can interact with it:

» Hello! Can you help me find information about Hugging Face inference providers?

Available Tools

1. Weather Service

» What's the weather like in New York?

2. Web Search

» Search for "Hugging Face inference providers"

3. HF Inference Providers

» Get me the list of Hugging Face inference providers

Configuration

Agent Configuration (agent.json)

{
    "model": "Qwen/Qwen2.5-72B-Instruct",
    "provider": "nebius",
    "servers": [
        {
            "type": "stdio",
            "command": "uv",
            "args": ["run", "--with", "mcp", "mcp", "run", "server.py"]
        }
    ]
}

Server Configuration (server.py)

The server provides three main tools:

  • get_weather(location) - Returns weather information
  • web_search(query) - Performs web searches
  • get_hf_inference_providers() - Returns comprehensive list of HF inference providers

MCP Inspector Setup

The MCP Inspector allows you to debug and test your MCP server directly.

1. Install MCP Inspector

npm install -g @modelcontextprotocol/inspector

2. Run the Inspector

mcp-inspector

3. Connect to Your Server

In the inspector:

  1. Click "Add Server"
  2. Choose "stdio" transport
  3. Set command: uv
  4. Set args: ["run", "--with", "mcp", "mcp", "run", "server.py"]
  5. Click "Connect"

4. Test Tools

Once connected, you can:

  • View available tools in the sidebar
  • Test each tool with different parameters
  • See the JSON-RPC communication
  • Debug any issues

Example Usage

Weather Queries

» What's the weather in Tokyo?
» Get weather for London
» How's the weather in San Francisco?

Web Search Queries

» Search for "latest AI developments"
» Find information about "MCP protocol"
» Look up "Hugging Face inference providers"

Specific HF Provider Queries

» Show me all Hugging Face inference providers
» What inference providers does HF support?
» List the available HF deployment options

Troubleshooting

Common Issues

  1. "ModuleNotFoundError: No module named 'mcp'"

    uv pip install mcp[cli]
    
  2. "KeyError: 'command'"

    • Check your agent.json configuration
    • Ensure the server configuration is correct
  3. "Connection closed" errors

    • Make sure the MCP server is running
    • Check that all dependencies are installed
  4. Agent shows "0 tools"

    • Verify the server is running
    • Check the agent.json configuration
    • Ensure the server command is correct

Debug Steps

  1. Test the server directly:

    python server.py
    
  2. Check MCP server with inspector:

    mcp-inspector
    
  3. Verify dependencies:

    uv pip list | grep mcp
    

Project Structure

mcps/
├── server.py          # MCP server implementation
├── agent.json         # Agent configuration
├── requirements.txt   # Python dependencies
├── uv.lock           # Dependency lock file
└── README.md         # This file

Development

Adding New Tools

To add a new tool to the server:

@mcp.tool()
def your_new_tool(param: str) -> str:
    """Description of what this tool does"""
    return f"Result for {param}"

Modifying Agent Configuration

Edit agent.json to:

  • Change the AI model
  • Add more MCP servers
  • Modify server configurations

Hugging Face Inference Providers

The server includes comprehensive information about HF inference providers:

  1. Amazon SageMaker - Serverless inference with custom Inferentia2 chips
  2. Novita AI - Integrated serverless inference directly on model pages
  3. Together AI - Serverless inference with competitive pricing
  4. Nscale - Official HF provider with high-performance GPU clusters
  5. Inference Endpoints - Dedicated, fully managed infrastructure
  6. Google Cloud - Vertex AI and other deployment options
  7. Microsoft Azure - Azure Machine Learning services
  8. Replicate - Easy-to-use model deployment platform
  9. Banana - Serverless GPU inference platform
  10. Modal - Serverless compute platform
  11. RunPod - GPU cloud computing
  12. Lambda Labs - GPU cloud infrastructure

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with both the agent and inspector
  5. Submit a pull request

License

[Add your license information here]

Support

For issues and questions:

  1. Check the troubleshooting section
  2. Use the MCP inspector to debug
  3. Open an issue on GitHub
  4. Check the MCP documentation

**Happy coding! **

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选