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.v20260728;
018
019import org.apache.juneau.rest.server.springboot.*;
020
021/**
022 * Convenience base class exposing a {@code 2026-07-28} 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 2026-07-28} 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()}, and may optionally override {@link McpEndpoint#getMcpOptions()} to customize
038 * capabilities/instructions/cache/mrtr/subscriptions/broker behavior.
039 *
040 * <h5 class='section'>Example:</h5>
041 * <pre>
042 * @Rest(path="/mcp")
043 * public class MyMcpResource extends SpringMcpRestServlet {
044 *    @Override
045 *    public McpServerConfig getMcpConfig() {
046 *       return new McpServerConfig().addTool(new MySpringAwareTool());
047 *    }
048 *    @Override                                        // optional
049 *    public McpOptions getMcpOptions() {
050 *       return new McpOptions().mrtr(m -&gt; m.setTtlMs(600_000));
051 *    }
052 * }
053 * </pre>
054 *
055 * @serial exclude
056 */
057@SuppressWarnings({
058   "java:S110", // Inheritance depth is inherent to the Juneau Spring REST servlet hierarchy.
059   "java:S2176" // Intentional: dated adapter binding classes are de-versioned and differentiated by package.
060})
061public abstract class SpringMcpRestServlet extends BasicSpringRestServlet implements McpEndpoint {
062   private static final long serialVersionUID = 1L;
063}