001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.rest.server.mcp.v20250618;
018
019import org.apache.juneau.rest.server.springboot.*;
020
021/**
022 * Convenience base class exposing a {@code 2025-06-18} MCP endpoint on a Spring Boot resource with full
023 * Spring dependency-injection support.
024 *
025 * <p>
026 * Combines {@link BasicSpringRestServlet} (Spring Boot bean-store integration via
027 * {@link SpringBeanStore}) with the {@link McpEndpoint} mixin
028 * (the {@code 2025-06-18} MCP handler). This is the recommended way to expose MCP from a Spring Boot
029 * resource: subclassing {@link McpRestServlet} instead does <b>not</b> work, since
030 * {@link McpRestServlet} and {@link BasicSpringRestServlet} are sibling
031 * {@code RestServlet} subclasses and a class cannot extend both — and even if it could, only the mixin
032 * path preserves the Spring {@code BeanStore} bridge that MCP tool/prompt/resource handlers rely on to
033 * resolve Spring-managed beans (for example via {@code BeanStore.getBean(MyService.class)}).
034 *
035 * <p>
036 * Subclasses supply their {@link org.apache.juneau.rest.server.mcp.McpServerConfig} by implementing
037 * {@link #getMcpConfig()}.
038 *
039 * <h5 class='section'>Example:</h5>
040 * <pre>
041 * @Rest(path="/mcp")
042 * public class MyMcpResource extends SpringMcpRestServlet {
043 *    @Override
044 *    public McpServerConfig getMcpConfig() {
045 *       return new McpServerConfig().addTool(new MySpringAwareTool());
046 *    }
047 * }
048 * </pre>
049 *
050 * @serial exclude
051 */
052@SuppressWarnings({
053   "java:S110", // Inheritance depth is inherent to the Juneau Spring REST servlet hierarchy.
054   "java:S2176" // Intentional: dated adapter binding classes are de-versioned and differentiated by package.
055})
056public abstract class SpringMcpRestServlet extends BasicSpringRestServlet implements McpEndpoint {
057   private static final long serialVersionUID = 1L;
058}