Skip to main content
Glama

Weather MCP Server

MCP_INTEGRATION.md4.64 kB
# MCP Integration Guide This guide explains how to integrate your Weather MCP Server with MCP clients like Cursor, VS Code, or other AI assistants. ## What is MCP? Model Context Protocol (MCP) allows AI assistants to interact with external tools and data sources. Your weather server provides weather alerts and echo functionality through MCP. ## Quick Setup ### 1. Basic Configuration (Recommended) Copy the `mcp.json` file to your Cursor configuration directory: **Windows:** ``` %APPDATA%\Cursor\User\mcp.json ``` **macOS:** ``` ~/Library/Application Support/Cursor/User/mcp.json ``` **Linux:** ``` ~/.config/Cursor/User/mcp.json ``` ### 2. Advanced Configuration For more options, use `mcp_advanced.json` which includes: - Multiple server configurations - Environment variable settings - Automatic startup options ## Configuration Options ### Basic Configuration (`mcp.json`) ```json { "mcpServers": { "weather-server": { "command": "python", "args": ["main.py"], "cwd": ".", "env": { "PYTHONPATH": "." } } } } ``` ### Advanced Configuration (`mcp_advanced.json`) ```json { "mcpServers": { "weather-server": { "command": "python", "args": ["main.py"], "cwd": ".", "env": { "PYTHONPATH": ".", "PYTHONUNBUFFERED": "1" }, "description": "Weather MCP Server providing weather alerts and echo functionality" } }, "mcpClient": { "defaultServer": "weather-server", "autoStart": true, "logLevel": "info" } } ``` ## Available Tools Once integrated, you'll have access to these tools in Cursor: ### 1. Weather Alerts - **Tool**: `get_alerts` - **Description**: Get weather alerts for any US state - **Usage**: Provide a two-letter state code (e.g., "CA", "NY", "TX") - **Example**: "Get weather alerts for California" ### 2. Echo Resource - **Tool**: `echo_resource` - **Description**: Echo a message as a resource - **Usage**: Provide any text message - **Example**: "Echo the message 'Hello World'" ## Testing Integration ### 1. Start Cursor 2. **Check MCP Status**: Look for MCP server status in the bottom status bar 3. **Test Tools**: Try asking Cursor to: - "Get weather alerts for Texas" - "Echo the message 'MCP integration test'" ### 2. Verify Server is Running The MCP server should start automatically when Cursor starts. You can verify by: - Checking the Cursor output panel for MCP messages - Looking for the weather server process in your system ## Troubleshooting ### Common Issues 1. **Server Won't Start** - Ensure Python 3.12+ is installed - Run `uv sync` to install dependencies - Check file paths in mcp.json 2. **Tools Not Available** - Restart Cursor after configuration changes - Check MCP server status in Cursor - Verify the server started without errors 3. **Import Errors** - Ensure `PYTHONPATH` is set correctly - Check that all dependencies are installed - Verify the working directory (`cwd`) is correct ### Debug Steps 1. **Test Server Manually**: ```bash python main.py ``` 2. **Check Cursor Logs**: - Open Command Palette (Ctrl+Shift+P) - Search for "Developer: Toggle Developer Tools" - Check Console for MCP-related errors 3. **Verify Configuration**: - Ensure mcp.json is in the correct location - Check JSON syntax is valid - Verify file paths are correct ## Alternative Configurations ### Using UV Package Manager ```json { "mcpServers": { "weather-server": { "command": "uv", "args": ["run", "python", "main.py"], "cwd": "." } } } ``` ### Direct Module Execution ```json { "mcpServers": { "weather-server": { "command": "python", "args": ["-m", "server.weather"], "cwd": "." } } } ``` ## Benefits of MCP Integration - **Seamless Access**: Use weather tools directly in Cursor - **Real-time Data**: Get live weather alerts without leaving your editor - **AI Integration**: Let AI assistants use your weather data - **Extensible**: Easy to add more tools and functionality ## Next Steps 1. **Test Basic Integration**: Try the weather alerts and echo tools 2. **Add More Tools**: Extend your server with additional functionality 3. **Customize UI**: Modify the web interface for your needs 4. **Deploy**: Consider deploying your server for team use ## Support If you encounter issues: 1. Check this troubleshooting guide 2. Verify your configuration matches the examples 3. Test the server manually first 4. Check Cursor's MCP documentation Your weather server is now ready to integrate with MCP clients! 🌤️✨

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/onceagainarise/MCP-second-project-weather-forecaster-'

If you have feedback or need assistance with the MCP directory API, please join our Discord server