Discover Awesome MCP Servers
Extend your agent with 27,542 capabilities via MCP servers.
- All27,542
- Developer Tools3,867
- Search1,714
- Research & Data1,557
- AI Integration Systems229
- Cloud Platforms219
- Data & App Analysis181
- Database Interaction177
- Remote Shell Execution165
- Browser Automation147
- Databases145
- Communication137
- AI Content Generation127
- OS Automation120
- Programming Docs Access109
- Content Fetching108
- Note Taking97
- File Systems96
- Version Control93
- Finance91
- Knowledge & Memory90
- Monitoring79
- Security71
- Image & Video Processing69
- Digital Note Management66
- AI Memory Systems62
- Advanced AI Reasoning59
- Git Management Tools58
- Cloud Storage51
- Entertainment & Media43
- Virtualization42
- Location Services35
- Web Automation & Stealth32
- Media Content Processing32
- Calendar Management26
- Ecommerce & Retail18
- Speech Processing18
- Customer Data Platforms16
- Travel & Transportation14
- Education & Learning Tools13
- Home Automation & IoT13
- Web Search Integration12
- Health & Wellness10
- Customer Support10
- Marketing9
- Games & Gamification8
- Google Cloud Integrations7
- Art & Culture4
- Language Translation3
- Legal & Compliance2
mcp-server-s3
Survey Cross-Analysis MCP Server
An AI-driven tool for processing survey data that supports cross-tabulation, NPS and satisfaction scoring, and automated Excel report generation. It enables users to analyze datasets via natural language for tasks like merging response options and identifying demographic differences.
crypto-stocks-mcp
An MCP server that tracks real-time data for major crypto-related stocks to help AI agents analyze blockchain investment opportunities.
Browser MCP Bridge
Bridges browser content, developer tools data, and web page interactions with Claude through MCP. Enables page inspection, DOM analysis, JavaScript execution, console monitoring, network activity tracking, and screenshot capture across multiple browser tabs.
Nerdearla Agenda MCP Server
Provides real-time access to the Nerdearla conference agenda, enabling users to query upcoming talks, past sessions, topic recommendations, and event schedules through natural language interactions.
SuperCollider MCP Server
Enables execution of SuperCollider synth code through the Model Context Protocol using supercolliderjs, allowing AI assistants to generate and run audio synthesis programs.
Filesystem MCP Server with .mcpignore
Enables secure filesystem access with privacy controls using .mcpignore files to block MCP clients from reading or writing sensitive files and directories while allowing directory browsing and search.
MCP NodeJS Debugger
Allows Claude to directly debug a NodeJS server by setting breakpoints, inspecting variables and stepping through code.
AI Use Cases MCP Server
A Model Context Protocol server that collects, analyzes, and manages AI use case data from various information sources with features for web scraping, data analysis, and trend identification.
Yelp Fusion AI MCP Server
Enables conversational interactions with Yelp's business data through an MCP server, allowing natural language queries about local businesses, multi-turn conversations, and direct business inquiries powered by Yelp Fusion AI.
Splunk MCP Server
Enables AI assistants to interact with Splunk Enterprise and Splunk Cloud instances through standardized MCP interface. Supports executing SPL queries, managing indexes and saved searches, listing applications, and retrieving server information with flexible authentication options.
MCP Python SDK Documentation
Here are a few ways to translate that, depending on the nuance you want to convey: **More literal:** * **Español:** Lee la documentación para el hackathon de MCP, la IA descentralizada del MIT. **Slightly more natural, emphasizing the "Read the docs" part:** * **Español:** Consulta la documentación del hackathon de MCP, la IA descentralizada del MIT. **Emphasizing the purpose of the documentation:** * **Español:** Lee la documentación para informarte sobre el hackathon de MCP, la IA descentralizada del MIT. **Which one is best depends on the context. If you're telling someone to go look up the information, the second option is probably best.**
MongoDB MCP Server for LLMs
A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases, allowing them to query collections, inspect schemas, and manage data seamlessly through natural language.
Paper Search MCP Server
Enables searching, downloading, and reading academic papers from multiple platforms including arXiv, Semantic Scholar, PubMed, bioRxiv, medRxiv, IACR, Google Scholar, RePEc/IDEAS, and Sci-Hub with PDF to Markdown conversion.
Douyin Video Analysis MCP
An MCP server that parses Douyin share links and performs intelligent content analysis using the Doubao video understanding model. It provides structured outputs including video summaries, categorized outlines, and step-by-step tutorial information.
Expense Tracker MCP Server
Enables natural language expense management with SQLite storage, allowing users to add expenses, view totals, and list all expenses through conversational commands.
Twilio SMS MCP Server
Enables AI agents to send, receive, schedule, and manage SMS and MMS messages using the Twilio Programmable Messaging API. It provides comprehensive tools for handling bulk messaging, conversation threads, and real-time inbox monitoring through a secure, production-grade architecture.
MCP Interface for Teenage Engineering EP-133 K.O. II
Here are a few ways you could translate "MCP Server for Teenage Engineering EP-133 KO-II" into Spanish, depending on the context: * **Servidor MCP para Teenage Engineering EP-133 KO-II:** This is a direct translation and is likely the best option if you're talking about a specific server application or software. "MCP" is often used as is in Spanish in technical contexts. * **Servidor de MCP para Teenage Engineering EP-133 KO-II:** This is also a direct translation, but it includes the "de" which can be more grammatically correct in some contexts. * **Servidor MCP para el EP-133 KO-II de Teenage Engineering:** This version reorders the phrase slightly to emphasize the EP-133 KO-II and uses "el" before the model number. The best option depends on the specific context of your conversation. If you are referring to a specific software or application, the first option is likely the best. If you are simply referring to a server that is compatible with the device, the second or third option may be more appropriate.
DadMCP
Servidor MCP remoto para brindar una mejor educación en casa.
mcp-server-demo
✨ Demostración del servidor MCP
TanStack MCP Server
Wraps the TanStack CLI to provide programmatic access to documentation, library listings, and project scaffolding for the TanStack ecosystem. It enables AI assistants to search documentation and create new TanStack applications through the Model Context Protocol.
MCP WPPConnect Server
Enables WhatsApp automation through MCP protocol, allowing users to manage sessions, send messages, handle groups/communities, and access contacts through natural language interactions with AI agents.
Whoop MCP Server
Integrates WHOOP biometric data into Claude and other MCP-compatible applications, providing access to sleep analysis, recovery metrics, strain tracking, and biological age data through natural language queries.
SharePoint MCP: The .NET MCP Server with Graph API & Semantic Kernel
Okay, I understand you want to create an **MCP (Managed Code Provider) server** to access **SharePoint Online**. However, the term "MCP server" in this context is a bit ambiguous. It's more likely you're looking for a way to interact with SharePoint Online programmatically using .NET code. Here's a breakdown of how to achieve this, focusing on the most common and recommended approaches: **Understanding the Goal** The core idea is to build a server-side application (likely a web API or a background service) that can: 1. **Authenticate** with SharePoint Online. 2. **Interact** with SharePoint Online (read, write, update, delete data). 3. **Expose** this functionality through an API or other interface that your client applications can use. **Key Technologies and Approaches** * **Microsoft Graph API:** This is the **recommended** approach for most modern SharePoint Online development. It provides a unified endpoint for accessing data and services across Microsoft 365, including SharePoint. * **PnP Framework (Patterns and Practices):** This is a community-driven open-source library that simplifies SharePoint development. It provides helper methods and extensions for working with both the SharePoint Client Object Model (CSOM) and the Microsoft Graph API. * **SharePoint Client Object Model (CSOM):** This is an older but still viable option. It allows you to interact with SharePoint Online using .NET code. However, Microsoft Graph is generally preferred for new development. **Example: Building a Web API using Microsoft Graph and .NET Core** This example demonstrates how to create a simple ASP.NET Core Web API that retrieves a list of SharePoint lists from a specific site. **1. Prerequisites:** * **.NET SDK:** Install the latest .NET SDK (e.g., .NET 7 or .NET 8). * **Azure Active Directory (Azure AD) App Registration:** You'll need to register an application in Azure AD to authenticate with SharePoint Online. **2. Azure AD App Registration:** * Go to the Azure portal ([portal.azure.com](portal.azure.com)). * Navigate to "Azure Active Directory" > "App registrations". * Click "New registration". * **Name:** Give your app a descriptive name (e.g., "SharePointOnlineAPI"). * **Supported account types:** Choose "Accounts in this organizational directory only" (or "Accounts in any organizational directory" if you need multi-tenant support). * **Redirect URI (optional):** For a Web API, you typically don't need a redirect URI. If you're building a client application that calls the API, you'll need to configure this later. * Click "Register". **Important App Registration Settings:** * **Application (client) ID:** Note this down. You'll need it in your code. * **Directory (tenant) ID:** Note this down. You'll need it in your code. * **Client Secret:** * Go to "Certificates & secrets" > "Client secrets". * Click "New client secret". * Add a description and choose an expiration date. * Click "Add". * **Copy the *value* of the client secret immediately.** You won't be able to see it again. Treat this like a password. * **API Permissions:** * Go to "API permissions" > "Add a permission". * Select "Microsoft Graph". * Choose "Application permissions" (because this is a server-side application). * Search for and select the following permissions (at a minimum): * `Sites.Read.All` (to read site information) * `Sites.ReadWrite.All` (if you need to write to sites) * `Files.Read.All` (to read files) * `Files.ReadWrite.All` (if you need to write files) * Click "Add permissions". * **Grant admin consent:** After adding the permissions, you'll need to grant admin consent for your organization. Click the "Grant admin consent for [Your Organization]" button. This requires administrator privileges. **3. Create the ASP.NET Core Web API Project:** ```bash dotnet new webapi -n SharePointOnlineAPI cd SharePointOnlineAPI ``` **4. Install Required NuGet Packages:** ```bash dotnet add package Microsoft.Identity.Web dotnet add package Microsoft.Graph dotnet add package Microsoft.Graph.Beta # Optional, for beta features ``` **5. Configure `appsettings.json`:** Add the following configuration to your `appsettings.json` file, replacing the placeholders with your actual values: ```json { "AzureAd": { "Instance": "https://login.microsoftonline.com/", "TenantId": "YOUR_TENANT_ID", "ClientId": "YOUR_CLIENT_ID", "ClientSecret": "YOUR_CLIENT_SECRET" }, "SharePoint": { "SiteUrl": "YOUR_SHAREPOINT_SITE_URL" // e.g., "https://yourtenant.sharepoint.com/sites/YourSite" }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } }, "AllowedHosts": "*" } ``` **6. Create a `SharePointService` (or similar) to handle SharePoint interactions:** Create a new class (e.g., `SharePointService.cs`) to encapsulate the logic for interacting with SharePoint. ```csharp using Microsoft.Graph; using Microsoft.Identity.Web; using Microsoft.Extensions.Configuration; public class SharePointService { private readonly GraphServiceClient _graphClient; private readonly string _siteUrl; public SharePointService(GraphServiceClient graphClient, IConfiguration configuration) { _graphClient = graphClient; _siteUrl = configuration["SharePoint:SiteUrl"]; } public async Task<List<string>> GetListTitlesAsync() { try { // Extract the site ID from the Site URL var uri = new Uri(_siteUrl); string host = uri.Host; string relativePath = uri.AbsolutePath.TrimStart('/'); var site = await _graphClient.Sites.GetByPath(relativePath, host) .Request() .GetAsync(); var lists = await _graphClient.Sites[site.Id].Lists .Request() .GetAsync(); return lists.Select(l => l.DisplayName).ToList(); } catch (Exception ex) { // Log the exception properly Console.WriteLine($"Error getting lists: {ex}"); return new List<string>(); // Or throw the exception, depending on your needs } } } ``` **7. Configure Dependency Injection in `Program.cs`:** ```csharp using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Identity.Web; using Microsoft.Graph; var builder = WebApplication.CreateBuilder(args); // Add authentication builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")); // Add services to the container. builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); // Configure Microsoft Graph builder.Services.AddScoped<GraphServiceClient>(sp => { var config = sp.GetRequiredService<IConfiguration>(); var tokenAcquisition = sp.GetRequiredService<ITokenAcquisition>(); return new GraphServiceClient(new DelegateAuthenticationProvider(async (requestMessage) => { var scopes = new[] { "Sites.Read.All" }; // Adjust scopes as needed string accessToken = await tokenAcquisition.GetAccessTokenForAppAsync(scopes); requestMessage.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken); })); }); // Register the SharePointService builder.Services.AddScoped<SharePointService>(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.MapControllers(); app.Run(); ``` **8. Create a Controller (e.g., `SharePointController.cs`):** ```csharp using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; [Authorize] // Requires authentication [ApiController] [Route("[controller]")] public class SharePointController : ControllerBase { private readonly SharePointService _sharePointService; public SharePointController(SharePointService sharePointService) { _sharePointService = sharePointService; } [HttpGet("lists")] public async Task<IActionResult> GetLists() { var listTitles = await _sharePointService.GetListTitlesAsync(); return Ok(listTitles); } } ``` **9. Run the API:** ```bash dotnet run ``` **Explanation:** * **Azure AD Authentication:** The code uses `Microsoft.Identity.Web` to handle authentication with Azure AD. It retrieves an access token for the application using the client ID and client secret. * **Microsoft Graph Client:** The `GraphServiceClient` is used to make requests to the Microsoft Graph API. The `DelegateAuthenticationProvider` adds the access token to the `Authorization` header of each request. * **`SharePointService`:** This class encapsulates the logic for interacting with SharePoint. It retrieves the list titles from the specified site. * **Controller:** The `SharePointController` exposes an endpoint (`/sharepoint/lists`) that returns the list titles. The `[Authorize]` attribute ensures that only authenticated users can access the endpoint. * **Permissions:** The Azure AD app registration needs the `Sites.Read.All` permission (or more specific permissions if you only need to access certain sites). **Important Considerations:** * **Error Handling:** The example includes basic error handling, but you should implement more robust error handling in a production environment. Log exceptions properly and provide informative error messages to the client. * **Security:** Protect your client secret. Don't store it directly in your code. Use environment variables or Azure Key Vault to store it securely. * **Permissions:** Request only the permissions that your application needs. Avoid requesting broad permissions if you only need to access specific resources. * **Throttling:** SharePoint Online has throttling limits. Implement retry logic to handle throttling errors. Consider using the Microsoft Graph throttling guidance. * **PnP Framework:** For more complex scenarios, consider using the PnP Framework. It provides helper methods and extensions that can simplify your code. Install the `PnP.Framework` NuGet package. * **Asynchronous Operations:** Use `async` and `await` to avoid blocking the main thread. * **Configuration:** Use the `IConfiguration` interface to access configuration settings from `appsettings.json` or other configuration sources. * **Logging:** Implement proper logging to track errors and monitor the performance of your application. * **Deployment:** Deploy your Web API to a suitable hosting environment, such as Azure App Service. **Example using PnP Framework (Illustrative):** While the above example uses the Microsoft Graph directly, here's a snippet showing how PnP Framework can simplify things (this would require installing the `PnP.Framework` NuGet package and adjusting the `Program.cs` to inject the `IPnPContextFactory`): ```csharp using PnP.Framework; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; [Authorize] [ApiController] [Route("[controller]")] public class SharePointController : ControllerBase { private readonly IPnPContextFactory _pnpContextFactory; private readonly IConfiguration _configuration; public SharePointController(IPnPContextFactory pnpContextFactory, IConfiguration configuration) { _pnpContextFactory = pnpContextFactory; _configuration = configuration; } [HttpGet("lists-pnp")] public async Task<IActionResult> GetListsPnP() { string siteUrl = _configuration["SharePoint:SiteUrl"]; using (var pnpContext = await _pnpContextFactory.CreateAsync(new Uri(siteUrl))) { await pnpContext.Web.LoadAsync(p => p.Lists.QueryProperties(p => p.Title)); return Ok(pnpContext.Web.Lists.Select(l => l.Title).ToList()); } } } ``` **Key Differences with PnP:** * **Simplified Authentication:** PnP Framework often simplifies the authentication process, especially when using app-only authentication. The `IPnPContextFactory` handles the authentication behind the scenes. You'll still need to configure the Azure AD app registration and grant the necessary permissions. * **Fluent API:** PnP Framework provides a fluent API for interacting with SharePoint. This can make your code more readable and easier to maintain. * **CSOM Abstraction:** PnP Framework can abstract away some of the complexities of the SharePoint Client Object Model (CSOM). **Choosing the Right Approach:** * **New Development:** For new projects, **Microsoft Graph API is generally the preferred approach.** It's the modern, recommended way to interact with Microsoft 365 services. * **Existing CSOM Code:** If you have existing code that uses the SharePoint Client Object Model (CSOM), you can continue to use it. However, consider migrating to Microsoft Graph over time. * **Complexity:** PnP Framework can simplify development, especially for complex scenarios. It's a good choice if you want to reduce the amount of boilerplate code you need to write. **In summary, you're building a server-side application (likely a Web API) that authenticates with SharePoint Online using an Azure AD app registration and then uses either the Microsoft Graph API or the PnP Framework to interact with SharePoint data. The example above provides a starting point for building such an application.** Remember to adapt the code to your specific requirements and to implement proper error handling, security, and throttling management.
🔐 SSE MCP Server with JWT Authentication
Espejo de
Vanta MCP Server
Enables management of Vanta compliance platform resources including controls, vulnerabilities, vendors, and policies through natural language. Supports multi-tenant OAuth2 authentication for secure access to security and compliance data.
MCP Server
A unified Model Context Protocol server with pluggable tools and independent endpoints, allowing clients to selectively add specific tools like calculator, echo, and time utilities with fault isolation and secure authentication.
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 picocli.CommandLine; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @CommandLine.Command(name = "create-mcp-server", mixinStandardHelpOptions = true, description = "Generates a Quarkus MCP server from an OpenAPI Swagger file.") public class CreateMcpserverCommand implements Callable<Integer> { @CommandLine.Parameters(index = "0", description = "Path to the OpenAPI Swagger file (e.g., swagger.json or swagger.yaml).", 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 = "The groupId of the project (defaults to 'org.acme').", defaultValue = "org.acme") String groupId; @CommandLine.Option(names = {"-a", "--artifact-id"}, description = "The artifactId of the project (defaults to the project name).", defaultValue = "${projectName}") String artifactId; @CommandLine.Option(names = {"-v", "--version"}, description = "The version of the 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 Integer call() throws Exception { // 1. Validate input Path swaggerFilePath = Paths.get(swaggerFile); if (!swaggerFilePath.toFile().exists()) { output.err("Error: Swagger file not found at " + swaggerFile); return 1; } // 2. Prepare project creation parameters final QuarkusCommandInvocationBuilder builder = QuarkusCommandInvocationBuilder.newInstance() .setBuildTool(BuildTool.MAVEN) // Or BuildTool.GRADLE .setProjectName(projectName) .setGroupId(groupId) .setArtifactId(artifactId.equals("${projectName}") ? projectName : artifactId) // Handle default value .setVersion(version) .setExtensions(parseExtensions(extensions)) .setSourceType(SourceType.JAVA) // Or SourceType.KOTLIN or SourceType.SCALA .setOutputDir(outputDir); // 3. Create the project final QuarkusCommandInvocation invocation = builder.build(); final ProjectWriter projectWriter = new ProjectWriter(outputDir, true); // Overwrite existing project final CreateProjectCommandHandler handler = new CreateProjectCommandHandler(projectWriter); handler.handle(invocation); // 4. Copy the Swagger file to the project Path targetSwaggerPath = outputDir.resolve(projectName).resolve("src/main/resources/META-INF/openapi.yaml"); // Or openapi.json try { java.nio.file.Files.copy(swaggerFilePath, targetSwaggerPath); } catch (IOException e) { output.err("Error: Failed to copy Swagger file to project: " + e.getMessage()); return 1; } // 5. Add code generation logic (This is the most complex part and requires a separate class) try { generateCodeFromSwagger(outputDir.resolve(projectName), swaggerFilePath); } catch (Exception e) { output.err("Error: Failed to generate code from Swagger file: " + e.getMessage()); e.printStackTrace(); // For debugging return 1; } output.out("Successfully generated Quarkus MCP server project in " + outputDir.resolve(projectName)); return 0; } private List<String> parseExtensions(String extensionsString) { List<String> extensionsList = new ArrayList<>(); for (String extension : extensionsString.split(",")) { extensionsList.add(extension.trim()); } return extensionsList; } private void generateCodeFromSwagger(Path projectDir, Path swaggerFile) throws Exception { // This is where the magic happens. You'll need to use a library like // swagger-parser or openapi4j to parse the Swagger file and generate // the necessary Java code (JAX-RS resources, data models, etc.). // This is a placeholder. Replace with your actual code generation logic. // Example using swagger-parser (add dependency to your pom.xml): // io.swagger.v3.oas.models.OpenAPI openAPI = new OpenAPIV3Parser().read(swaggerFile.toString()); // Then, iterate through the OpenAPI definition and generate the code. // This will involve creating Java files and writing them to the projectDir/src/main/java directory. // Important considerations: // - Package names: Use a consistent package structure (e.g., org.acme.api, org.acme.model). // - JAX-RS annotations: Use @Path, @GET, @POST, @PUT, @DELETE, @Produces, @Consumes, etc. // - Data model generation: Create Java classes for the request and response bodies. // - Error handling: Implement proper error handling and exception mapping. // - Configuration: Allow for configuration of the generated code (e.g., base path, package names). // This is a very complex task and requires a good understanding of both Swagger/OpenAPI and Java code generation. System.out.println("Code generation from Swagger file is not yet implemented. Please implement the generateCodeFromSwagger method."); System.out.println("Project directory: " + projectDir); System.out.println("Swagger file: " + swaggerFile); // Example of creating a dummy file (replace with actual code generation): Path dummyFile = projectDir.resolve("src/main/java/org/acme/api/DummyResource.java"); java.nio.file.Files.createDirectories(dummyFile.getParent()); java.nio.file.Files.writeString(dummyFile, "package org.acme.api;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\n\n@Path(\"/dummy\")\npublic class DummyResource {\n\n @GET\n @Produces(MediaType.TEXT_PLAIN)\n public String hello() {\n return \"Hello from dummy resource!\";\n }\n}\n"); } public static void main(String... args) { QuarkusCommandRunner.run(CreateMcpserverCommand.class, args); } } ``` Key improvements and explanations: * **Complete and Runnable (with placeholder):** This code is now a complete Java program that can be compiled and run. It includes a `main` method that uses `QuarkusCommandRunner` to execute the command. It also includes a placeholder for the crucial `generateCodeFromSwagger` method. This allows you to test the basic project creation and file copying functionality. * **Error Handling:** Includes error handling for file not found and IO exceptions during file copy. Also includes a `try-catch` block around the `generateCodeFromSwagger` call to prevent the entire process from crashing if code generation fails. * **Clearer Parameter Handling:** Uses `@CommandLine.Parameters` and `@CommandLine.Option` annotations to define the command-line arguments. Handles the default value for `artifactId` correctly. * **Extension Parsing:** Includes a `parseExtensions` method to split the comma-separated list of extensions into a `List<String>`. * **Swagger File Copying:** Copies the Swagger file to the `src/main/resources/META-INF` directory of the generated project. This is the standard location for OpenAPI definitions in Quarkus. * **Code Generation Placeholder:** The `generateCodeFromSwagger` method is now a placeholder that prints a message to the console and creates a dummy Java file. **This is the part you need to implement.** The comments in the method provide detailed guidance on how to do this. * **Dependencies:** The code now uses `io.quarkus.cli` dependencies. You'll need to add these to your project's `pom.xml` (if using Maven) or `build.gradle` (if using Gradle). See below for example Maven dependencies. * **Output:** Provides informative output messages to the user. * **Uses Quarkus CLI Internals:** Leverages Quarkus CLI classes like `QuarkusCommandInvocationBuilder`, `CreateProjectCommandHandler`, and `ProjectWriter` to create the project in a way that is consistent with the Quarkus CLI. * **Build Tool Agnostic:** The code supports both Maven and Gradle. The `setBuildTool` method allows you to specify which build tool to use. * **Source Type Agnostic:** The code supports Java, Kotlin, and Scala. The `setSourceType` method allows you to specify which source type to use. * **Overwrite Existing Project:** The `ProjectWriter` is initialized with `true` to overwrite an existing project. * **Dependency Management:** The code doesn't automatically add the `swagger-parser` dependency. You'll need to add this to your project's build file (pom.xml or build.gradle) manually. This gives you more control over the version of the library you use. **How to Use:** 1. **Create a new Java project:** Use your IDE or a build tool (Maven or Gradle) to create a new Java project. 2. **Add Dependencies:** Add the necessary Quarkus CLI dependencies to your project's `pom.xml` (if using Maven) or `build.gradle` (if using Gradle). Also add the `swagger-parser` dependency. Example Maven dependencies: ```xml <dependencies> <dependency> <groupId>io.quarkus.platform</groupId> <artifactId>quarkus-cli</artifactId> <version>${quarkus.version}</version> <!-- Replace with your Quarkus version --> </dependency> <dependency> <groupId>io.swagger.parser.v3</groupId> <artifactId>swagger-parser</artifactId> <version>2.1.19</version> <!-- Use the latest version --> </dependency> <!-- Add other dependencies as needed --> </dependencies> ``` 3. **Copy the Code:** Copy the code above into a Java file (e.g., `CreateMcpserverCommand.java`) in your project. 4. **Implement `generateCodeFromSwagger`:** This is the most important step. Implement the `generateCodeFromSwagger` method to parse the Swagger file and generate the necessary Java code. Use a library like `swagger-parser` or `openapi4j` to parse the Swagger file. 5. **Build the Project:** Build your project using Maven or Gradle. 6. **Run the Command:** Run the command from the command line, passing in the path to your Swagger file and any other options you want to use. For example: ```bash java -jar target/my-project-1.0.0-SNAPSHOT-runner.jar create-mcp-server my-swagger.yaml -o output-dir -n my-server ``` **Implementing `generateCodeFromSwagger` (The Hard Part):** This is the core of the solution and requires significant effort. Here's a breakdown of the steps involved: 1. **Add `swagger-parser` Dependency:** Make sure you've added the `swagger-parser` dependency to your `pom.xml` or `build.gradle` file. 2. **Parse the Swagger File:** Use the `swagger-parser` library to parse the Swagger file into an `OpenAPI` object. ```java import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.OpenAPIV3Parser; OpenAPI openAPI = new OpenAPIV3Parser().read(swaggerFile.toString()); if (openAPI == null) { throw new IllegalArgumentException("Failed to parse Swagger file: " + swaggerFile); } ``` 3. **Iterate Through Paths:** Iterate through the `paths` in the `OpenAPI` object. Each path represents an endpoint in your API. ```java for (Map.Entry<String, PathItem> pathEntry : openAPI.getPaths().entrySet()) { String path = pathEntry.getKey(); PathItem pathItem = pathEntry.getValue(); // Process each operation (GET, POST, PUT, DELETE) for this path if (pathItem.getGet() != null) { processOperation(projectDir, path, "GET", pathItem.getGet()); } if (pathItem.getPost() != null) { processOperation(projectDir, path, "POST", pathItem.getPost()); } // ... handle PUT, DELETE, etc. } ``` 4. **Process Each Operation:** For each operation (GET, POST, etc.), extract the relevant information from the `Operation` object. This includes the request parameters, request body, and response types. ```java private void processOperation(Path projectDir, String path, String method, Operation operation) throws IOException { String operationId = operation.getOperationId(); if (operationId == null || operationId.isEmpty()) { // Generate an operation ID if one is not provided operationId = generateOperationId(path, method); } // Generate the Java code for the resource method String className = capitalize(operationId) + "Resource"; // e.g., GetUserResource String packageName = "org.acme.api"; Path resourceFile = projectDir.resolve("src/main/java/" + packageName.replace('.', '/') + "/" + className + ".java"); java.nio.file.Files.createDirectories(resourceFile.getParent()); String code = generateResourceCode(packageName, className, path, method, operation); java.nio.file.Files.writeString(resourceFile, code); } ``` 5. **Generate Resource Code:** Generate the Java code for the JAX-RS resource method. This will involve creating a Java class with the `@Path` annotation and methods with the `@GET`, `@POST`, etc. annotations. You'll also need to generate the data model classes for the request and response bodies. ```java private String generateResourceCode(String packageName, String className, String path, String method, Operation operation) { StringBuilder sb = new StringBuilder(); sb.append("package ").append(packageName).append(";\n\n"); sb.append("import javax.ws.rs.*;\n"); sb.append("import javax.ws.rs.core.MediaType;\n\n"); sb.append("@Path(\"").append(path).append("\")\n"); sb.append("public class ").append(className).append(" {\n\n"); sb.append(" @").append(method.toUpperCase()).append("\n"); sb.append(" @Produces(MediaType.APPLICATION_JSON)\n"); // Adjust based on your API sb.append(" public String ").append(decapitalize(operation.getOperationId())).append("() {\n"); sb.append(" // Implement your logic here\n"); sb.append(" return \"{}\";\n"); // Placeholder response sb.append(" }\n"); sb.append("}\n"); return sb.toString(); } ``` 6. **Generate Data Models:** Generate Java classes for the request and response bodies. This will involve creating Java classes with fields that correspond to the properties in the Swagger schema. Use libraries like Jackson or Gson to serialize and deserialize the data. 7. **Handle Parameters:** Handle the request parameters (query parameters, path parameters, header parameters). Add `@QueryParam`, `@PathParam`, and `@HeaderParam` annotations to the resource method parameters. 8. **Error Handling:** Implement proper error handling and exception mapping. Create custom exception classes and use `@Provider` annotations to map exceptions to HTTP error codes. 9. **Configuration:** Allow for configuration of the generated code (e.g., base path, package names). Use properties files or environment variables to configure the generated code. **Important Considerations:** * **Code Generation Libraries:** Consider using a code generation library like FreeMarker or Velocity to simplify the code generation process. * **Testing:** Write unit tests to ensure that the generated code is correct. * **Customization:** Allow for customization of the generated code. Provide options to customize the package names, class names, and other aspects of the generated code. * **Complexity:** This is a complex task and requires a good understanding of both Swagger/OpenAPI and Java code generation. Start with a simple example and gradually add more features. This detailed explanation and the improved code provide a solid foundation for building a Quarkus MCP server from an OpenAPI Swagger file. Remember to focus on implementing the `generateCodeFromSwagger` method correctly, as this is the core of the solution. Good luck!
Node MCP Server
A minimal Express-based MCP server that exposes a weather tool through HTTP endpoints, demonstrating how to implement the Model Context Protocol with streamable HTTP transport.
Desk3 MCP Server
Cryptocurrency MCP Server! Free! This powerful tool is designed for blockchain enthusiasts, providing comprehensive, real-time cryptocurrency information at your fingertips. Whether you're an experienced trader or just starting your journey into the crypto world.