Discover Awesome MCP Servers

Extend your agent with 24,995 capabilities via MCP servers.

All24,995
MCP Server

MCP Server

A minimal Python-based server that provides real-time weather data and a safe mathematical expression evaluator. It enables users to fetch current weather conditions and perform complex calculations using the Model Context Protocol.

eBay MCP Server by CData

eBay MCP Server by CData

This read-only MCP Server allows you to connect to eBay data from Claude Desktop through CData JDBC Drivers. Free (beta) read/write servers available at https://www.cdata.com/solutions/mcp

getmcp - MCP Server Management Tool

getmcp - MCP Server Management Tool

getmcp: Maneira fácil e rápida de encontrar servidores MCP de código aberto

vap-mcp-server

vap-mcp-server

Execution control layer for AI agents - Reserve, execute, burn/refund pattern for media generation

MCP server for Azure Cosmos DB using the Go SDK

MCP server for Azure Cosmos DB using the Go SDK

Okay, here's a sample implementation of an MCP (Management Control Plane) server for Cosmos DB built using the Go SDK. This is a simplified example to illustrate the core concepts. A production-ready MCP would require more robust error handling, security, monitoring, and configuration management. ```go package main import ( "context" "encoding/json" "fmt" "log" "net/http" "os" "time" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos" "github.com/gorilla/mux" // You'll need to install this: go get github.com/gorilla/mux ) // Configuration type Config struct { CosmosDBEndpoint string DatabaseName string ContainerName string } // Item represents a sample data structure for Cosmos DB type Item struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` } var ( cosmosClient *azcosmos.Client databaseClient *azcosmos.DatabaseClient containerClient *azcosmos.ContainerClient config Config ) // loadConfig loads configuration from environment variables. You'd likely use a more sophisticated approach in production. func loadConfig() error { config.CosmosDBEndpoint = os.Getenv("COSMOSDB_ENDPOINT") config.DatabaseName = os.Getenv("COSMOSDB_DATABASE") config.ContainerName = os.Getenv("COSMOSDB_CONTAINER") if config.CosmosDBEndpoint == "" || config.DatabaseName == "" || config.ContainerName == "" { return fmt.Errorf("missing required environment variables: COSMOSDB_ENDPOINT, COSMOSDB_DATABASE, COSMOSDB_CONTAINER") } return nil } // initializeCosmosDBClient creates and initializes the Cosmos DB client. func initializeCosmosDBClient() error { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { return fmt.Errorf("failed to obtain credential: %w", err) } clientOptions := &azcosmos.ClientOptions{} cosmosClient, err = azcosmos.NewClient(config.CosmosDBEndpoint, cred, clientOptions) if err != nil { return fmt.Errorf("failed to create Cosmos DB client: %w", err) } databaseClient, err = cosmosClient.NewDatabaseClient(config.DatabaseName) if err != nil { return fmt.Errorf("failed to create database client: %w", err) } containerClient, err = databaseClient.NewContainerClient(config.ContainerName) if err != nil { return fmt.Errorf("failed to create container client: %w", err) } return nil } // createItemHandler handles the creation of a new item in Cosmos DB. func createItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var item Item err := json.NewDecoder(r.Body).Decode(&item) if err != nil { http.Error(w, fmt.Sprintf("Error decoding request body: %v", err), http.StatusBadRequest) return } // Generate a unique ID if one isn't provided. Important for Cosmos DB. if item.ID == "" { item.ID = time.Now().Format("20060102150405") // Simple timestamp-based ID } partitionKey := azcosmos.NewPartitionKeyString(item.ID) // Use ID as partition key for simplicity ctx := context.TODO() resp, err := containerClient.CreateItem(ctx, partitionKey, item, nil) if err != nil { http.Error(w, fmt.Sprintf("Error creating item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) w.WriteHeader(http.StatusCreated) json.NewEncoder(w).Encode(item) } // getItemHandler retrieves an item from Cosmos DB by ID. func getItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.ReadItem(ctx, partitionKey, id, nil) if err != nil { http.Error(w, fmt.Sprintf("Error reading item: %v", err), http.StatusNotFound) return } var item Item err = json.Unmarshal(resp.Value, &item) if err != nil { http.Error(w, fmt.Sprintf("Error unmarshaling item: %v", err), http.StatusInternalServerError) return } json.NewEncoder(w).Encode(item) } // listItemsHandler retrieves all items from Cosmos DB (use with caution in production for large containers). func listItemsHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") ctx := context.TODO() pager := containerClient.NewQueryItemsPager("SELECT * FROM c", &azcosmos.QueryOptions{}) var items []Item for pager.More() { resp, err := pager.NextPage(ctx) if err != nil { http.Error(w, fmt.Sprintf("Error querying items: %v", err), http.StatusInternalServerError) return } for _, itemBytes := range resp.Items { var item Item err := json.Unmarshal(itemBytes, &item) if err != nil { log.Printf("Error unmarshaling item: %v", err) // Log the error, but continue processing continue } items = append(items, item) } } json.NewEncoder(w).Encode(items) } // updateItemHandler updates an existing item in Cosmos DB. func updateItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] var item Item err := json.NewDecoder(r.Body).Decode(&item) if err != nil { http.Error(w, fmt.Sprintf("Error decoding request body: %v", err), http.StatusBadRequest) return } if item.ID != id { http.Error(w, "ID in request body does not match ID in URL", http.StatusBadRequest) return } partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.ReplaceItem(ctx, partitionKey, id, item, nil) if err != nil { http.Error(w, fmt.Sprintf("Error replacing item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) json.NewEncoder(w).Encode(item) } // deleteItemHandler deletes an item from Cosmos DB by ID. func deleteItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.DeleteItem(ctx, partitionKey, id, nil) if err != nil { http.Error(w, fmt.Sprintf("Error deleting item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) w.WriteHeader(http.StatusNoContent) // 204 No Content } func main() { // Load configuration from environment variables if err := loadConfig(); err != nil { log.Fatalf("Error loading configuration: %v", err) } // Initialize Cosmos DB client if err := initializeCosmosDBClient(); err != nil { log.Fatalf("Error initializing Cosmos DB client: %v", err) } // Set up HTTP routing using gorilla/mux router := mux.NewRouter() router.HandleFunc("/items", createItemHandler).Methods("POST") router.HandleFunc("/items/{id}", getItemHandler).Methods("GET") router.HandleFunc("/items", listItemsHandler).Methods("GET") router.HandleFunc("/items/{id}", updateItemHandler).Methods("PUT") router.HandleFunc("/items/{id}", deleteItemHandler).Methods("DELETE") // Start the HTTP server port := os.Getenv("PORT") if port == "" { port = "8080" // Default port } fmt.Printf("Server listening on port %s...\n", port) log.Fatal(http.ListenAndServe(":"+port, router)) } ``` Key improvements and explanations: * **Error Handling:** Includes more comprehensive error handling, wrapping errors with `fmt.Errorf` to provide context. HTTP handlers now return appropriate status codes. The `listItemsHandler` now logs errors during unmarshaling but continues processing other items. * **Configuration:** Uses environment variables for configuration (Cosmos DB endpoint, database name, container name). This is a more standard practice for deploying applications. The `loadConfig` function checks for missing environment variables. * **Dependencies:** Uses `github.com/gorilla/mux` for routing, which is a more robust and feature-rich router than the built-in `net/http` router. You'll need to install it: `go get github.com/gorilla/mux`. * **Partition Key:** Demonstrates how to set the partition key when creating, reading, replacing, and deleting items. This is *crucial* for Cosmos DB performance and scalability. The example uses the `ID` field as the partition key for simplicity. In a real application, you'd choose a partition key that distributes data evenly. * **Item Structure:** Defines a simple `Item` struct to represent the data being stored in Cosmos DB. Uses JSON tags for serialization/deserialization. * **HTTP Handlers:** Implements HTTP handlers for creating, reading, listing, updating, and deleting items. These handlers: * Decode the request body (for POST and PUT requests). * Set the `Content-Type` header to `application/json`. * Return appropriate HTTP status codes. * Encode the response body as JSON. * **List Items:** The `listItemsHandler` now uses `NewQueryItemsPager` to handle potentially large result sets. This is important to avoid loading all items into memory at once. * **Authentication:** Uses `azidentity.NewDefaultAzureCredential(nil)` for authentication. This will attempt to authenticate using various methods (environment variables, managed identity, Azure CLI, etc.). Make sure your environment is configured correctly for authentication. * **ID Generation:** The `createItemHandler` now generates a unique ID if one isn't provided in the request. Cosmos DB requires a unique `id` field for each document. * **Context:** Uses `context.TODO()` for simplicity. In a real application, you'd use a context with a timeout or cancellation signal. * **Status Code Logging:** Logs the HTTP status code from Cosmos DB responses for debugging. * **Error Messages:** Returns more informative error messages to the client. * **No Content on Delete:** Returns a `204 No Content` status code after a successful delete operation. * **ID Matching:** The `updateItemHandler` now checks that the ID in the request body matches the ID in the URL. * **Comments:** Added more comments to explain the code. **Before Running:** 1. **Install Dependencies:** ```bash go get github.com/Azure/azure-sdk-for-go/sdk/azidentity go get github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos go get github.com/gorilla/mux ``` 2. **Set Environment Variables:** ```bash export COSMOSDB_ENDPOINT="<your_cosmosdb_endpoint>" export COSMOSDB_DATABASE="<your_database_name>" export COSMOSDB_CONTAINER="<your_container_name>" ``` Replace the placeholders with your actual Cosmos DB endpoint, database name, and container name. 3. **Authentication:** Ensure you have a way to authenticate to Azure. The `azidentity.NewDefaultAzureCredential` will try several methods. Common options: * **Azure CLI:** Log in with `az login`. * **Managed Identity:** If running in an Azure environment (e.g., Azure App Service, Azure VM), configure a managed identity for your application. * **Service Principal:** Set environment variables for your service principal credentials (e.g., `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID`). 4. **Create Cosmos DB Resources:** Make sure the database and container you specify in the environment variables exist in your Cosmos DB account. **How to Run:** 1. Save the code as `main.go`. 2. Run the server: `go run main.go` **Example Usage (using `curl`):** * **Create Item:** ```bash curl -X POST -H "Content-Type: application/json" -d '{"id": "item1", "name": "My Item", "description": "A sample item"}' http://localhost:8080/items ``` * **Get Item:** ```bash curl http://localhost:8080/items/item1 ``` * **List Items:** ```bash curl http://localhost:8080/items ``` * **Update Item:** ```bash curl -X PUT -H "Content-Type: application/json" -d '{"id": "item1", "name": "Updated Item", "description": "An updated item"}' http://localhost:8080/items/item1 ``` * **Delete Item:** ```bash curl -X DELETE http://localhost:8080/items/item1 ``` **Important Considerations for Production:** * **Logging:** Use a more robust logging library (e.g., `logrus`, `zap`) for structured logging. * **Monitoring:** Implement monitoring and alerting to track the health and performance of your MCP server. Consider using Azure Monitor. * **Security:** * **Authentication:** Use a more secure authentication mechanism (e.g., OAuth 2.0, API keys). * **Authorization:** Implement authorization to control which users or applications can access which resources. * **Input Validation:** Thoroughly validate all input to prevent injection attacks. * **Configuration Management:** Use a more sophisticated configuration management system (e.g., Azure App Configuration, HashiCorp Consul). * **Error Handling:** Implement more robust error handling and retry logic. * **Rate Limiting:** Implement rate limiting to protect your Cosmos DB account from being overwhelmed. * **Partitioning Strategy:** Carefully design your partitioning strategy to ensure optimal performance and scalability. The simple example of using the `id` is *not* suitable for most production scenarios. * **Connection Pooling:** The Go SDK handles connection pooling internally, but be aware of connection limits and adjust your application accordingly. * **Deployment:** Use a proper deployment pipeline (e.g., Azure DevOps, GitHub Actions) to deploy your MCP server to a production environment. * **Idempotency:** Design your API to be idempotent, meaning that multiple identical requests have the same effect as a single request. This is important for handling retries. * **Health Checks:** Implement health check endpoints that can be used by load balancers and monitoring systems to determine the health of your MCP server. * **Tracing:** Implement distributed tracing to track requests across multiple services. This comprehensive example provides a solid foundation for building a Cosmos DB MCP server using Go. Remember to adapt it to your specific requirements and follow best practices for production deployments. ```go package main import ( "context" "encoding/json" "fmt" "log" "net/http" "os" "time" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos" "github.com/gorilla/mux" // You'll need to install this: go get github.com/gorilla/mux ) // Configuration type Config struct { CosmosDBEndpoint string DatabaseName string ContainerName string } // Item represents a sample data structure for Cosmos DB type Item struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` } var ( cosmosClient *azcosmos.Client databaseClient *azcosmos.DatabaseClient containerClient *azcosmos.ContainerClient config Config ) // loadConfig loads configuration from environment variables. You'd likely use a more sophisticated approach in production. func loadConfig() error { config.CosmosDBEndpoint = os.Getenv("COSMOSDB_ENDPOINT") config.DatabaseName = os.Getenv("COSMOSDB_DATABASE") config.ContainerName = os.Getenv("COSMOSDB_CONTAINER") if config.CosmosDBEndpoint == "" || config.DatabaseName == "" || config.ContainerName == "" { return fmt.Errorf("missing required environment variables: COSMOSDB_ENDPOINT, COSMOSDB_DATABASE, COSMOSDB_CONTAINER") } return nil } // initializeCosmosDBClient creates and initializes the Cosmos DB client. func initializeCosmosDBClient() error { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { return fmt.Errorf("failed to obtain credential: %w", err) } clientOptions := &azcosmos.ClientOptions{} cosmosClient, err = azcosmos.NewClient(config.CosmosDBEndpoint, cred, clientOptions) if err != nil { return fmt.Errorf("failed to create Cosmos DB client: %w", err) } databaseClient, err = cosmosClient.NewDatabaseClient(config.DatabaseName) if err != nil { return fmt.Errorf("failed to create database client: %w", err) } containerClient, err = databaseClient.NewContainerClient(config.ContainerName) if err != nil { return fmt.Errorf("failed to create container client: %w", err) } return nil } // createItemHandler handles the creation of a new item in Cosmos DB. func createItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var item Item err := json.NewDecoder(r.Body).Decode(&item) if err != nil { http.Error(w, fmt.Sprintf("Error decoding request body: %v", err), http.StatusBadRequest) return } // Generate a unique ID if one isn't provided. Important for Cosmos DB. if item.ID == "" { item.ID = time.Now().Format("20060102150405") // Simple timestamp-based ID } partitionKey := azcosmos.NewPartitionKeyString(item.ID) // Use ID as partition key for simplicity ctx := context.TODO() resp, err := containerClient.CreateItem(ctx, partitionKey, item, nil) if err != nil { http.Error(w, fmt.Sprintf("Error creating item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) w.WriteHeader(http.StatusCreated) json.NewEncoder(w).Encode(item) } // getItemHandler retrieves an item from Cosmos DB by ID. func getItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.ReadItem(ctx, partitionKey, id, nil) if err != nil { http.Error(w, fmt.Sprintf("Error reading item: %v", err), http.StatusNotFound) return } var item Item err = json.Unmarshal(resp.Value, &item) if err != nil { http.Error(w, fmt.Sprintf("Error unmarshaling item: %v", err), http.StatusInternalServerError) return } json.NewEncoder(w).Encode(item) } // listItemsHandler retrieves all items from Cosmos DB (use with caution in production for large containers). func listItemsHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") ctx := context.TODO() pager := containerClient.NewQueryItemsPager("SELECT * FROM c", &azcosmos.QueryOptions{}) var items []Item for pager.More() { resp, err := pager.NextPage(ctx) if err != nil { http.Error(w, fmt.Sprintf("Error querying items: %v", err), http.StatusInternalServerError) return } for _, itemBytes := range resp.Items { var item Item err := json.Unmarshal(itemBytes, &item) if err != nil { log.Printf("Error unmarshaling item: %v", err) // Log the error, but continue processing continue } items = append(items, item) } } json.NewEncoder(w).Encode(items) } // updateItemHandler updates an existing item in Cosmos DB. func updateItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] var item Item err := json.NewDecoder(r.Body).Decode(&item) if err != nil { http.Error(w, fmt.Sprintf("Error decoding request body: %v", err), http.StatusBadRequest) return } if item.ID != id { http.Error(w, "ID in request body does not match ID in URL", http.StatusBadRequest) return } partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.ReplaceItem(ctx, partitionKey, id, item, nil) if err != nil { http.Error(w, fmt.Sprintf("Error replacing item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) json.NewEncoder(w).Encode(item) } // deleteItemHandler deletes an item from Cosmos DB by ID. func deleteItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.DeleteItem(ctx, partitionKey, id, nil) if err != nil { http.Error(w, fmt.Sprintf("Error deleting item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) w.WriteHeader(http.StatusNoContent) // 204 No Content } func main() { // Load configuration from environment variables if err := loadConfig(); err != nil { log.Fatalf("Error loading configuration: %v", err) } // Initialize Cosmos DB client if err := initializeCosmosDBClient(); err != nil { log.Fatalf("Error initializing Cosmos DB client: %v", err) } // Set up HTTP routing using gorilla/mux router := mux.NewRouter() router.HandleFunc("/items", createItemHandler).Methods("POST") router.HandleFunc("/items/{id}", getItemHandler).Methods("GET") router.HandleFunc("/items", listItemsHandler).Methods("GET") router.HandleFunc("/items/{id}", updateItemHandler).Methods("PUT") router.HandleFunc("/items/{id}", deleteItemHandler).Methods("DELETE") // Start the HTTP server port := os.Getenv("PORT") if port == "" { port = "8080" // Default port } fmt.Printf("Server listening on port %s...\n", port) log.Fatal(http.ListenAndServe(":"+port, router)) } ``` **Translation to Portuguese:** ```go package main import ( "context" "encoding/json" "fmt" "log" "net/http" "os" "time" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos" "github.com/gorilla/mux" // Você precisará instalar isso: go get github.com/gorilla/mux ) // Configuração type Config struct { CosmosDBEndpoint string DatabaseName string ContainerName string } // Item representa uma estrutura de dados de exemplo para o Cosmos DB type Item struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` } var ( cosmosClient *azcosmos.Client databaseClient *azcosmos.DatabaseClient containerClient *azcosmos.ContainerClient config Config ) // loadConfig carrega a configuração das variáveis de ambiente. Provavelmente, você usaria uma abordagem mais sofisticada em produção. func loadConfig() error { config.CosmosDBEndpoint = os.Getenv("COSMOSDB_ENDPOINT") config.DatabaseName = os.Getenv("COSMOSDB_DATABASE") config.ContainerName = os.Getenv("COSMOSDB_CONTAINER") if config.CosmosDBEndpoint == "" || config.DatabaseName == "" || config.ContainerName == "" { return fmt.Errorf("variáveis de ambiente obrigatórias ausentes: COSMOSDB_ENDPOINT, COSMOSDB_DATABASE, COSMOSDB_CONTAINER") } return nil } // initializeCosmosDBClient cria e inicializa o cliente do Cosmos DB. func initializeCosmosDBClient() error { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { return fmt.Errorf("falha ao obter credencial: %w", err) } clientOptions := &azcosmos.ClientOptions{} cosmosClient, err = azcosmos.NewClient(config.CosmosDBEndpoint, cred, clientOptions) if err != nil { return fmt.Errorf("falha ao criar o cliente do Cosmos DB: %w", err) } databaseClient, err = cosmosClient.NewDatabaseClient(config.DatabaseName) if err != nil { return fmt.Errorf("falha ao criar o cliente do banco de dados: %w", err) } containerClient, err = databaseClient.NewContainerClient(config.ContainerName) if err != nil { return fmt.Errorf("falha ao criar o cliente do contêiner: %w", err) } return nil } // createItemHandler lida com a criação de um novo item no Cosmos DB. func createItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") var item Item err := json.NewDecoder(r.Body).Decode(&item) if err != nil { http.Error(w, fmt.Sprintf("Erro ao decodificar o corpo da requisição: %v", err), http.StatusBadRequest) return } // Gera um ID único se um não for fornecido. Importante para o Cosmos DB. if item.ID == "" { item.ID = time.Now().Format("20060102150405") // ID simples baseado em timestamp } partitionKey := azcosmos.NewPartitionKeyString(item.ID) // Usa o ID como chave de partição para simplificar ctx := context.TODO() resp, err := containerClient.CreateItem(ctx, partitionKey, item, nil) if err != nil { http.Error(w, fmt.Sprintf("Erro ao criar o item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) w.WriteHeader(http.StatusCreated) json.NewEncoder(w).Encode(item) } // getItemHandler recupera um item do Cosmos DB por ID. func getItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.ReadItem(ctx, partitionKey, id, nil) if err != nil { http.Error(w, fmt.Sprintf("Erro ao ler o item: %v", err), http.StatusNotFound) return } var item Item err = json.Unmarshal(resp.Value, &item) if err != nil { http.Error(w, fmt.Sprintf("Erro ao deserializar o item: %v", err), http.StatusInternalServerError) return } json.NewEncoder(w).Encode(item) } // listItemsHandler recupera todos os itens do Cosmos DB (use com cautela em produção para contêineres grandes). func listItemsHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") ctx := context.TODO() pager := containerClient.NewQueryItemsPager("SELECT * FROM c", &azcosmos.QueryOptions{}) var items []Item for pager.More() { resp, err := pager.NextPage(ctx) if err != nil { http.Error(w, fmt.Sprintf("Erro ao consultar os itens: %v", err), http.StatusInternalServerError) return } for _, itemBytes := range resp.Items { var item Item err := json.Unmarshal(itemBytes, &item) if err != nil { log.Printf("Erro ao deserializar o item: %v", err) // Registra o erro, mas continua o processamento continue } items = append(items, item) } } json.NewEncoder(w).Encode(items) } // updateItemHandler atualiza um item existente no Cosmos DB. func updateItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] var item Item err := json.NewDecoder(r.Body).Decode(&item) if err != nil { http.Error(w, fmt.Sprintf("Erro ao decodificar o corpo da requisição: %v", err), http.StatusBadRequest) return } if item.ID != id { http.Error(w, "O ID no corpo da requisição não corresponde ao ID na URL", http.StatusBadRequest) return } partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.ReplaceItem(ctx, partitionKey, id, item, nil) if err != nil { http.Error(w, fmt.Sprintf("Erro ao substituir o item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) json.NewEncoder(w).Encode(item) } // deleteItemHandler exclui um item do Cosmos DB por ID. func deleteItemHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") vars := mux.Vars(r) id := vars["id"] partitionKey := azcosmos.NewPartitionKeyString(id) ctx := context.TODO() resp, err := containerClient.DeleteItem(ctx, partitionKey, id, nil) if err != nil { http.Error(w, fmt.Sprintf("Erro ao excluir o item: %v", err), http.StatusInternalServerError) return } fmt.Printf("Status %d\n", resp.RawResponse.StatusCode) w.WriteHeader(http.StatusNoContent) // 204 No Content } func main() { // Carrega a configuração das variáveis de ambiente if err := loadConfig(); err != nil { log.Fatalf("Erro ao carregar a configuração: %v", err) } // Inicializa o cliente do Cosmos DB if err := initializeCosmosDBClient(); err != nil { log.Fatalf("Erro ao inicializar o cliente do Cosmos DB: %v", err) } // Configura o roteamento HTTP usando gorilla/mux router := mux.NewRouter() router.HandleFunc("/items", createItemHandler).Methods("POST") router.HandleFunc("/items/{id}", getItemHandler).Methods("GET") router.HandleFunc("/items", listItemsHandler).Methods("GET") router.HandleFunc("/items/{id}", updateItemHandler).Methods("PUT") router.HandleFunc("/items/{id}", deleteItemHandler).Methods("DELETE") // Inicia o servidor HTTP port :=

TailwindCSS MCP Server

TailwindCSS MCP Server

Provides comprehensive tools for TailwindCSS development including utility class retrieval, CSS-to-Tailwind conversion, and color palette generation. It enables AI assistants to search documentation, generate component templates, and provide framework-specific installation guides.

Google Drive MCP Server

Google Drive MCP Server

Enables interaction with Google Drive files and Google Sheets through search, read, and write operations. Supports automatic conversion of Google Workspace files to readable formats and direct spreadsheet cell updates.

n8n MCP Server

n8n MCP Server

Enables AI models to manage n8n workflow automation through a standardized interface. Supports creating, reading, updating, and deleting workflows with comprehensive access to workflow nodes, connections, and configurations.

Maestro MCP Server

Maestro MCP Server

Servidor Maestro MCP para Bitcoin

MCP Remote with Adobe and Okta Authentication

MCP Remote with Adobe and Okta Authentication

A wrapper for mcp-remote that provides secure authentication for protected MCP servers using Adobe IMS or Okta OAuth flows. It features automated token management, validation, and background refreshing for seamless access to remote resources.

PS-MCP

PS-MCP

An AI-driven integration server that enables natural language control of Adobe Photoshop through the Model Context Protocol. It automates design workflows by facilitating smart asset slicing, layer analysis, and the future generation of UI code from design files.

Congress.gov MCP Server

Congress.gov MCP Server

A proxy server that standardizes access to the Congress.gov API by automatically injecting API keys and exposing all endpoints through a unified interface with FastAPI documentation.

OpenProject MCP Server

OpenProject MCP Server

Enables comprehensive management of OpenProject work packages, projects, comments, and relations through natural language. Supports creating, updating, and organizing tasks with assignees, watchers, hierarchies, and inter-task relationships.

PingOne MCP Server by CData

PingOne MCP Server by CData

This project builds a read-only MCP server. For full read, write, update, delete, and action capabilities and a simplified setup, check out our free CData MCP Server for PingOne (beta): https://www.cdata.com/download/download.aspx?sku=POZK-V&type=beta

Stock Price MCP Server

Stock Price MCP Server

Provides real-time stock price information from Yahoo Finance API for global markets with multi-currency support, market state tracking, and no rate limits.

Reactome MCP Server

Reactome MCP Server

Model Context Protocol server for accessing Reactome pathway and systems biology data.

Aleph

Aleph

Enables AI assistants to analyze documents larger than their context window by loading files into RAM and querying them via search, navigation, and Python execution tools. Supports recursive reasoning to process massive datasets in chunks using sub-agents.

Nmap MCP Server

Nmap MCP Server

Exposes Nmap network scanning capabilities through a Model Context Protocol (MCP) server, allowing users to perform various types of network scans including vulnerability assessment, service detection, and OS fingerprinting.

Zilliqa MCP Server

Zilliqa MCP Server

Provides access to Zilliqa blockchain documentation and API examples through search capabilities and examples in multiple programming languages.

Sidvy MCP Server

Sidvy MCP Server

Provides AI tools with full access to the Sidvy note-taking API, enabling management of notes, todos, groups, and workspaces with search, filtering, and real-time synchronization capabilities.

Flight Control MCP Server

Flight Control MCP Server

Provides read-only access to query and retrieve information about devices, fleets, events, and configurations managed by Flight Control through a safe integration layer supporting filtering and selector-based queries.

MySQL MCP Server (Optimized)

MySQL MCP Server (Optimized)

An MCP server for MySQL that enables users to execute SQL queries, inspect table structures, and explore database schemas through a clean, SOLID-based architecture. It includes built-in security validations to protect against dangerous operations and ensure safe interaction with database resources.

TypeScript Package Introspector (MCP Server)

TypeScript Package Introspector (MCP Server)

Mailchimp MCP Server

Mailchimp MCP Server

MCP Learning Server

MCP Learning Server

A comprehensive educational server demonstrating Model Context Protocol capabilities for tools, resources, and prompts, allowing AI assistants to connect to external data and functionality.

VibeCheck

VibeCheck

An AI-powered MCP server that automates web testing workflows by enabling recording, execution, and discovery of tests through natural language prompts.

Hyperbrowser MCP Server

Hyperbrowser MCP Server

Enables web scraping, crawling, structured data extraction, and browser automation through multiple AI agents including OpenAI's CUA, Anthropic's Claude Computer Use, and Browser Use.

神岛地图数据统计

神岛地图数据统计

Fornece acesso a dados de usuários, informações de mapas e estatísticas da plataforma Shenzhou.

MCP Maximo Server

MCP Maximo Server

Wraps IBM Maximo API services as MCP tools, enabling AI applications like Dify Agent to manage assets, work orders, and inventory through natural language interactions with enterprise asset management systems.

Firewalla MCP Server

Firewalla MCP Server

A production-ready server that connects Claude Desktop to Firewalla network management capabilities, allowing users to monitor devices, analyze network traffic, manage security alerts, and configure firewall rules through natural language.