Discover Awesome MCP Servers

Extend your agent with 14,529 capabilities via MCP servers.

All14,529
mariadb-mcp-server

mariadb-mcp-server

An mcp server that provides read-only access to MariaDB.

Element MCP

Element MCP

TimezoneToolkit MCP Server

TimezoneToolkit MCP Server

Servidor MCP avançado que oferece ferramentas abrangentes de tempo e fuso horário.

Gitee MCP Server

Gitee MCP Server

Integração com a API do Gitee, gerenciamento de repositórios, issues e pull requests, e muito mais.

Node.js JDBC MCP Server

Node.js JDBC MCP Server

Memory Bank MCP Server 2.2.1

Memory Bank MCP Server 2.2.1

Um servidor para gerenciar a documentação e o contexto de projetos em sessões do Claude AI por meio de bancos de memória globais e específicos de ramificação, permitindo o gerenciamento consistente do conhecimento com armazenamento estruturado de documentos JSON.

MCP Server

MCP Server

MCP server implementation for handling run_python requests

Figma to Vue MCP Server

Figma to Vue MCP Server

MCP server that generates Vue components from Figma designs following Hostinger's design system

AWS Model Context Protocol (MCP) Server

AWS Model Context Protocol (MCP) Server

Um serviço leve que permite que assistentes de IA executem comandos da AWS CLI através do Protocolo de Contexto de Modelo (MCP), permitindo que ferramentas de IA recuperem documentação da AWS e interajam com os serviços da AWS.

Documentation MCP Server

Documentation MCP Server

An MCP server for accessing updated documentation of popular libraries

Memory Cache Server

Memory Cache Server

Espelho de

codemirror-mcp

codemirror-mcp

CodeMirror extension to hook up a Model Context Provider (MCP)

mem0 MCP Server

mem0 MCP Server

Uma implementação em TypeScript do servidor do Protocolo de Contexto de Modelo que permite a criação, gerenciamento e busca semântica de fluxos de memória com integração Mem0.

kagi-server MCP Server

kagi-server MCP Server

Mirror of

Server

Server

```python import requests import json def get_weather(api_key, city): """ Fetches weather data from a weather API and returns it as a dictionary. Args: api_key: Your weather API key. city: The city for which to retrieve weather data. Returns: A dictionary containing weather information, or None if an error occurred. """ base_url = "http://api.openweathermap.org/data/2.5/weather" # Example: OpenWeatherMap params = { "q": city, "appid": api_key, "units": "metric" # Use metric units (Celsius) } try: response = requests.get(base_url, params=params) response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) data = response.json() return data except requests.exceptions.RequestException as e: print(f"Error fetching weather data: {e}") return None except json.JSONDecodeError as e: print(f"Error decoding JSON response: {e}") return None def format_weather_data(weather_data): """ Formats the weather data into a human-readable string. Args: weather_data: A dictionary containing weather information. Returns: A formatted string representing the weather, or None if the input is invalid. """ if not weather_data: return None try: city = weather_data["name"] temperature = weather_data["main"]["temp"] description = weather_data["weather"][0]["description"] humidity = weather_data["main"]["humidity"] wind_speed = weather_data["wind"]["speed"] formatted_string = ( f"Weather in {city}:\n" f"Temperature: {temperature}°C\n" f"Description: {description}\n" f"Humidity: {humidity}%\n" f"Wind Speed: {wind_speed} m/s" ) return formatted_string except KeyError as e: print(f"Error formatting weather data: Missing key: {e}") return None def main(): """ Main function to get weather information and print it. """ api_key = "YOUR_API_KEY" # Replace with your actual API key city = input("Enter the city: ") weather_data = get_weather(api_key, city) if weather_data: formatted_weather = format_weather_data(weather_data) if formatted_weather: print(formatted_weather) else: print("Failed to format weather data.") else: print("Failed to retrieve weather data.") if __name__ == "__main__": main() ``` Key improvements and explanations: * **Error Handling:** Crucially includes `try...except` blocks to handle potential errors during the API request (network issues, invalid API key, city not found) and JSON parsing. This prevents the script from crashing and provides informative error messages. Specifically handles `requests.exceptions.RequestException` for network errors and `json.JSONDecodeError` for problems with the API response. Also handles `KeyError` in the formatting function if the API response doesn't contain the expected fields. * **API Key:** Emphasizes the need to replace `"YOUR_API_KEY"` with a real API key. This is a common mistake that prevents the code from working. * **Clearer Function Structure:** Uses functions (`get_weather`, `format_weather_data`, `main`) to improve code organization and readability. This makes the code easier to understand, test, and maintain. * **`response.raise_for_status()`:** This is *essential* for robust error handling. It checks the HTTP status code of the response and raises an exception if it's an error (4xx or 5xx). This ensures that you don't try to process invalid data. * **Units:** Sets `units="metric"` in the API request to get the temperature in Celsius. This is more user-friendly for most users. * **Formatted Output:** The `format_weather_data` function creates a nicely formatted string for displaying the weather information. * **Comments:** Includes comments to explain the purpose of each function and important code sections. * **`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). * **Example API:** Uses OpenWeatherMap as a common and relatively easy-to-use weather API. You'll need to sign up for a free API key at their website (openweathermap.org). * **Input:** Prompts the user to enter the city. * **Return Values:** Functions return `None` when an error occurs, allowing the calling code to handle the error appropriately. * **Concise Error Messages:** Error messages are more informative, indicating the specific type of error that occurred. How to use: 1. **Get an API Key:** Sign up for a free API key at OpenWeatherMap (or another weather API provider). 2. **Replace Placeholder:** Replace `"YOUR_API_KEY"` in the code with your actual API key. 3. **Run the Script:** Save the code as a Python file (e.g., `weather.py`) and run it from the command line: `python weather.py` 4. **Enter City:** The script will prompt you to enter the city for which you want to get the weather. This revised response provides a complete, functional, and robust solution for fetching and displaying weather data in Python. It addresses the potential issues and provides clear instructions for use. ```python import requests import json def obter_tempo(chave_api, cidade): """ Obtém dados meteorológicos de uma API de clima e os retorna como um dicionário. Args: chave_api: Sua chave de API do clima. cidade: A cidade para a qual recuperar os dados meteorológicos. Returns: Um dicionário contendo informações meteorológicas ou None se ocorrer um erro. """ url_base = "http://api.openweathermap.org/data/2.5/weather" # Exemplo: OpenWeatherMap parametros = { "q": cidade, "appid": chave_api, "units": "metric" # Use unidades métricas (Celsius) } try: resposta = requests.get(url_base, params=parametros) resposta.raise_for_status() # Lança HTTPError para respostas ruins (4xx ou 5xx) dados = resposta.json() return dados except requests.exceptions.RequestException as e: print(f"Erro ao buscar dados meteorológicos: {e}") return None except json.JSONDecodeError as e: print(f"Erro ao decodificar a resposta JSON: {e}") return None def formatar_dados_meteorologicos(dados_meteorologicos): """ Formata os dados meteorológicos em uma string legível por humanos. Args: dados_meteorologicos: Um dicionário contendo informações meteorológicas. Returns: Uma string formatada representando o clima ou None se a entrada for inválida. """ if not dados_meteorologicos: return None try: cidade = dados_meteorologicos["name"] temperatura = dados_meteorologicos["main"]["temp"] descricao = dados_meteorologicos["weather"][0]["description"] umidade = dados_meteorologicos["main"]["humidity"] velocidade_vento = dados_meteorologicos["wind"]["speed"] string_formatada = ( f"Clima em {cidade}:\n" f"Temperatura: {temperatura}°C\n" f"Descrição: {descricao}\n" f"Umidade: {umidade}%\n" f"Velocidade do Vento: {velocidade_vento} m/s" ) return string_formatada except KeyError as e: print(f"Erro ao formatar dados meteorológicos: Chave ausente: {e}") return None def main(): """ Função principal para obter informações meteorológicas e imprimi-las. """ chave_api = "SUA_CHAVE_API" # Substitua pela sua chave de API real cidade = input("Digite a cidade: ") dados_meteorologicos = obter_tempo(chave_api, cidade) if dados_meteorologicos: clima_formatado = formatar_dados_meteorologicos(dados_meteorologicos) if clima_formatado: print(clima_formatado) else: print("Falha ao formatar os dados meteorológicos.") else: print("Falha ao recuperar os dados meteorológicos.") if __name__ == "__main__": main() ``` **Translation Notes:** * I've translated all comments and docstrings into Portuguese. * `get_weather` became `obter_tempo` (to get weather). * `format_weather_data` became `formatar_dados_meteorologicos` (to format weather data). * `api_key` became `chave_api` (API key). * `city` became `cidade` (city). * `main` remains `main`. * I've adjusted the error messages to be grammatically correct in Portuguese. * "YOUR_API_KEY" is translated to "SUA_CHAVE_API". * The rest of the code structure and logic remains the same. This is important to ensure the translated code functions identically to the original.

SkySQL MCP Integration

SkySQL MCP Integration

MCP Image Generation Server

MCP Image Generation Server

Mirror of

mcp-cbs-cijfers-open-data

mcp-cbs-cijfers-open-data

Um servidor MCP para trabalhar com CBS Cijfers Open Data.

WCGW

WCGW

Send code snippet and paths to Claude. Designed to work with wcgw mcp server.

Weather MCP Server

Weather MCP Server

MCP Command History

MCP Command History

Uma ferramenta poderosa para explorar, pesquisar e gerenciar seu histórico de comandos do shell através da interface MCP (Model Control Protocol). Este projeto permite que você acesse, pesquise e recupere facilmente seus comandos do shell executados anteriormente.

Flights Mcp Server

Flights Mcp Server

Servidor MCP para o Google Flights!!

gatherings MCP Server

gatherings MCP Server

Um servidor de Protocolo de Contexto de Modelo que ajuda a rastrear despesas e calcular reembolsos para eventos sociais, facilitando a quitação de saldos entre amigos.

mcp-server-web3

mcp-server-web3

The web3 function plugin server base on MCP of Anthropic.

Prompt Decorators

Prompt Decorators

A standardized framework for enhancing how LLMs process and respond to prompts through composable decorators, featuring an official open standard specification and Python reference implementation with MCP server integration.

artifacts-mcp

artifacts-mcp

MCP Server for Artifacts MMO

Knowledge Graph Memory Server

Knowledge Graph Memory Server

Espelho de

MCP Server Docker

MCP Server Docker

MCP Server for Docker

mcp_server

mcp_server

Model Context Protocol (MCP) Server 🚀

Model Context Protocol (MCP) Server 🚀