|
| 1 | += Java & Spring MCP |
| 2 | + |
| 3 | +Java SDK for the Model Context Protocol (MCP), providing seamless integration between Java and Spring applications and MCP-compliant AI resources and tools. |
| 4 | + |
| 5 | +== Overview |
| 6 | + |
| 7 | +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. |
| 8 | + |
| 9 | +image::spring-ai-mcp-architecture.jpg[Spring AI MCP Architecture,600] |
| 10 | + |
| 11 | +== Modules |
| 12 | + |
| 13 | +The project consists of two main modules: |
| 14 | + |
| 15 | +=== mcp |
| 16 | + |
| 17 | +Java implementation of the Model Context Protocol specification. It includes: |
| 18 | + |
| 19 | +* 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 |
| 20 | +* Standard MCP operations support (tool discovery, resource management, prompt handling, structured logging). Support for request and notification handling. |
| 21 | +* 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. |
| 22 | +* link:./mcp/README.md[Find more]. |
| 23 | + |
| 24 | +=== spring-ai-mcp |
| 25 | + |
| 26 | +The Spring integration module provides Spring-specific functionality: |
| 27 | + |
| 28 | +* Integration with Spring AI's function calling system |
| 29 | +* Spring-friendly abstractions for MCP clients |
| 30 | +* Auto-configurations (WIP) |
| 31 | + |
| 32 | +== Requirements |
| 33 | + |
| 34 | +* Java 17 or later |
| 35 | +* Maven 3.6 or later |
| 36 | +* Spring AI 1.0.0-M4 or later |
| 37 | + |
| 38 | +== Installation |
| 39 | + |
| 40 | +Add the following dependencies to your Maven project: |
| 41 | + |
| 42 | +[source,xml] |
| 43 | +---- |
| 44 | +<!-- For core MCP functionality --> |
| 45 | +<dependency> |
| 46 | + <groupId>org.springframework.experimental</groupId> |
| 47 | + <artifactId>mcp</artifactId> |
| 48 | + <version>0.4.0-SNAPSHOT</version> |
| 49 | +</dependency> |
| 50 | +
|
| 51 | +<!-- For Spring AI integration --> |
| 52 | +<dependency> |
| 53 | + <groupId>org.springframework.experimental</groupId> |
| 54 | + <artifactId>spring-ai-mcp</artifactId> |
| 55 | + <version>0.4.0-SNAPSHOT</version> |
| 56 | +</dependency> |
| 57 | +---- |
| 58 | + |
| 59 | +== Example Demos |
| 60 | + |
| 61 | +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: |
| 62 | + |
| 63 | +* link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/sqlite/simple[SQLite Simple] - Demonstrates LLM integration with a database |
| 64 | +* link:https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/sqlite/chatbot[SQLite Chatbot] - Interactive chatbot with SQLite database interaction |
| 65 | +* 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 |
| 66 | +* 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. |
| 67 | +* 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. |
| 68 | + |
| 69 | +== Documentation |
| 70 | + |
| 71 | +* link:mcp/README.md[Java MCP SDK documentation] |
| 72 | +** link:docs/ref-index.md[Reference documentation] |
| 73 | +* link:spring-ai-mcp/README.md[Spring Integration documentation] |
| 74 | + |
| 75 | +== Development |
| 76 | + |
| 77 | +=== Building from Source |
| 78 | + |
| 79 | +[source,bash] |
| 80 | +---- |
| 81 | +mvn clean install |
| 82 | +---- |
| 83 | + |
| 84 | +=== Running Tests |
| 85 | + |
| 86 | +[source,bash] |
| 87 | +---- |
| 88 | +mvn test |
| 89 | +---- |
| 90 | + |
| 91 | +== Project Information |
| 92 | + |
| 93 | +* *Group ID*: org.springframework.experimental |
| 94 | +* *Version*: 0.4.0-SNAPSHOT |
| 95 | +* *Java Version*: 17 |
| 96 | +* *Spring AI Version*: 1.0.0-M4 |
| 97 | + |
| 98 | +== Contributing |
| 99 | + |
| 100 | +This is an experimental Spring project. Contributions are welcome! Please: |
| 101 | + |
| 102 | +1. Fork the repository |
| 103 | +2. Create a feature branch |
| 104 | +3. Submit a Pull Request |
| 105 | + |
| 106 | +== Team |
| 107 | + |
| 108 | +* Christian Tzolov |
| 109 | +* Dariusz Jędrzejczyk |
| 110 | + |
| 111 | +== Links |
| 112 | + |
| 113 | +* link:https://github.com/spring-projects-experimental/spring-ai-mcp[GitHub Repository] |
| 114 | +* link:https://github.com/spring-projects-experimental/spring-ai-mcp/issues[Issue Tracker] |
| 115 | +* link:https://github.com/spring-projects-experimental/spring-ai-mcp/actions[CI/CD] |
| 116 | + |
| 117 | +== License |
| 118 | + |
| 119 | +This project is licensed under the link:LICENSE[Apache License 2.0]. |
0 commit comments