Описание
spring ai example. mcp server, agentic ai.
README
Project Overview
This project demonstrates various implementation patterns and best practices for using Spring AI tools. It consists of two main modules:
- mcp-server: Implements the Model Context Protocol (MCP) server with both WebFlux and WebMvc SSE support
- proposal-agent: Implements the MCP client for making AI-powered proposals
Project Structure
.
├── mcp-server/ # MCP Server implementation
│ ├── src/ # Server source code
│ └── README.md # Server documentation
├── proposal-agent/ # MCP Client implementation
│ ├── src/ # Client source code
│ └── README.md # Client documentation
└── src/ # Common source code
Tools Implementation Patterns
Methods as Tools
Spring AI supports using methods as tools by annotating them with @Tool. Example from DateTimeTools:
@Tool(name = "getCurrentDateTime", description = "Get the current date and time")
public String getCurrentDateTime() {
return LocalDateTime.now().atZone(LocaleContextHolder.getTimeZone().toZoneId()).toString();
}
Tool Result Converter
Custom result converters can be implemented to control how tool results are formatted. Example from CustomToolCallResultConverter:
@Tool(name = "getCustomer",
description = "Retrieve customer information",
resultConverter = CustomToolCallResultConverter.class)
public Customer getCustomer(String name, ToolContext context) {
return new Customer(name, "[email protected]");
}
Tool Context
Spring AI provides a ToolContext parameter that can be injected into tool methods to access contextual information:
public Customer getCustomerByEmail(String email, ToolContext context) {
log.info("Context: {}", context);
return new Customer("Demo", email);
}
Tool Parameters
Tool parameters can be annotated with @ToolParam to provide descriptions:
@Tool(name = "setAlarm")
public void setAlarm(@ToolParam(description = "Time in ISO-8601 format") String time) {
// Implementation
}
Configuration
The project uses Spring Boot with the following key configurations:
- Ollama AI model integration
- Vector store with PGVector
- H2 database for development
- CORS configuration for web access
- MCP Server implementation
- MCP Client implementation
- SSE implementation
SSE implementation
an implementation of SSE (Server-Sent Events) for real-time updates. This is achieved by using the SseEmitter class.
Technology Stack
- Spring Boot
- Spring AI
- Ollama AI Model
- PGVector Vector Store
- H2 Database
- CORS Configuration
- SSE (Server-Sent Events) for real-time updates
Установка Spring Ai Example
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/lucasdengcn/spring-ai-exampleFAQ
Spring Ai Example MCP бесплатный?
Да, Spring Ai Example MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Spring Ai Example?
Нет, Spring Ai Example работает без API-ключей и переменных окружения.
Spring Ai Example — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Spring Ai Example в Claude Desktop, Claude Code или Cursor?
Открой Spring Ai Example на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Spring Ai Example with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
