Discover Awesome MCP Servers

Extend your agent with 17,185 capabilities via MCP servers.

All17,185
mcp_server

mcp_server

Okay, I understand. You want me to describe how to implement a weather MCP (Message Client Protocol) server that can be called by a client IDE like Cursor. Here's a breakdown of the implementation, covering key aspects and considerations: **1. Understanding the Requirements** * **MCP (Message Client Protocol):** MCP is a relatively simple protocol, often used for communication between applications. It's typically text-based and uses delimiters to separate messages. We'll need to define the specific MCP format for our weather server. * **Weather Data Source:** You'll need a reliable source of weather data. This could be: * **A free weather API:** Examples include OpenWeatherMap, WeatherAPI.com (check their free tiers and usage limits). * **A paid weather API:** Provides more features, higher limits, and potentially better accuracy. * **A local weather data file:** For testing or if you have your own data source. * **Client IDE (Cursor):** The server needs to be designed so that Cursor can easily send requests and receive responses. This means using a standard communication method (like TCP sockets) and a well-defined MCP format. * **Functionality:** At a minimum, the server should be able to: * Get the current weather for a given location (e.g., city, zip code, latitude/longitude). * Potentially provide a forecast for a given location. **2. Defining the MCP Format** This is crucial. Let's define a simple MCP format for our weather server. We'll use a newline character (`\n`) as the delimiter between messages. * **Request Format (Client to Server):** ``` GET_WEATHER <location>\n GET_FORECAST <location>\n ``` * `GET_WEATHER`: Requests the current weather for the specified location. * `GET_FORECAST`: Requests a weather forecast for the specified location. * `<location>`: The location to get weather data for (e.g., "London", "90210", "40.7128,-74.0060"). You'll need to decide how you want to handle different location formats. * **Response Format (Server to Client):** ``` WEATHER <location> <temperature> <condition> <humidity>\n FORECAST <location> <day1_condition> <day1_high> <day1_low> <day2_condition> ...\n ERROR <message>\n ``` * `WEATHER`: Indicates the current weather data. * `<location>`: The location the weather data is for. * `<temperature>`: The current temperature (e.g., in Celsius or Fahrenheit). * `<condition>`: A brief description of the weather (e.g., "Sunny", "Cloudy", "Rainy"). * `<humidity>`: The current humidity (e.g., as a percentage). * `FORECAST`: Indicates the weather forecast data. * `<location>`: The location the forecast is for. * `<day1_condition>`, `<day1_high>`, `<day1_low>`, etc.: Forecast data for each day. You'll need to define how many days of forecast you'll provide and the format of the data. * `ERROR`: Indicates an error occurred. * `<message>`: A description of the error. **3. Server Implementation (Python Example)** Here's a basic Python example using the `socket` module. This is a simplified version; you'll need to add error handling, more robust data parsing, and potentially threading for handling multiple clients concurrently. ```python import socket import json # For parsing JSON responses from weather APIs import requests # For making HTTP requests to weather APIs # Configuration HOST = '127.0.0.1' # Standard loopback interface address (localhost) PORT = 65432 # Port to listen on (non-privileged ports are > 1023) WEATHER_API_KEY = "YOUR_OPENWEATHERMAP_API_KEY" # Replace with your API key WEATHER_API_URL = "http://api.openweathermap.org/data/2.5/weather?q={}&appid={}&units=metric" # Example URL def get_weather_data(location): """Fetches weather data from a weather API.""" try: url = WEATHER_API_URL.format(location, WEATHER_API_KEY) response = requests.get(url) response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) data = response.json() temperature = data['main']['temp'] condition = data['weather'][0]['description'] humidity = data['main']['humidity'] return temperature, condition, humidity except requests.exceptions.RequestException as e: print(f"Error fetching weather data: {e}") return None, None, None except (KeyError, IndexError) as e: print(f"Error parsing weather data: {e}") return None, None, None def handle_client(conn, addr): """Handles communication with a single client.""" print(f"Connected by {addr}") while True: data = conn.recv(1024) # Receive data from the client if not data: break # Client disconnected message = data.decode('utf-8').strip() print(f"Received: {message}") if message.startswith("GET_WEATHER"): try: location = message.split(" ")[1] temperature, condition, humidity = get_weather_data(location) if temperature is not None: response = f"WEATHER {location} {temperature} {condition} {humidity}\n" else: response = f"ERROR Could not retrieve weather for {location}\n" except IndexError: response = "ERROR Invalid request format. Use GET_WEATHER <location>\n" except Exception as e: response = f"ERROR An unexpected error occurred: {e}\n" elif message.startswith("GET_FORECAST"): # Implement forecast logic here (similar to GET_WEATHER) location = message.split(" ")[1] response = f"ERROR Forecast functionality not yet implemented for {location}\n" else: response = "ERROR Invalid command\n" conn.sendall(response.encode('utf-8')) # Send the response back to the client conn.close() print(f"Connection closed with {addr}") def main(): """Main server function.""" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() print(f"Listening on {HOST}:{PORT}") while True: conn, addr = s.accept() # Accept incoming connections handle_client(conn, addr) # Handle the client in a separate function (or thread) if __name__ == "__main__": main() ``` Key improvements and explanations: * **Error Handling:** Includes `try...except` blocks to catch potential errors during API requests, JSON parsing, and other operations. This prevents the server from crashing and provides more informative error messages to the client. * **Weather API Integration:** Uses the `requests` library to make HTTP requests to a weather API (OpenWeatherMap in this example). You'll need to replace `"YOUR_OPENWEATHERMAP_API_KEY"` with your actual API key. The `get_weather_data` function handles the API call and parses the JSON response. * **JSON Parsing:** Uses the `json` library to parse the JSON response from the weather API. * **Clearer Response Messages:** The server now sends more informative error messages to the client when something goes wrong. * **`handle_client` Function:** The code that handles communication with a single client is now in a separate function, `handle_client`. This makes the code more organized and easier to read. * **UTF-8 Encoding:** Explicitly encodes and decodes messages using UTF-8 to handle a wider range of characters. * **`response.raise_for_status()`:** This line in `get_weather_data` is important. It raises an `HTTPError` if the API returns a bad status code (4xx or 5xx), which indicates a problem with the request or the API itself. * **`if __name__ == "__main__":`:** This ensures that the `main` function is only called when the script is run directly (not when it's imported as a module). **4. Client Implementation (Cursor IDE)** You'll need to write code within Cursor to connect to the server, send requests, and display the responses. Here's a conceptual outline (the exact code will depend on Cursor's API and capabilities): ```python import socket HOST = '127.0.0.1' PORT = 65432 def get_weather(location): """Gets weather data from the server.""" try: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) request = f"GET_WEATHER {location}\n" s.sendall(request.encode('utf-8')) data = s.recv(1024) response = data.decode('utf-8').strip() return response except Exception as e: return f"Error: {e}" # Example usage (within Cursor): location = "London" # Or get the location from user input in Cursor weather_data = get_weather(location) print(weather_data) # Display the weather data in Cursor's output window ``` **5. Key Considerations and Enhancements** * **Threading/Asynchronous Handling:** For a production server, use threading or asynchronous I/O (e.g., `asyncio` in Python) to handle multiple client connections concurrently. The basic example above handles only one client at a time. * **Error Handling:** Implement robust error handling on both the client and server sides. Handle network errors, API errors, invalid input, etc. * **Input Validation:** Validate the location input to prevent errors and potential security issues. * **Security:** If you're exposing the server to the internet, consider security measures like authentication and authorization. For local development, this is less critical. * **Configuration:** Use a configuration file (e.g., a `.ini` or `.json` file) to store settings like the host, port, API key, and other parameters. This makes the server more flexible and easier to configure. * **Logging:** Implement logging to track server activity, errors, and other important events. This is helpful for debugging and monitoring. * **Data Caching:** Cache weather data to reduce the number of API calls and improve performance. Use a caching library like `cachetools` or `redis`. * **More Sophisticated MCP:** Consider a more structured MCP format using JSON or another data serialization format for more complex data structures. However, keep it relatively simple for ease of implementation. * **Unit Testing:** Write unit tests to ensure that the server is working correctly. **Example Interaction** 1. **Client (Cursor) sends:** `GET_WEATHER London\n` 2. **Server receives:** `GET_WEATHER London` 3. **Server fetches weather data for London from the API.** 4. **Server sends:** `WEATHER London 15 Cloudy 80\n` (if the temperature is 15 degrees, the condition is cloudy, and the humidity is 80%) 5. **Client (Cursor) receives:** `WEATHER London 15 Cloudy 80` 6. **Client (Cursor) displays:** "Weather in London: 15 degrees, Cloudy, Humidity: 80%" This detailed explanation and the Python example should give you a solid foundation for building your weather MCP server. Remember to adapt the code and the MCP format to your specific needs and the capabilities of Cursor. Good luck!

MMA MCP Server

MMA MCP Server

Enables users to search and query information about military service alternative companies in South Korea through the Military Manpower Administration (MMA) API. Supports filtering by service type, industry, company size, location, and recruitment status.

Agent MCP BrightData

Agent MCP BrightData

An intelligent agent using the Model Context Protocol to iteratively explore and analyze websites in a structured way, with built-in duplicate protection and conversational interface.

MCP Server on Cloudflare Workers & Azure Functions

MCP Server on Cloudflare Workers & Azure Functions

A deployable MCP server for Cloudflare Workers or Azure Functions that provides example tools (time, echo, math), prompt templates for code assistance, and configuration resources. Enables AI assistants to interact with edge-deployed services through the Model Context Protocol.

Bilibili MCP Server

Bilibili MCP Server

Enables interaction with Bilibili (B站) platform through API and web scraping. Supports video search, article search, video info retrieval, comment fetching, danmaku extraction, and article content access.

Tiger MCP

Tiger MCP

Enables trading and market analysis through Tiger Brokers API integration. Provides real-time market data, portfolio management, order execution, and technical analysis tools with a comprehensive web dashboard for monitoring.

Minecraft MCP Server

Minecraft MCP Server

A client library that connects AI agents to Minecraft servers, providing full game control with 30 verified skills for common tasks including movement, combat, crafting, and building.

UK Bus Departures MCP Server

UK Bus Departures MCP Server

Enables users to get real-time UK bus departure information and validate bus stop ATCO codes by scraping bustimes.org. Provides structured data including service numbers, destinations, scheduled and expected departure times for any UK bus stop.

MCP Perplexity Server

MCP Perplexity Server

Provides AI-powered search, research, and reasoning capabilities through integration with Perplexity.ai, offering three specialized tools: general conversational AI, deep research with citations, and advanced reasoning.

MCP Server with Azure Communication Services Email

MCP Server with Azure Communication Services Email

Azure Communication Services - Email MCP (MCP pode se referir a "Managed Communication Provider" ou outro termo específico dependendo do contexto. Se for o caso, forneça mais contexto para uma tradução mais precisa.)

termiAgent

termiAgent

termiAgent é um assistente de linha de comando impulsionado por LLM que fornece configurações de função de plug-in para criar fluxos de trabalho para diferentes tarefas. Ao mesmo tempo, é um mcp-client que pode se conectar livremente aos seus mcp-servers.

Memory-IA MCP Server

Memory-IA MCP Server

Enables AI agents with persistent memory using SQLite and local LLM models through Ollama integration. Provides chat with context retention and multi-client support across VS Code, Gemini-CLI, and terminal interfaces.

BANANA-MCP

BANANA-MCP

An All-in-One Model Context Protocol Server Package that integrates 14 MCP servers (including YouTube, GitHub, Figma, databases) into a single Docker container for use with Claude.

Model Context Protocol (MCP) + Spring Boot Integration

Model Context Protocol (MCP) + Spring Boot Integration

Testando um novo recurso do servidor MCP usando Spring Boot.

Doctah-MCP

Doctah-MCP

Enables AI assistants to search and access Arknights game data including operator information, enemy intelligence, skills, talents, and attributes through PRTS.wiki integration. Provides fuzzy search functionality for operators and enemies with clean Markdown output.

🚀 Wayland MCP Server

🚀 Wayland MCP Server

Servidor MCP para Wayland

gbox

gbox

Gru-sandbox (gbox) é um projeto de código aberto que fornece um sandbox auto-hospedável para integração com MCP ou outros casos de uso de agentes de IA.

BlenderMCP

BlenderMCP

Connects Claude AI to Blender through the Model Context Protocol, enabling AI-assisted 3D modeling, scene creation, material control, and object manipulation. Supports integration with Poly Haven assets and Hyper3D for AI-generated models.

Databricks MCP Server

Databricks MCP Server

A FastAPI-based server that provides tools for local file management and Databricks operations, enabling users to create/edit files locally and interact with Databricks clusters, jobs, and DLT pipelines.

LW MCP Agents

LW MCP Agents

A lightweight framework for building and orchestrating AI agents through the Model Context Protocol, enabling users to create scalable multi-agent systems using only configuration files.

MCP Reference Server

MCP Reference Server

A comprehensive reference implementation demonstrating all features of the Model Context Protocol (MCP) specification, serving as documentation, learning resource, and testing tool for MCP implementations.

Mobile Development MCP

Mobile Development MCP

Este é um MCP projetado para gerenciar e interagir com dispositivos móveis e simuladores.

gitSERVER README Manager

gitSERVER README Manager

Enables automated README file management for development projects through MCP tools for content creation and summarization, resources for direct file access, and prompts for AI-powered documentation analysis.

🧠 MCP PID Wallet Verifier

🧠 MCP PID Wallet Verifier

Um servidor MCP leve e amigável para IA que permite que qualquer agente de IA ou assistente compatível com MCP inicie e verifique uma apresentação de credenciais PID (Dados de Identidade Pessoal) via OIDC4VP.

Domain-MCP

Domain-MCP

A simple MCP server that enables AI assistants to perform domain research including availability checking, WHOIS lookups, DNS record retrieval, and finding expired domains without requiring API keys.

Azure AI Search Integration

Azure AI Search Integration

Servidores de Protocolo de Contexto de Modelo para a Pesquisa de IA do Azure

Brainrot MCP

Brainrot MCP

Automatically plays Subway Surfers gameplay in the background during coding sessions to provide continuous dopamine stimulation. Activates when users start coding conversations and stops when finished, requiring zero manual intervention.

mcp_ctl

mcp_ctl

Um gerenciador de pacotes para gerenciar todos os seus servidores MCP em diversas plataformas.

Hoarder MCP Server

Hoarder MCP Server

MCP-Weather Server

MCP-Weather Server

An intermediate agent server that enhances LLMs with weather data capabilities using the Model Context Protocol (MCP) framework, enabling retrieval of real-time weather information.