Get the FREE Ultimate OpenClaw Setup Guide →

spring-ai

Java SDK for the Model Context Protocol (MCP), providing seamless integration between Java and Spring applications and MCP-compliant AI models and tools.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio spring-attic-spring-ai-mcp mvn clean install -DskipTests \
  --env JAVA_HOME="path/to/java/home" \
  --env MAVEN_OPTS="-Xmx2g"

How to use

This MCP server repository historically provided Java and Spring integrations for the Model Context Protocol (MCP). It originated as a set of Java SDKs and Spring-based components that enable Java applications to act as MCP clients or servers, handling tool discovery, resource management, prompt processing, and logging with both synchronous and asynchronous communication patterns. Although this repository has graduated and moved to the MCP Java SDK and Spring AI MCP, you can still explore the concepts here: the MCP model, how servers expose tools, and how clients interact with those tools through the MCP interfaces. The primary capabilities are realized through the Java SDKs and Spring integrations that support standard MCP operations, including stubs for Stdio and SSE transports and Spring-specific auto-configuration points. To work with MCP in Java today, refer to the MCP Java SDK and Spring AI MCP documentation linked in the repository notes for current usage patterns, client/server APIs, and transport options.

How to install

Prerequisites:

  • Java Development Kit (JDK 11+ recommended)
  • Maven
  • Optional: Git

Installation steps:

  1. Clone the repository (or navigate to the MCP Java SDK repo if you’re migrating): git clone https://github.com/spring-projects-experimental/spring-ai-mcp cd spring-ai-mcp

  2. Build the project using Maven: mvn clean install -DskipTests

  3. If you’re migrating to the MCP Java SDK, follow the current MCP Java SDK installation and usage guidance from the MCP Java SDK documentation and the Spring AI MCP reference pages referenced in the repo's notes.

  4. Integrate into your project by adding the appropriate Maven dependencies (as guided by the current MCP Java SDK/Spring AI MCP documentation) and configure transports (Stdio, SSE, WebFlux/WebMVC as needed).

  5. Run your application with the standard Java execution flow, ensuring any required environment variables (e.g., JAVA_HOME) are set.

Additional notes

Notes:

  • This repository has graduated and is archived. The active work and ongoing support live in the MCP Java SDK and Spring AI MCP projects. Use the links in the repository notes to transition to the current destinations for documentation and examples.
  • If you encounter transport-related issues, review the available transports (Stdio, SSE) and the optional WebFlux/WebMVC SSE transports described in the active MCP projects.
  • Ensure you align your Maven dependencies with the recommended versions from the current MCP Java SDK and Spring AI MCP documentation, since this historical repository may reference older configuration conventions.
  • Environment variables such as JAVA_HOME and MAVEN_OPTS can impact build and runtime behavior; adjust them according to your development environment.
  • When migrating, prefer the official MCP Java SDK and Spring AI MCP references for up-to-date APIs, transport implementations, and auto-configuration mechanisms.

Related MCP Servers

Sponsor this space

Reach thousands of developers