This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
commit 70f5392ece3e5e2ab77aa735ca38b06f70c7054b Author: Robert Munteanu <[email protected]> AuthorDate: Tue Jan 13 15:08:06 2026 +0100 chore(mcp-server): move contributions to a separate bundle --- mcp-server-contributions/README.md | 3 + mcp-server-contributions/pom.xml | 137 +++++++++++++++++++++ .../impl/contribs/BundleResourceContribution.java | 0 .../mcp/server/impl/contribs/BundleState.java | 0 .../contribs/ComponentResourceContribution.java | 0 .../server/impl/contribs/LogToolContribution.java | 0 .../contribs/OsgiBundleDiagnosticContribution.java | 0 .../contribs/OsgiDiagnosticPromptContribution.java | 0 .../impl/contribs/RecentRequestsContribution.java | 0 .../impl/contribs/RefreshPackagesContribution.java | 0 .../impl/contribs/ServletPromptContribution.java | 0 .../libs/sling/mcp/prompts/new-sling-servlet.md | 17 +++ .../libs/sling/mcp/prompts/troubleshoot.md | 45 +++++++ mcp-server/README.md | 10 +- .../apache/sling/mcp/server/spi/package-info.java | 18 +++ 15 files changed, 228 insertions(+), 2 deletions(-) diff --git a/mcp-server-contributions/README.md b/mcp-server-contributions/README.md new file mode 100644 index 00000000..24a29502 --- /dev/null +++ b/mcp-server-contributions/README.md @@ -0,0 +1,3 @@ +# Apache Sling MCP Server contributions + +This project contains contributions ( tools, resources, prompts) for the Apache Sling MCP Server. See [../mcp-server/README.md](../mcp-server/README.md) for details on how to set up and run the MCP Server itself. \ No newline at end of file diff --git a/mcp-server-contributions/pom.xml b/mcp-server-contributions/pom.xml new file mode 100644 index 00000000..3f10631a --- /dev/null +++ b/mcp-server-contributions/pom.xml @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.sling</groupId> + <artifactId>sling-bundle-parent</artifactId> + <version>65</version> + <relativePath /> + </parent> + + <artifactId>org.apache.sling.mcp-server-contributions</artifactId> + <version>0.1.0-SNAPSHOT</version> + + <name>Apache Sling MCP Server Contributions</name> + + <properties> + <sling.java.version>17</sling.java.version> + <!-- Run with -Dslingfeature.app.vmOption=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=30303 for debug mode--> + <slingfeature.app.vmOption /> + </properties> + + <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.framework</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.resource</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.bundle</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation.versioning</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.metatype.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.servlets.annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.jetbrains</groupId> + <artifactId>annotations</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.api</artifactId> + <version>3.0.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.engine</artifactId> + <version>2.10.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>io.modelcontextprotocol.sdk</groupId> + <artifactId>mcp</artifactId> + <version>0.17.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.log</artifactId> + <version>1.3.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.mcp-server</artifactId> + <version>0.1.0-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Configure bnd-baseline to skip when no previous version exists. Remove after first release --> + <plugin> + <groupId>biz.aQute.bnd</groupId> + <artifactId>bnd-baseline-maven-plugin</artifactId> + <configuration> + <failOnMissing>false</failOnMissing> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleResourceContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleResourceContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleResourceContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleResourceContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleState.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleState.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleState.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/BundleState.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/ComponentResourceContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/ComponentResourceContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/ComponentResourceContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/ComponentResourceContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/LogToolContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiBundleDiagnosticContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiBundleDiagnosticContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiBundleDiagnosticContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiBundleDiagnosticContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiDiagnosticPromptContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiDiagnosticPromptContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiDiagnosticPromptContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/OsgiDiagnosticPromptContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/RecentRequestsContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/RecentRequestsContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/RecentRequestsContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/RecentRequestsContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/RefreshPackagesContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/RefreshPackagesContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/RefreshPackagesContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/RefreshPackagesContribution.java diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/ServletPromptContribution.java b/mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/ServletPromptContribution.java similarity index 100% rename from mcp-server/src/main/java/org/apache/sling/mcp/server/impl/contribs/ServletPromptContribution.java rename to mcp-server-contributions/src/main/java/org/apache/sling/mcp/server/impl/contribs/ServletPromptContribution.java diff --git a/mcp-server-contributions/src/main/resources/SLING-INF/libs/sling/mcp/prompts/new-sling-servlet.md b/mcp-server-contributions/src/main/resources/SLING-INF/libs/sling/mcp/prompts/new-sling-servlet.md new file mode 100644 index 00000000..c92cb837 --- /dev/null +++ b/mcp-server-contributions/src/main/resources/SLING-INF/libs/sling/mcp/prompts/new-sling-servlet.md @@ -0,0 +1,17 @@ +--- +title: "Create new Sling Servlet" +description: "Creates a new Sling Servlet in the current project using annotations" +argument.resource-type: + - title: Resource Type + - required: true + - description: The Sling resource type to bind this servlet to +--- + +# Create a new Sling Servlet + + Create a new Sling Servlet for resource type: `{resource-type}` + + Use the Sling-specific OSGi declarative services annotations - `@SlingServletResourceTypes` and `@Component` . + Configure by default with the GET method and the json extension. + Provide a basic implementation of the doGet method that returns a JSON response with a message 'Hello from Sling Servlet at resource type {resource-type}'. + \ No newline at end of file diff --git a/mcp-server-contributions/src/main/resources/SLING-INF/libs/sling/mcp/prompts/troubleshoot.md b/mcp-server-contributions/src/main/resources/SLING-INF/libs/sling/mcp/prompts/troubleshoot.md new file mode 100644 index 00000000..d5e95874 --- /dev/null +++ b/mcp-server-contributions/src/main/resources/SLING-INF/libs/sling/mcp/prompts/troubleshoot.md @@ -0,0 +1,45 @@ +--- +title: "Troubleshooting guide" +description: "Guide to troubleshoot common issues with Apache Sling applications" +--- +# Troubleshooting Guide + +## Overview +This guide helps you diagnose and resolve common issues with Apache Sling MCP Server. + +## Common Issues + +### MCP Server Not Responding +- Verify the MCP servlet is registered and active +- Check OSGi component status +- Review log files for errors + +### Bundle Issues +- Check bundle state (ACTIVE, RESOLVED, INSTALLED) +- Verify all dependencies are satisfied +- Use the OSGi diagnostic tools + +### Performance Problems +- Review recent requests and response times +- Check system resources +- Analyze thread dumps if available + +### Component Registration Issues +- Verify component configurations +- Check service dependencies +- Review component lifecycle logs + +## Diagnostic Tools +The MCP Server provides several diagnostic tools: +- Bundle state inspection +- Component resource analysis +- Recent request tracking +- Log file access +- OSGi diagnostic reports + +## Getting Help +If you continue to experience issues: +1. Gather diagnostic information using the MCP tools +2. Review the Apache Sling documentation +3. Check the Apache Sling mailing lists +4. File an issue in the Apache Sling JIRA diff --git a/mcp-server/README.md b/mcp-server/README.md index 599c6a0d..d2988d45 100644 --- a/mcp-server/README.md +++ b/mcp-server/README.md @@ -4,10 +4,16 @@ Experimental MCP Server implementation for Apache Sling. ## Usage -Start up the MCP server, based on the Apache Sling Starter +Build the project with Maven and start up the MCP server, based on the Apache Sling Starter: ``` -$ mvn package feature-launcher:start feature-launcher:stop -Dfeature-launcher.waitForInput +$ mvn install feature-launcher:start feature-launcher:stop -Dfeature-launcher.waitForInput +``` + +Then build and deploy the sibling contributions package: + +``` +$ mvn -f ../mcp-server-contributions/ install sling:install ``` Then open up your coding assistant tool and add an remote MCP server with location http://localhost:8080/mcp . diff --git a/mcp-server/src/main/java/org/apache/sling/mcp/server/spi/package-info.java b/mcp-server/src/main/java/org/apache/sling/mcp/server/spi/package-info.java index 13b75258..aec19a47 100644 --- a/mcp-server/src/main/java/org/apache/sling/mcp/server/spi/package-info.java +++ b/mcp-server/src/main/java/org/apache/sling/mcp/server/spi/package-info.java @@ -1,2 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ @org.osgi.annotation.versioning.Version("1.0.0") package org.apache.sling.mcp.server.spi;
