Add mcp-docs with initial Antora support

This commit is contained in:
Christian Tzolov 2025-01-02 19:27:59 +01:00
commit 724a12b697
11 changed files with 395 additions and 0 deletions

89
mcp-docs/pom.xml Normal file
View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2023-2024 the original author or authors.
~
~ Licensed 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
~
~ https://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.springframework.experimental</groupId>
<artifactId>mcp-parent</artifactId>
<version>0.4.0-SNAPSHOT</version>
</parent>
<artifactId>mcp-docs</artifactId>
<name>Spring AI MCP Docs</name>
<description>Spring AI MCP documentation</description>
<build>
<plugins>
<plugin>
<groupId>org.antora</groupId>
<artifactId>antora-maven-plugin</artifactId>
<version>${org.maven.antora-version}</version>
<extensions>true</extensions>
<configuration>
<options>
<option>--to-dir=target/antora/site</option>
<option>--stacktrace</option>
<option>--fetch</option>
</options>
<playbook>src/main/antora/antora-playbook.yml</playbook>
<packages>
<package>@antora/cli@3.2.0-alpha.6</package>
<package>@antora/atlas-extension@1.0.0-alpha.2</package>
<package>@antora/collector-extension@1.0.0-beta.1</package>
<package>@asciidoctor/tabs@1.0.0-beta.6</package>
<package>@springio/antora-extensions@1.14.2</package>
<package>@springio/asciidoctor-extensions@1.0.0-alpha.12</package>
<package>@djencks/asciidoctor-mathjax@0.0.9</package>
</packages>
</configuration>
</plugin>
<plugin>
<groupId>io.spring.maven.antora</groupId>
<artifactId>antora-component-version-maven-plugin</artifactId>
<version>${io.spring.maven.antora-version}</version>
<executions>
<execution>
<goals>
<goal>antora-component-version</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptors>
<descriptor>src/assembly/javadocs.xml</descriptor>
</descriptors>
<finalName>spring-ai-mcp-${project.version}</finalName>
<appendAssemblyId>true</appendAssemblyId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,31 @@
<!--
~ Copyright 2023-2024 the original author or authors.
~
~ Licensed 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
~
~ https://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.
-->
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.1.0.xsd">
<id>docs</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>../target/site/apidocs</directory>
<outputDirectory>api</outputDirectory>
</fileSet>
</fileSets>
</assembly>

View file

@ -0,0 +1,48 @@
# PACKAGES antora@3.2.0-alpha.6 @antora/atlas-extension:1.0.0-alpha.1 @antora/collector-extension@1.0.0-alpha.3 @springio/antora-extensions@1.1.0-alpha.2 @asciidoctor/tabs@1.0.0-alpha.12 @opendevise/antora-release-line-extension@1.0.0-alpha.2
#
# The purpose of this Antora playbook is to build the docs in the current branch.
antora:
extensions:
- '@antora/collector-extension'
# - require: '@springio/antora-extensions/root-component-extension'
- require: '@springio/antora-extensions'
root_component_name: 'ai'
site:
title: Spring AI Reference
url: https://docs.spring.io/spring-ai-mcp/reference
robots: allow
git:
ensure_git_suffix: false
content:
sources:
- url: ./../../../..
branches: HEAD
start_path: mcp-docs/src/main/antora
worktrees: true
asciidoc:
attributes:
page-related-doc-categories: ai,java,ml,mcp
page-pagination: ''
hide-uri-scheme: '@'
tabs-sync-option: '@'
chomp: 'all'
stem: 'asciimath'
extensions:
- '@asciidoctor/tabs'
- '@springio/asciidoctor-extensions'
- '@springio/asciidoctor-extensions/javadoc-extension'
- '@springio/asciidoctor-extensions/include-code-extension'
- '@djencks/asciidoctor-mathjax'
sourcemap: true
urls:
latest_version_segment_strategy: redirect:to
latest_version_segment: ''
redirect_facility: httpd
runtime:
log:
failure_level: warn
format: pretty
ui:
bundle:
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.17/ui-bundle.zip
snapshot: true

View file

@ -0,0 +1,12 @@
name: ai
version: true
title: Spring AI
nav:
- modules/ROOT/nav.adoc
ext:
collector:
- run:
command: mvnw process-resources
local: true
scan:
dir: mcp-docs/target/classes/antora-resources

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 KiB

View file

@ -0,0 +1,3 @@
* xref:index.adoc[Overview]
// ** xref:concepts.adoc[AI Concepts]
// * xref:getting-started.adoc[Getting Started]

View file

@ -0,0 +1,119 @@
= Java & Spring MCP
Java SDK for the Model Context Protocol (MCP), providing seamless integration between Java and Spring applications and MCP-compliant AI resources and tools.
== Overview
Provides Java and Spring Framework integration for the link:https://modelcontextprotocol.org/docs/concepts/architecture[Model Context Protocol]. It enables Java applications to interact with AI models and tools through a standardized interface, supporting both synchronous and asynchronous communication patterns.
image::spring-ai-mcp-architecture.jpg[Spring AI MCP Architecture,600]
== Modules
The project consists of two main modules:
=== mcp
Java implementation of the Model Context Protocol specification. It includes:
* Synchronous and asynchronous link:https://github.com/spring-projects-experimental/spring-ai-mcp/blob/main/mcp/README.md#client-usage-examples[MCP Client] and link:https://github.com/spring-projects-experimental/spring-ai-mcp/blob/main/mcp/README.md#server-usage-examples[MCP Server] implementations
* Standard MCP operations support (tool discovery, resource management, prompt handling, structured logging). Support for request and notification handling.
* link:https://spec.modelcontextprotocol.io/specification/basic/transports/#stdio[Stdio] and link:https://spec.modelcontextprotocol.io/specification/basic/transports/#http-with-sse[SSE] transport implementations.
* link:./mcp/README.md[Find more].
=== spring-ai-mcp
The Spring integration module provides Spring-specific functionality:
* Integration with Spring AI's function calling system
* Spring-friendly abstractions for MCP clients
* Auto-configurations (WIP)
== Requirements
* Java 17 or later
* Maven 3.6 or later
* Spring AI 1.0.0-M4 or later
== Installation
Add the following dependencies to your Maven project:
[source,xml]
----
<!-- For core MCP functionality -->
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>mcp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
<!-- For Spring AI integration -->
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-ai-mcp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
----
== Example Demos
Explore these MCP examples in the link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol[spring-ai-examples/model-context-protocol] repository:
* link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/sqlite/simple[SQLite Simple] - Demonstrates LLM integration with a database
* link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/sqlite/chatbot[SQLite Chatbot] - Interactive chatbot with SQLite database interaction
* link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/filesystem[Filesystem] - Enables LLM interaction with local filesystem folders and files
* link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/brave[Brave] - Enables natural language interactions with Brave Search, allowing you to perform internet searches.
* link:./spring-ai-mcp-sample/[Spring-ai-mcp-sample] - Showcases how to create and use MCP servers and clients with different transport modes and capabilities.
== Documentation
* link:mcp/README.md[Java MCP SDK documentation]
** link:docs/ref-index.md[Reference documentation]
* link:spring-ai-mcp/README.md[Spring Integration documentation]
== Development
=== Building from Source
[source,bash]
----
mvn clean install
----
=== Running Tests
[source,bash]
----
mvn test
----
== Project Information
* *Group ID*: org.springframework.experimental
* *Version*: 0.4.0-SNAPSHOT
* *Java Version*: 17
* *Spring AI Version*: 1.0.0-M4
== Contributing
This is an experimental Spring project. Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Submit a Pull Request
== Team
* Christian Tzolov
* Dariusz Jędrzejczyk
== Links
* link:https://github.com/spring-projects-experimental/spring-ai-mcp[GitHub Repository]
* link:https://github.com/spring-projects-experimental/spring-ai-mcp/issues[Issue Tracker]
* link:https://github.com/spring-projects-experimental/spring-ai-mcp/actions[CI/CD]
== License
This project is licensed under the link:LICENSE[Apache License 2.0].

View file

@ -0,0 +1,54 @@
= Spring AI MCP Spring
:page-title: Spring AI MCP Spring
:doctype: book
:icons: font
:source-highlighter: highlight.js
:toc: left
Spring Integration module for Model Control Protocol (MCP) that provides Spring-specific functionality for working with MCP clients.
== Overview
The `spring-ai-mcp` module is part of the https://github.com/spring-projects-experimental/spring-ai-mcp[Spring AI MCP] project. It provides Spring Framework integration for the Model Control Protocol (MCP), enabling seamless integration of MCP functionality within Spring applications.
== Features
* Spring integration for MCP clients
* Function callback implementation for tool invocations
* Seamless integration with Spring AI's function calling capabilities
== Main Components
=== McpFunctionCallback
The `McpFunctionCallback` class is the primary component of this module. It implements Spring AI's `FunctionCallback` interface and provides:
* Integration between Spring AI's function calling system and MCP tools
* Automatic conversion between JSON and Java objects for tool arguments
* Synchronous tool execution support
== Usage
To use this module, add the following dependency to your Maven project:
[source,xml]
----
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-ai-mcp</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
----
== License
This project is licensed under the https://www.apache.org/licenses/LICENSE-2.0[Apache License 2.0].
== Links
* https://github.com/spring-projects-experimental/spring-ai-mcp[GitHub Repository]
* https://github.com/spring-projects-experimental/spring-ai-mcp/issues[Issue Tracker]
== Contributing
This is an experimental Spring project. Contributions are welcome! Please refer to the main project's contribution guidelines.

View file

@ -0,0 +1,2 @@
version: ${antora-component.version}
prerelease: ${antora-component.prerelease}

View file

@ -0,0 +1,33 @@
<!--
~ Copyright 2023-2024 the original author or authors.
~
~ Licensed 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
~
~ https://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.
-->
<html>
<body>
<p>
This document is the API specification for <a href="https://docs.spring.io/spring-ai-mcp/reference" target="_top">Spring AI</a>
</p>
<div id="overviewBody">
<p>
For further API reference and developer documentation, see the
<a href="https://docs.spring.io/spring-ai-mcp/reference/" target="_top">
Spring AI MCP reference documentation</a>.
That documentation contains more detailed, developer-targeted
descriptions, with conceptual overviews, definitions of terms,
and working code examples.
</p>
</div>
</body>
</html>

View file

@ -93,12 +93,16 @@
<maven-project-info-reports-plugin.version>3.4.5</maven-project-info-reports-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
<org.maven.antora-version>1.0.0-alpha.4</org.maven.antora-version>
<io.spring.maven.antora-version>0.0.4</io.spring.maven.antora-version>
<asciidoctorj-pdf.version>1.6.2</asciidoctorj-pdf.version>
</properties>
<modules>
<module>mcp</module>
<module>spring-ai-mcp</module>
<module>spring-ai-mcp-sample</module>
<module>mcp-docs</module>
</modules>
<build>