Discover Awesome MCP Servers

Extend your agent with 27,058 capabilities via MCP servers.

All27,058
mcp-server-web3

mcp-server-web3

The web3 function plugin server base on MCP of Anthropic.

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.

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

Model Context Protocol (MCP) Server 🚀

Model Context Protocol (MCP) Server 🚀

mcp-server-bluesky

mcp-server-bluesky

Mirror of

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.

Weather MCP Server

Weather MCP Server

mcp-cbs-cijfers-open-data

mcp-cbs-cijfers-open-data

Um servidor MCP para trabalhar com CBS Cijfers Open Data.

SkySQL MCP Integration

SkySQL MCP Integration

🐋 Docker MCP server

🐋 Docker MCP server

Mirror of

mcp-server-testWhat is MCP Server Test?How to use MCP Server Test?Key features of MCP Server Test?Use cases of MCP Server Test?FAQ from MCP Server Test?

mcp-server-testWhat is MCP Server Test?How to use MCP Server Test?Key features of MCP Server Test?Use cases of MCP Server Test?FAQ from MCP Server Test?

Test MCP Server

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.

mpc-csharp-semantickernel

mpc-csharp-semantickernel

Okay, here's an example demonstrating how to use Microsoft Semantic Kernel with OpenAI and a hypothetical "MCP Server" (assuming MCP stands for something like "My Custom Processing Server" or "Message Control Protocol Server"). Since "MCP Server" is vague, I'll make some assumptions about its functionality and how it might interact with Semantic Kernel. You'll need to adapt this to your specific MCP Server's capabilities. **Assumptions about the MCP Server:** * **Purpose:** The MCP Server is a custom server that performs some specific data processing or action based on instructions it receives. Let's say it's a server that manages a database of product information and can perform queries, updates, and other operations. * **Communication:** The MCP Server exposes an API (likely HTTP-based) that Semantic Kernel can call. It accepts requests in a structured format (e.g., JSON) and returns responses in a structured format. * **Authentication:** The MCP Server might require authentication (API keys, tokens, etc.). **Conceptual Overview:** The Semantic Kernel will be used to: 1. **Receive a user's natural language request.** 2. **Use OpenAI to understand the intent of the request.** 3. **Formulate a structured request (e.g., JSON) that the MCP Server can understand.** This is where Semantic Kernel's templating and function calling capabilities are crucial. 4. **Send the request to the MCP Server.** 5. **Receive the response from the MCP Server.** 6. **Use OpenAI (optionally) to format the response in a user-friendly way.** 7. **Present the result to the user.** **Code Example (C#):** ```csharp using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Connectors.OpenAI; using System.Text.Json; using System.Net.Http; using System.Threading.Tasks; public class Example { private static readonly HttpClient httpClient = new HttpClient(); public static async Task Main(string[] args) { // 1. Configure Semantic Kernel var kernel = new KernelBuilder() .WithOpenAIChatCompletionService( "gpt-3.5-turbo", // Or your preferred model "YOUR_OPENAI_API_KEY", "YOUR_ORG_ID" // Optional ) .Build(); // 2. Define the MCP Server Plugin (Skill) // This encapsulates the interaction with the MCP Server. var mcpServerPlugin = new MCPPlugin(kernel, "YOUR_MCP_SERVER_API_KEY"); // Pass API key if needed kernel.ImportSkill(mcpServerPlugin, "MCP"); // 3. User Input (Example) string userInput = "Find all products with the name 'Laptop' and price less than 1200."; // 4. Run the Semantic Kernel and get the result var kernelResult = await kernel.RunAsync(userInput, kernel.Skills.GetFunction("MCP.FindProducts")); // 5. Display the result Console.WriteLine($"Result from MCP Server: {kernelResult.Result}"); } // MCP Server Plugin (Skill) public class MCPPlugin { private readonly IKernel _kernel; private readonly string _mcpServerApiKey; // If needed private readonly string _mcpServerEndpoint = "https://your-mcp-server.example.com/api/products"; // Replace with your actual endpoint public MCPPlugin(IKernel kernel, string mcpServerApiKey) { _kernel = kernel; _mcpServerApiKey = mcpServerApiKey; } [SKFunction("Finds products based on search criteria.")] [SKParameter(Name = "criteria", Description = "Search criteria for products (e.g., name, price).")] public async Task<string> FindProducts(string criteria) { // 1. Use OpenAI to translate the natural language criteria into a structured query. // This is a simplified example. You might need a more complex prompt. var prompt = @" You are an API translator. The user will provide search criteria in natural language. Your task is to translate this into a JSON object that can be sent to the MCP Server. MCP Server API: - Endpoint: /api/products - Accepts: JSON object with 'name' (string, optional), 'maxPrice' (number, optional) properties. User Criteria: {{criteria}} JSON: "; var structuredQueryFunction = _kernel.CreateSemanticFunction(prompt); var structuredQuery = await structuredQueryFunction.InvokeAsync(new KernelArguments { { "criteria", criteria } }); string jsonPayload = structuredQuery.Result; // 2. Call the MCP Server API try { httpClient.DefaultRequestHeaders.Clear(); if (!string.IsNullOrEmpty(_mcpServerApiKey)) { httpClient.DefaultRequestHeaders.Add("X-MCP-API-Key", _mcpServerApiKey); // Example authentication } var content = new StringContent(jsonPayload, System.Text.Encoding.UTF8, "application/json"); var response = await httpClient.PostAsync(_mcpServerEndpoint, content); response.EnsureSuccessStatusCode(); // Throw exception if not successful string responseBody = await response.Content.ReadAsStringAsync(); return responseBody; // Return the raw JSON response from the MCP Server } catch (HttpRequestException ex) { Console.WriteLine($"Error calling MCP Server: {ex.Message}"); return $"Error: Could not retrieve data from MCP Server. {ex.Message}"; } catch (JsonException ex) { Console.WriteLine($"Error parsing JSON: {ex.Message}"); return $"Error: Could not parse JSON. {ex.Message}"; } } } } ``` **Explanation:** 1. **Setup:** * Includes necessary `using` statements. * Creates an `HttpClient` for making HTTP requests. * Configures the Semantic Kernel with your OpenAI credentials. **Replace `"YOUR_OPENAI_API_KEY"` and `"YOUR_ORG_ID"` with your actual values.** 2. **MCPPlugin (Skill):** * This class encapsulates the logic for interacting with the MCP Server. * `_mcpServerEndpoint`: **Replace `"https://your-mcp-server.example.com/api/products"` with the actual URL of your MCP Server's API endpoint.** * `_mcpServerApiKey`: Stores the API key for the MCP Server (if required). * `FindProducts` function: * `[SKFunction]` attribute: Marks this method as a Semantic Kernel function that can be called from the kernel. * `[SKParameter]` attribute: Defines the input parameters for the function. This helps Semantic Kernel understand the function's purpose and how to use it. * **Crucially, it uses OpenAI to translate the natural language `criteria` into a structured JSON query.** The `prompt` is designed to instruct OpenAI to generate the correct JSON format for the MCP Server. **You'll need to adapt this prompt to match your MCP Server's API requirements.** * It then makes an HTTP request to the MCP Server, sending the JSON payload. * It handles potential errors (HTTP request failures, JSON parsing errors). * It returns the raw JSON response from the MCP Server. You might want to add another step to format this response into a more user-friendly format using OpenAI. 3. **Main Function:** * Creates a `KernelBuilder` and configures it with the OpenAI connector. * Creates an instance of the `MCPPlugin` and imports it into the kernel as a skill named "MCP". * Defines a sample `userInput`. * Calls `kernel.RunAsync` to execute the `MCP.FindProducts` function with the user input. * Prints the result to the console. **Important Considerations and Adaptations:** * **MCP Server API:** The most important part is understanding your MCP Server's API. You need to know: * The endpoint URL. * The expected request format (JSON schema, query parameters, etc.). * The authentication method (API keys, tokens, etc.). * The response format. * **Prompt Engineering:** The prompt used to translate the natural language criteria into a structured query is critical. You'll need to experiment with different prompts to get the best results. Consider providing examples of input and output to OpenAI. * **Error Handling:** The example includes basic error handling, but you should add more robust error handling to your application. * **Authentication:** The example shows a simple API key authentication. Adapt the authentication logic to match your MCP Server's requirements. * **Response Formatting:** The example returns the raw JSON response from the MCP Server. You might want to use OpenAI to format this response into a more user-friendly format before displaying it to the user. For example: ```csharp // After receiving the response from the MCP Server: string responseBody = await response.Content.ReadAsStringAsync(); // Use OpenAI to format the response var formatPrompt = @" You are a helpful assistant. You will receive a JSON response from an API. Your task is to format this response into a human-readable format. JSON: {{json}} Formatted Response: "; var formatFunction = _kernel.CreateSemanticFunction(formatPrompt); var formattedResponse = await formatFunction.InvokeAsync(new KernelArguments { { "json", responseBody } }); return formattedResponse.Result; ``` * **Security:** Be very careful about storing API keys and other sensitive information. Use environment variables or a secure configuration management system. * **Dependency Injection:** For larger applications, consider using dependency injection to manage the dependencies of your plugins. * **Asynchronous Operations:** Use `async` and `await` to avoid blocking the UI thread. * **Semantic Kernel Skills:** Explore the different types of skills that Semantic Kernel offers, such as native skills and semantic skills. **How to Run This Example:** 1. **Create a new C# console application.** 2. **Install the Semantic Kernel NuGet package:** ```bash dotnet add package Microsoft.SemanticKernel --version 1.0.1 dotnet add package Microsoft.SemanticKernel.Connectors.OpenAI --version 1.0.1 ``` 3. **Replace the code in `Program.cs` with the code above.** 4. **Replace the placeholder values (API keys, endpoint URL) with your actual values.** 5. **Run the application.** **Portuguese Translation of Key Concepts:** * **Semantic Kernel:** Núcleo Semântico * **Plugin (Skill):** Plugin (Habilidade) * **OpenAI:** OpenAI (mesmo nome) * **MCP Server:** Servidor MCP (ou Servidor de Processamento Personalizado, if you want to be more descriptive) * **Prompt:** Instrução (or Comando) * **Function:** Função * **API Key:** Chave de API * **Endpoint:** Ponto de extremidade * **JSON:** JSON (mesmo nome) * **Natural Language:** Linguagem Natural * **Structured Query:** Consulta Estruturada This comprehensive example should give you a solid foundation for using Microsoft Semantic Kernel with OpenAI and your MCP Server. Remember to adapt the code to your specific needs and API requirements. Good luck!

Choose MCP Server Setup

Choose MCP Server Setup

Espelho de

mock-assistant-mcp-server

mock-assistant-mcp-server

Assistente de servidor MCP para dados simulados.

McpDocs

McpDocs

Provide documentation about your Elixir project's functions and functions of dependencies to an LLM through an SSE MCP server.

Linear MCP Server

Linear MCP Server

Mirror of

Telegram MCP Server

Telegram MCP Server

MCP server to send notifications to Telegram

create-mcp-server

create-mcp-server

A comprehensive architecture for building robust Model Context Protocol (MCP) servers with integrated web capabilities

testmcpgithubdemo1

testmcpgithubdemo1

created from MCP server demo

MCP Server для Prom.ua

MCP Server для Prom.ua

Servidor MCP para trabalhar com a API Prom.ua.

MCP-DeanMachines

MCP-DeanMachines

Simple Memory Extension MCP Server

Simple Memory Extension MCP Server

Um servidor MCP que estende a janela de contexto de agentes de IA, fornecendo ferramentas para armazenar, recuperar e pesquisar memórias, permitindo que os agentes mantenham histórico e contexto ao longo de interações prolongadas.

MCP Server Pool

MCP Server Pool

MCP 服务合集

google-workspace-mcp

google-workspace-mcp

Kubectl MCP Tool

Kubectl MCP Tool

Um servidor de Protocolo de Contexto de Modelo que permite que assistentes de IA interajam com clusters Kubernetes através de linguagem natural, suportando operações Kubernetes essenciais, monitoramento, segurança e diagnósticos.