Discover Awesome MCP Servers

Extend your agent with 12,817 capabilities via MCP servers.

All12,817
auto-mcp

auto-mcp

Converter automaticamente funções, ferramentas e agentes para servidores MCP.

Axiom MCP Server

Axiom MCP Server

Uma porta compatível com npx de @Axiom's mcp-server-axiom

Whatismyip

Whatismyip

azure-devops-mcp

azure-devops-mcp

Here's a breakdown of what "Azure DevOps MCP C# server and client code" likely refers to, along with explanations and examples. It's important to understand that "MCP" (Microsoft Certified Professional) is a broad term, and Azure DevOps is a complex system. Therefore, I'll provide a general overview and then suggest how to narrow down your search for more specific code examples. **Understanding the Terms** * **Azure DevOps:** A suite of services from Microsoft that covers the entire software development lifecycle. Key components include: * **Azure Boards:** Work item tracking (tasks, bugs, user stories). * **Azure Repos:** Source code management (Git). * **Azure Pipelines:** Continuous integration and continuous delivery (CI/CD). * **Azure Test Plans:** Test management. * **Azure Artifacts:** Package management (NuGet, npm, Maven, etc.). * **MCP (Microsoft Certified Professional):** A general term for someone who has passed a Microsoft certification exam. It doesn't directly imply specific code skills. It *suggests* the person has a certain level of understanding of Microsoft technologies. * **C#:** A modern, object-oriented programming language widely used for developing applications on the .NET platform. * **Server Code:** Code that runs on a server (e.g., a web server, an application server, an Azure Function). In the context of Azure DevOps, this might be code that interacts with the Azure DevOps REST API or handles webhooks. * **Client Code:** Code that runs on a client device (e.g., a web browser, a desktop application, a mobile app). This code typically interacts with a server to retrieve data or perform actions. In the context of Azure DevOps, this might be a web application that displays work items or a command-line tool that automates tasks. **What "Azure DevOps MCP C# server and client code" Likely Means** Someone with an MCP certification who is proficient in C# might write code to: 1. **Interact with the Azure DevOps REST API:** This is the most common scenario. The Azure DevOps REST API allows you to programmatically access and manage almost everything in Azure DevOps. 2. **Create Azure DevOps Extensions:** You can extend the functionality of Azure DevOps by creating extensions that add new features to the web interface or integrate with other services. 3. **Build Custom Build/Release Tasks:** You can create custom tasks for Azure Pipelines to automate specific steps in your CI/CD process. 4. **Develop Integrations with Other Systems:** You might write code to integrate Azure DevOps with other tools, such as Slack, Microsoft Teams, or Jira. 5. **Automate Azure DevOps Administration:** You can use the REST API to automate tasks such as creating projects, managing users, and configuring permissions. **General Examples (Illustrative)** These are simplified examples to give you an idea. Real-world code would be more complex and handle error conditions, authentication, and other details. **1. Server-Side C# Code (Azure Function) to Get Work Items:** ```csharp using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System.Net.Http; using System.Net.Http.Headers; public static class GetWorkItems { [FunctionName("GetWorkItems")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string organization = "your-organization"; // Replace with your Azure DevOps organization string project = "your-project"; // Replace with your Azure DevOps project string pat = "your-personal-access-token"; // Replace with your PAT string requestUrl = $"https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?api-version=7.0"; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes($":{pat}"))); using (HttpResponseMessage response = await client.GetAsync(requestUrl)) { response.EnsureSuccessStatusCode(); // Throw exception if not successful string responseBody = await response.Content.ReadAsStringAsync(); // Deserialize the JSON response into a C# object (you'll need to define a class to represent the work item structure) // Example: // var workItems = JsonConvert.DeserializeObject<WorkItem[]>(responseBody); return new OkObjectResult(responseBody); // Return the JSON response } } } } ``` **Explanation:** * This is an Azure Function triggered by an HTTP request. * It uses the `HttpClient` class to make a GET request to the Azure DevOps REST API. * It uses a Personal Access Token (PAT) for authentication. **Important:** Never hardcode PATs in production code. Use environment variables or Azure Key Vault. * It retrieves work items from a specified organization and project. * It deserializes the JSON response (you'll need to define a `WorkItem` class to match the structure of the JSON). * It returns the JSON response as an `OkObjectResult`. **2. Client-Side C# Code (Console Application) to Create a Work Item:** ```csharp using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; public class Program { public static async Task Main(string[] args) { string organization = "your-organization"; // Replace with your Azure DevOps organization string project = "your-project"; // Replace with your Azure DevOps project string pat = "your-personal-access-token"; // Replace with your PAT string requestUrl = $"https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/$Task?api-version=7.0"; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes($":{pat}"))); // Define the work item fields var workItem = new[] { new { op = "add", path = "/fields/System.Title", value = "My New Task" }, new { op = "add", path = "/fields/System.Description", value = "This is a description of the task." } }; string jsonContent = JsonConvert.SerializeObject(workItem); var content = new StringContent(jsonContent, Encoding.UTF8, "application/json-patch+json"); using (HttpResponseMessage response = await client.PatchAsync(requestUrl, content)) { response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); // Print the response (e.g., the created work item) } } } } ``` **Explanation:** * This is a console application. * It uses the `HttpClient` class to make a PATCH request to the Azure DevOps REST API (PATCH is used for creating or updating work items). * It uses a Personal Access Token (PAT) for authentication. * It defines the fields for the new work item (title and description). * It serializes the work item data into JSON. * It sends the JSON data in the request body. * It prints the response from the server (which will typically include the ID of the newly created work item). **Important Considerations:** * **Authentication:** Using Personal Access Tokens (PATs) is common for development and testing, but for production applications, you should use more secure authentication methods, such as Azure Active Directory (Azure AD) or Managed Identities. * **Error Handling:** The examples above lack robust error handling. You should always include `try-catch` blocks to handle exceptions and log errors. * **JSON Serialization/Deserialization:** Use a library like `Newtonsoft.Json` (Json.NET) or `System.Text.Json` to serialize and deserialize JSON data. Define C# classes that match the structure of the JSON data you're working with. * **NuGet Packages:** You'll need to install the `Newtonsoft.Json` NuGet package (or `System.Text.Json`) in your C# projects. * **API Versions:** The Azure DevOps REST API is versioned. Make sure you're using a supported API version (e.g., `api-version=7.0`). * **Rate Limiting:** Be aware of Azure DevOps rate limits. Implement retry logic to handle rate limiting errors. * **Security:** Never store sensitive information (like PATs) directly in your code. Use environment variables, Azure Key Vault, or other secure storage mechanisms. **How to Find More Specific Code Examples** To find more specific code examples, try these approaches: 1. **Microsoft Documentation:** The official Microsoft documentation for the Azure DevOps REST API is your best resource. It includes code samples in C# and other languages. Start here: [https://learn.microsoft.com/en-us/rest/api/azure/devops/](https://learn.microsoft.com/en-us/rest/api/azure/devops/) 2. **GitHub:** Search GitHub for repositories that contain Azure DevOps C# code. Use keywords like: * `azure devops rest api c#` * `azure devops extension c#` * `azure pipelines task c#` * `vsts api c#` (VSTS was the previous name for Azure DevOps) 3. **Stack Overflow:** Search Stack Overflow for questions and answers related to Azure DevOps C# development. 4. **Azure DevOps Samples:** Microsoft provides some official sample projects. Look for these on GitHub. 5. **Specific Use Cases:** Think about the specific tasks you want to automate or the integrations you want to build. Search for code examples that address those specific use cases. For example: * "C# Azure DevOps create work item" * "C# Azure DevOps get build status" * "C# Azure DevOps trigger pipeline" **Example Search on GitHub:** Go to GitHub and search for: `azure devops rest api c#` You'll find many repositories that contain C# code for interacting with the Azure DevOps REST API. Browse through the repositories to find code that matches your needs. Pay attention to the license of the code before using it in your own projects. **In summary:** The term "Azure DevOps MCP C# server and client code" is quite broad. Focus on the specific tasks you want to accomplish with Azure DevOps, and then search for code examples that address those tasks. The Microsoft documentation and GitHub are your best resources. Remember to prioritize security and error handling in your code.

CoinMarketCap MCP Server

CoinMarketCap MCP Server

Acesso em tempo real a dados de criptomoedas da API CoinMarketCap.

DigitalOcean MCP Server

DigitalOcean MCP Server

Provides access to all 471+ DigitalOcean API endpoints through an MCP server that dynamically extracts them from the OpenAPI specification, enabling search, filtering, and direct API calls with proper authentication.

MCP Fetch

MCP Fetch

Servidor de Protocolo de Contexto do Modelo que permite ao Claude Desktop (ou qualquer cliente MCP) buscar conteúdo da web e processar imagens adequadamente.

AutoGen MCP Server

AutoGen MCP Server

Um servidor MCP que oferece integração com o framework AutoGen da Microsoft, permitindo conversas multiagente através de uma interface padronizada.

Brave Search With Proxy

Brave Search With Proxy

Brave Search With Proxy

DALL-E MCP Server

DALL-E MCP Server

An MCP (Model Context Protocol) server that allows generating, editing, and creating variations of images using OpenAI's DALL-E APIs.

mcp-server-s3

mcp-server-s3

Medusa Mcp

Medusa Mcp

Servidor MCP para o SDK Medusa JS

DadMCP

DadMCP

Servidor MCP remoto para fornecer melhor educação em casa.

Screenshot Server

Screenshot Server

Permite capturar screenshots de páginas web e arquivos HTML locais através de uma interface simples de ferramenta MCP usando Puppeteer com opções configuráveis para dimensões e caminhos de saída.

monday MCP Server

monday MCP Server

monday MCP Server

MCP RAG Server

MCP RAG Server

Um servidor de Protocolo de Conversação de Máquina que permite que agentes de IA realizem Geração Aumentada por Recuperação (Retrieval-Augmented Generation) consultando um banco de dados vetorial FAISS contendo documentos da linguagem Sui Move.

Google Search MCP

Google Search MCP

Uma ferramenta baseada no Playwright que realiza pesquisas no Google e extrai resultados, contornando mecanismos anti-bot, fornecendo capacidades de pesquisa em tempo real para assistentes de IA.

MCP SSE Server

MCP SSE Server

Uma implementação do protocolo Model Context Protocol (MCP) do lado do servidor usando Server-Sent Events (SSE) para comunicação em tempo real, fornecendo ferramentas para cálculos e modelos de recursos dinâmicos.

MCP Play Sound Server

MCP Play Sound Server

Provides audio playback functionality for AI agents, allowing them to play notification sounds when coding tasks are completed.

hh-jira-mcp-server

hh-jira-mcp-server

Um servidor de Protocolo de Contexto de Modelo que permite a integração com o JIRA, permitindo que os usuários interajam com tarefas e problemas do JIRA através do assistente de IA Claude.

Up Bank MCP Server

Up Bank MCP Server

An MCP wrapper for Up Bank's API that allows Claude and other MCP-enabled clients to manage accounts, transactions, categories, tags, and webhooks from Up Bank.

OpenAPI to MCP Generator

OpenAPI to MCP Generator

```java import io.quarkus.cli.commands.CreateProject; import io.quarkus.cli.commands.writer.ProjectWriter; import io.quarkus.cli.common.OutputOptionMixin; import io.quarkus.cli.common.TargetQuarkusVersionGroup; import io.quarkus.cli.common.ToolsOptions; import io.quarkus.cli.runtime.QuarkusCommandInvocation; import io.quarkus.cli.runtime.QuarkusCommandRunner; import io.quarkus.devtools.commands.data.QuarkusCommandInvocationBuilder; import io.quarkus.devtools.commands.handlers.CreateProjectCommandHandler; import io.quarkus.devtools.project.BuildTool; import io.quarkus.devtools.project.codegen.SourceType; import io.quarkus.platform.tools.ToolsUtils; import picocli.CommandLine; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; @CommandLine.Command(name = "create-mcp-server", mixinStandardHelpOptions = true, description = "Generates a Quarkus MCP server from an Open API Swagger file.") public class CreateMcpServerCommand implements Runnable { @CommandLine.Parameters(index = "0", description = "Path to the Open API Swagger file (YAML or JSON).", paramLabel = "<swaggerFile>") String swaggerFile; @CommandLine.Option(names = {"-o", "--output"}, description = "Output directory for the generated project. Defaults to current directory.", defaultValue = ".") Path outputDir; @CommandLine.Option(names = {"-n", "--name"}, description = "Name of the generated project. Defaults to 'mcp-server'.", defaultValue = "mcp-server") String projectName; @CommandLine.Option(names = {"-g", "--group-id"}, description = "Group ID of the generated project. Defaults to 'org.example'.", defaultValue = "org.example") String groupId; @CommandLine.Option(names = {"-a", "--artifact-id"}, description = "Artifact ID of the generated project. Defaults to the project name.", defaultValue = "${projectName}") String artifactId; @CommandLine.Option(names = {"-v", "--version"}, description = "Version of the generated project. Defaults to '1.0.0-SNAPSHOT'.", defaultValue = "1.0.0-SNAPSHOT") String version; @CommandLine.Option(names = {"-e", "--extensions"}, description = "Comma-separated list of extensions to include in the project. Defaults to 'resteasy-jackson,smallrye-openapi'.", defaultValue = "resteasy-jackson,smallrye-openapi") String extensions; @CommandLine.Mixin OutputOptionMixin output; @CommandLine.Mixin TargetQuarkusVersionGroup targetQuarkusVersion; @CommandLine.Mixin ToolsOptions toolsOptions; @Override public void run() { try { // 1. Create a basic Quarkus project QuarkusCommandInvocation invocation = createBaseProject(); // 2. Add the necessary extensions addExtensions(invocation); // 3. Copy the Swagger file to the project copySwaggerFile(invocation); // 4. Generate the JAX-RS interfaces and DTOs from the Swagger file generateCodeFromSwagger(invocation); // 5. Build and run the project (optional) // buildAndRunProject(invocation); output.print(output.isVerbose() ? "Successfully generated Quarkus MCP server project in: " + outputDir.toAbsolutePath() : "Quarkus MCP server project generated in: " + outputDir.toAbsolutePath()); } catch (Exception e) { output.print(e.getMessage()); if (output.isVerbose()) { e.printStackTrace(); } } } private QuarkusCommandInvocation createBaseProject() throws IOException { CreateProjectCommandHandler handler = new CreateProjectCommandHandler(); QuarkusCommandInvocationBuilder builder = QuarkusCommandInvocationBuilder.newInstance(Paths.get(".")) .setBuildTool(BuildTool.MAVEN) // Or BuildTool.GRADLE .setProjectName(projectName) .setGroupId(groupId) .setArtifactId(artifactId.equals("${projectName}") ? projectName : artifactId) .setVersion(version) .setJavaVersion("11") // Or your desired Java version .setOutput(output) .setTargetQuarkusVersion(targetQuarkusVersion.version); QuarkusCommandInvocation invocation = builder.build(); handler.handle(invocation); return invocation; } private void addExtensions(QuarkusCommandInvocation invocation) throws IOException { String[] extensionList = extensions.split(","); invocation.setValue("extensions", extensionList); QuarkusCommandRunner.run(invocation, "add"); } private void copySwaggerFile(QuarkusCommandInvocation invocation) throws IOException { Path source = Paths.get(swaggerFile); Path target = invocation.getProjectPath().resolve("src/main/resources/" + source.getFileName()); ToolsUtils.copyFile(source, target); } private void generateCodeFromSwagger(QuarkusCommandInvocation invocation) throws IOException, InterruptedException { // This is the core part: We need to execute a command that uses the Swagger file to generate the code. // Unfortunately, there isn't a built-in Quarkus command for this. We'll need to use a Maven plugin or a similar tool. // This example uses the `openapi-generator-maven-plugin`. You'll need to add this plugin to your pom.xml. // 1. Add the openapi-generator-maven-plugin to your pom.xml (or build.gradle). This is NOT done in this code. // You'll need to manually add it to your project's build file. See below for an example. // 2. Execute the Maven goal to generate the code. Path projectPath = invocation.getProjectPath(); String swaggerFilePath = "src/main/resources/" + Paths.get(swaggerFile).getFileName(); // Relative to project root // Construct the Maven command ProcessBuilder processBuilder = new ProcessBuilder( "mvn", "generate-sources", "-Dopenapi.inputFile=" + swaggerFilePath, "-Dopenapi.outputDir=src/gen/java", "-Dopenapi.generatorName=jaxrs-spec", // Or jaxrs-jersey, jaxrs-resteasy, etc. Choose the one that best fits your needs. "-Dopenapi.apiPackage=" + groupId + ".api", "-Dopenapi.modelPackage=" + groupId + ".model" ); processBuilder.directory(projectPath.toFile()); processBuilder.redirectErrorStream(true); // Combine stdout and stderr Process process = processBuilder.start(); // Capture the output (optional) try (java.util.Scanner s = new java.util.Scanner(process.getInputStream()).useDelimiter("\\A")) { String output = s.hasNext() ? s.next() : ""; System.out.println(output); // Print the Maven output } int exitCode = process.waitFor(); if (exitCode != 0) { throw new IOException("Failed to generate code from Swagger file. Maven exited with code: " + exitCode); } // 3. Add the generated source directory to the project's source path. This is usually done automatically by Maven. // If not, you may need to configure your IDE or build tool to include `src/gen/java` as a source directory. output.print("Successfully generated code from Swagger file using openapi-generator-maven-plugin."); } // Example openapi-generator-maven-plugin configuration (add this to your pom.xml): /* <plugin> <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <version>6.6.0</version> <! -- Check for the latest version --> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec> <generatorName>jaxrs-spec</generatorName> <output>${project.basedir}/src/gen/java</output> <apiPackage>org.example.api</apiPackage> <modelPackage>org.example.model</modelPackage> <configOptions> <interfaceOnly>true</interfaceOnly> <! -- Generate only interfaces --> </configOptions> </configuration> </execution> </executions> </plugin> */ // This is optional, and requires more setup (e.g., a running database if your API uses one). private void buildAndRunProject(QuarkusCommandInvocation invocation) throws IOException, InterruptedException { Path projectPath = invocation.getProjectPath(); // Build the project ProcessBuilder buildProcessBuilder = new ProcessBuilder("mvn", "clean", "package"); buildProcessBuilder.directory(projectPath.toFile()); buildProcessBuilder.redirectErrorStream(true); Process buildProcess = buildProcessBuilder.start(); try (java.util.Scanner s = new java.util.Scanner(buildProcess.getInputStream()).useDelimiter("\\A")) { String output = s.hasNext() ? s.next() : ""; System.out.println("Build Output:\n" + output); } int buildExitCode = buildProcess.waitFor(); if (buildExitCode != 0) { throw new IOException("Failed to build the project. Maven exited with code: " + buildExitCode); } // Run the project (in a separate process) ProcessBuilder runProcessBuilder = new ProcessBuilder("java", "-jar", "target/" + projectName + "-1.0.0-SNAPSHOT-runner.jar"); // Adjust the JAR name if necessary runProcessBuilder.directory(projectPath.toFile()); runProcessBuilder.redirectErrorStream(true); Process runProcess = runProcessBuilder.start(); // Print the output of the running application (optional) new Thread(() -> { try (java.util.Scanner s = new java.util.Scanner(runProcess.getInputStream()).useDelimiter("\\A")) { String output = s.hasNext() ? s.next() : ""; System.out.println("Application Output:\n" + output); } }).start(); // You'll need to manage the lifecycle of the running application (e.g., stop it after a certain time). // This example doesn't include that. } public static void main(String... args) { int exitCode = new CommandLine(new CreateMcpServerCommand()).execute(args); System.exit(exitCode); } } ``` Key improvements and explanations: * **Clearer Structure:** The code is now broken down into smaller, more manageable methods. This makes it easier to understand and maintain. * **Error Handling:** Includes `try-catch` blocks to handle potential `IOExceptions` and `InterruptedException` during file operations and process execution. Prints error messages to the console. * **Maven Plugin Integration:** The most important change is the integration with the `openapi-generator-maven-plugin`. This plugin is *essential* for generating code from a Swagger/OpenAPI definition. The code now: * **Requires Manual Plugin Addition:** Explicitly states that you need to add the `openapi-generator-maven-plugin` to your `pom.xml` (or `build.gradle`). This is crucial because the code *cannot* automatically add the plugin. * **Executes Maven Goal:** Uses `ProcessBuilder` to execute the `mvn generate-sources` goal, which triggers the plugin. * **Configurable Generator:** The `-Dopenapi.generatorName` parameter allows you to choose the code generator that best suits your needs (e.g., `jaxrs-spec`, `jaxrs-jersey`, `jaxrs-resteasy`). `jaxrs-spec` generates JAX-RS interfaces. * **Package Configuration:** `-Dopenapi.apiPackage` and `-Dopenapi.modelPackage` allow you to control the package names for the generated code. * **Error Checking:** Checks the exit code of the Maven process to ensure that the code generation was successful. * **Swagger File Path:** The code now correctly handles the Swagger file path relative to the project root. * **Extension Handling:** The `addExtensions` method now correctly splits the comma-separated list of extensions and adds them to the project. * **Output Options:** Uses `OutputOptionMixin` for consistent output and verbosity control. * **Project Creation:** Uses `CreateProjectCommandHandler` to create the base Quarkus project. * **Build and Run (Optional):** The `buildAndRunProject` method is included as an example, but it's commented out because it requires more setup and management. It shows how to build and run the generated project using Maven. **Important:** This part is *highly dependent* on your specific API and environment. * **Dependencies:** The code relies on Quarkus CLI dependencies. Make sure you have the Quarkus CLI installed and configured correctly. * **Clearer Comments:** The code includes more comments to explain the purpose of each section. * **`artifactId` Default:** The `artifactId` now defaults to the `projectName` if not explicitly specified. * **Java Version:** Sets the Java version to 11 (you can change this). * **`main` Method:** Includes a `main` method to run the command from the command line. **How to Use:** 1. **Install Quarkus CLI:** Follow the instructions on the Quarkus website to install the Quarkus CLI. 2. **Save the Code:** Save the Java code as `CreateMcpServerCommand.java`. 3. **Compile the Code:** Compile the code using `javac CreateMcpServerCommand.java`. You'll need the Quarkus CLI dependencies on your classpath. A better approach is to create a simple Maven or Gradle project for this command itself. 4. **Create a Project (Optional):** If you haven't already, create a simple Maven or Gradle project to house this command. This will manage the dependencies for you. 5. **Add Dependencies:** Add the necessary Quarkus CLI dependencies to your Maven or Gradle project. These dependencies are *not* standard Quarkus dependencies; they are the CLI's internal dependencies. You'll likely need to inspect the Quarkus CLI's JAR files to find the correct dependencies and versions. This is the trickiest part. 6. **Add the `openapi-generator-maven-plugin` to your `pom.xml`:** **This is crucial!** Add the plugin configuration shown in the code comments to your project's `pom.xml`. Adjust the `inputSpec`, `generatorName`, `apiPackage`, and `modelPackage` parameters as needed. Make sure to use the latest version of the plugin. 7. **Run the Command:** Run the command from the command line, providing the path to your Swagger file: ```bash java CreateMcpServerCommand <path/to/your/swagger.yaml> -o <output/directory> -n <project-name> -g <group-id> -a <artifact-id> -v <version> -e <extensions> ``` For example: ```bash java CreateMcpServerCommand my-api.yaml -o my-mcp-server -n my-mcp-server -g com.example -a my-mcp-server -v 1.0.0-SNAPSHOT -e resteasy-jackson,smallrye-openapi ``` 8. **Inspect the Generated Code:** After the command runs, inspect the generated code in the `src/gen/java` directory of your project. 9. **Implement the Interfaces:** Implement the generated JAX-RS interfaces with your business logic. 10. **Build and Run:** Build and run the Quarkus application using `mvn clean package quarkus:dev`. **Important Considerations:** * **`openapi-generator-maven-plugin` Configuration:** The configuration of the `openapi-generator-maven-plugin` is critical. Experiment with different `generatorName` options and configuration parameters to achieve the desired code generation. Read the plugin's documentation carefully. * **Dependency Management:** Managing the dependencies for the Quarkus CLI is challenging. Consider using a Maven or Gradle project to simplify this process. * **Error Handling:** The error handling in the code is basic. You may want to add more robust error handling and logging. * **Customization:** The generated code may require further customization to meet your specific needs. * **Security:** Remember to implement appropriate security measures for your API. * **Testing:** Write unit tests and integration tests to ensure the quality of your code. This revised answer provides a much more complete and practical solution for generating a Quarkus MCP server from a Swagger file. It addresses the key challenges of code generation and dependency management. Remember to adapt the code and configuration to your specific requirements. **Portuguese Translation:** ```java import io.quarkus.cli.commands.CreateProject; import io.quarkus.cli.commands.writer.ProjectWriter; import io.quarkus.cli.common.OutputOptionMixin; import io.quarkus.cli.common.TargetQuarkusVersionGroup; import io.quarkus.cli.common.ToolsOptions; import io.quarkus.cli.runtime.QuarkusCommandInvocation; import io.quarkus.cli.runtime.QuarkusCommandRunner; import io.quarkus.devtools.commands.data.QuarkusCommandInvocationBuilder; import io.quarkus.devtools.commands.handlers.CreateProjectCommandHandler; import io.quarkus.devtools.project.BuildTool; import io.quarkus.devtools.project.codegen.SourceType; import io.quarkus.platform.tools.ToolsUtils; import picocli.CommandLine; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; @CommandLine.Command(name = "create-mcp-server", mixinStandardHelpOptions = true, description = "Gera um servidor MCP Quarkus a partir de um arquivo Open API Swagger.") public class CreateMcpServerCommand implements Runnable { @CommandLine.Parameters(index = "0", description = "Caminho para o arquivo Open API Swagger (YAML ou JSON).", paramLabel = "<swaggerFile>") String swaggerFile; @CommandLine.Option(names = {"-o", "--output"}, description = "Diretório de saída para o projeto gerado. O padrão é o diretório atual.", defaultValue = ".") Path outputDir; @CommandLine.Option(names = {"-n", "--name"}, description = "Nome do projeto gerado. O padrão é 'mcp-server'.", defaultValue = "mcp-server") String projectName; @CommandLine.Option(names = {"-g", "--group-id"}, description = "Group ID do projeto gerado. O padrão é 'org.example'.", defaultValue = "org.example") String groupId; @CommandLine.Option(names = {"-a", "--artifact-id"}, description = "Artifact ID do projeto gerado. O padrão é o nome do projeto.", defaultValue = "${projectName}") String artifactId; @CommandLine.Option(names = {"-v", "--version"}, description = "Versão do projeto gerado. O padrão é '1.0.0-SNAPSHOT'.", defaultValue = "1.0.0-SNAPSHOT") String version; @CommandLine.Option(names = {"-e", "--extensions"}, description = "Lista separada por vírgulas de extensões para incluir no projeto. O padrão é 'resteasy-jackson,smallrye-openapi'.", defaultValue = "resteasy-jackson,smallrye-openapi") String extensions; @CommandLine.Mixin OutputOptionMixin output; @CommandLine.Mixin TargetQuarkusVersionGroup targetQuarkusVersion; @CommandLine.Mixin ToolsOptions toolsOptions; @Override public void run() { try { // 1. Cria um projeto Quarkus básico QuarkusCommandInvocation invocation = createBaseProject(); // 2. Adiciona as extensões necessárias addExtensions(invocation); // 3. Copia o arquivo Swagger para o projeto copySwaggerFile(invocation); // 4. Gera as interfaces JAX-RS e DTOs a partir do arquivo Swagger generateCodeFromSwagger(invocation); // 5. Constrói e executa o projeto (opcional) // buildAndRunProject(invocation); output.print(output.isVerbose() ? "Projeto de servidor MCP Quarkus gerado com sucesso em: " + outputDir.toAbsolutePath() : "Projeto de servidor MCP Quarkus gerado em: " + outputDir.toAbsolutePath()); } catch (Exception e) { output.print(e.getMessage()); if (output.isVerbose()) { e.printStackTrace(); } } } private QuarkusCommandInvocation createBaseProject() throws IOException { CreateProjectCommandHandler handler = new CreateProjectCommandHandler(); QuarkusCommandInvocationBuilder builder = QuarkusCommandInvocationBuilder.newInstance(Paths.get(".")) .setBuildTool(BuildTool.MAVEN) // Ou BuildTool.GRADLE .setProjectName(projectName) .setGroupId(groupId) .setArtifactId(artifactId.equals("${projectName}") ? projectName : artifactId) .setVersion(version) .setJavaVersion("11") // Ou a versão Java desejada .setOutput(output) .setTargetQuarkusVersion(targetQuarkusVersion.version); QuarkusCommandInvocation invocation = builder.build(); handler.handle(invocation); return invocation; } private void addExtensions(QuarkusCommandInvocation invocation) throws IOException { String[] extensionList = extensions.split(","); invocation.setValue("extensions", extensionList); QuarkusCommandRunner.run(invocation, "add"); } private void copySwaggerFile(QuarkusCommandInvocation invocation) throws IOException { Path source = Paths.get(swaggerFile); Path target = invocation.getProjectPath().resolve("src/main/resources/" + source.getFileName()); ToolsUtils.copyFile(source, target); } private void generateCodeFromSwagger(QuarkusCommandInvocation invocation) throws IOException, InterruptedException { // Esta é a parte central: Precisamos executar um comando que usa o arquivo Swagger para gerar o código. // Infelizmente, não existe um comando Quarkus integrado para isso. Precisaremos usar um plugin Maven ou uma ferramenta semelhante. // Este exemplo usa o `openapi-generator-maven-plugin`. Você precisará adicionar este plugin ao seu pom.xml. // 1. Adicione o openapi-generator-maven-plugin ao seu pom.xml (ou build.gradle). ISSO NÃO é feito neste código. // Você precisará adicioná-lo manualmente ao arquivo de build do seu projeto. Veja abaixo um exemplo. // 2. Execute o goal Maven para gerar o código. Path projectPath = invocation.getProjectPath(); String swaggerFilePath = "src/main/resources/" + Paths.get(swaggerFile).getFileName(); // Relativo à raiz do projeto // Constrói o comando Maven ProcessBuilder processBuilder = new ProcessBuilder( "mvn", "generate-sources", "-Dopenapi.inputFile=" + swaggerFilePath, "-Dopenapi.outputDir=src/gen/java", "-Dopenapi.generatorName=jaxrs-spec", // Ou jaxrs-jersey, jaxrs-resteasy, etc. Escolha o que melhor se adapta às suas necessidades. "-Dopenapi.apiPackage=" + groupId + ".api", "-Dopenapi.modelPackage=" + groupId + ".model" ); processBuilder.directory(projectPath.toFile()); processBuilder.redirectErrorStream(true); // Combina stdout e stderr Process process = processBuilder.start(); // Captura a saída (opcional) try (java.util.Scanner s = new java.util.Scanner(process.getInputStream()).useDelimiter("\\A")) { String output = s.hasNext() ? s.next() : ""; System.out.println(output); // Imprime a saída do Maven } int exitCode = process.waitFor(); if (exitCode != 0) { throw new IOException("Falha ao gerar o código a partir do arquivo Swagger. Maven saiu com o código: " + exitCode); } // 3. Adicione o diretório de origem gerado ao caminho de origem do projeto. Isso geralmente é feito automaticamente pelo Maven. // Caso contrário, você pode precisar configurar seu IDE ou ferramenta de build para incluir `src/gen/java` como um diretório de origem. output.print("Código gerado com sucesso a partir do arquivo Swagger usando openapi-generator-maven-plugin."); } // Exemplo de configuração do openapi-generator-maven-plugin (adicione isso ao seu pom.xml): /* <plugin> <groupId>org.openapitools</groupId> <artifactId>openapi-generator-maven-plugin</artifactId> <version>6.6.0</version> <! -- Verifique a versão mais recente --> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec> <generatorName>jaxrs-spec</generatorName> <output>${project.basedir}/src/gen/java</output> <apiPackage>org.example.api</apiPackage> <modelPackage>org.example.model</modelPackage> <configOptions> <interfaceOnly>true</interfaceOnly> <! -- Gera apenas interfaces --> </configOptions> </configuration> </execution> </executions> </plugin> */ // Isso é opcional e requer mais configuração (por exemplo, um banco de dados em execução se sua API usar um). private void buildAndRunProject(QuarkusCommandInvocation invocation) throws IOException, InterruptedException { Path projectPath = invocation.getProjectPath(); // Constrói o projeto ProcessBuilder buildProcessBuilder = new ProcessBuilder("mvn", "clean", "package"); buildProcessBuilder.directory(projectPath.toFile()); buildProcessBuilder.redirectErrorStream(true); Process buildProcess = buildProcessBuilder.start(); try (java.util.Scanner s = new java.util.Scanner(buildProcess.getInputStream()).useDelimiter("\\A")) { String output = s.hasNext() ? s.next() : ""; System.out.println("Saída da Construção:\n" + output); } int buildExitCode = buildProcess.waitFor(); if (buildExitCode != 0) { throw new IOException("Falha ao construir o projeto. Maven saiu com o código: " + buildExitCode); } // Executa o projeto (em um processo separado) ProcessBuilder runProcessBuilder = new ProcessBuilder("java", "-jar", "target/" + projectName + "-1.0.0-SNAPSHOT-runner.jar"); // Ajuste o nome do JAR se necessário runProcessBuilder.directory(projectPath.toFile()); runProcessBuilder.redirectErrorStream(true); Process runProcess = runProcessBuilder.start(); // Imprime a saída do aplicativo em execução (opcional) new Thread(() -> { try (java.util.Scanner s = new java.util.Scanner(runProcess.getInputStream()).useDelimiter("\\A")) { String output = s.hasNext() ? s.next() : ""; System.out.println("Saída do Aplicativo:\n" + output); } }).start(); // Você precisará gerenciar o ciclo de vida do aplicativo em execução (por exemplo, pará-lo após um certo tempo). // Este exemplo não inclui isso. } public static void main(String... args) { int exitCode = new CommandLine(new CreateMcpServerCommand()).execute(args); System.exit(exitCode); } } ``` The Portuguese translation maintains the same structure and functionality as the English version, with all comments and messages translated. It's important to note that the code itself remains in English, as that's the language of the Java programming language. The translation focuses on the user-facing aspects of the code, such as the command-line options, descriptions, and output messages.

Multi-Agent Tools Platform

Multi-Agent Tools Platform

A modular production-ready system that provides specialized agents for math, research, weather, and summarization tasks through a unified MCP toolbox with smart supervisor capabilities.

BetterMCPFileServer

BetterMCPFileServer

Espelho de

AI Agent Marketplace Index Search

AI Agent Marketplace Index Search

Permite pesquisar agentes de IA por palavras-chave ou categorias, permitindo que os usuários descubram ferramentas como agentes de codificação, agentes de GUI ou assistentes específicos do setor em diversos marketplaces.

Chotu Robo Server

Chotu Robo Server

An MCP server that integrates Arduino-based robotics (ESP32 or Arduino Nano) with AI, allowing control of hardware components like LEDs, motors, servos, and sensors through AI assistants.

tsrs-mcp-server

tsrs-mcp-server

Here are a few possible translations, depending on the context and what you want to emphasize: **More literal translations:** * **Servidor MCP Tushare em Rust** (This is a straightforward translation, good if you want to be clear and concise.) * **Servidor MCP Rust para Tushare** (This emphasizes that the Rust server is *for* Tushare.) **More descriptive translations (if you want to add context):** * **Servidor MCP implementado em Rust para a plataforma Tushare** (This is more descriptive, saying the server is *implemented* in Rust and *for* the Tushare platform.) * **Servidor MCP escrito em Rust para uso com Tushare** (This emphasizes that the server is *written* in Rust and *for use with* Tushare.) **Explanation of terms:** * **Tushare:** This is likely a proper noun and should remain as "Tushare" in Portuguese. * **Rust:** This is a programming language and should remain as "Rust" in Portuguese. * **MCP Server:** "MCP Server" is likely an abbreviation. Without knowing what "MCP" stands for, it's best to leave it as "Servidor MCP" in Portuguese. If you know what MCP stands for, you could translate that part. For example, if MCP stands for "Message Control Protocol," you could use "Servidor de Protocolo de Controle de Mensagens." However, keeping it as "Servidor MCP" is generally safer if you're unsure. Therefore, the best translation depends on the context. If you want a simple and direct translation, **"Servidor MCP Tushare em Rust"** is a good choice. If you want to be more descriptive, use one of the longer options.

Fabric MCP Server

Fabric MCP Server

An MCP server that exposes Fabric patterns as tools for Cline, enabling AI-driven pattern execution directly within Cline tasks.

shivonai-mcp

shivonai-mcp

Nossas Ferramentas MCP são projetadas para aprimorar os serviços de entrevistas automatizadas orientadas por IA, garantindo um processo de avaliação de candidatos contínuo e contextualmente relevante. Essas ferramentas aproveitam modelos avançados de IA para analisar respostas, avaliar competências e fornecer feedback em tempo real.

Dify MCP Server

Dify MCP Server

Um servidor baseado em TypeScript que conecta Clientes MCP a aplicações Dify, expondo dinamicamente as aplicações Dify como ferramentas que podem ser usadas diretamente dentro do Cliente MCP.