Описание
Spring AI MCP Server and Client
README
A demonstration project showcasing the integration of Spring AI's Model Completion Provider (MCP) protocol for building AI-powered applications. This project consists of a server component that provides AI model completion services with function-calling capabilities, and a client component that consumes these services.
Overview
This project demonstrates how to use Spring AI's MCP protocol to create a server that exposes AI model completion services and a client that consumes these services. The server component provides mathematical tools (sum and multiply) that can be called by AI models, while the client component exposes a REST endpoint for users to submit questions.
Features
- MCP Server: Provides AI model completion services with function-calling capabilities
- MCP Client: Consumes AI model completion services from the server
- Tool Integration: Demonstrates how to expose Java methods as callable tools for AI models
- REST API: Exposes a REST endpoint for users to submit questions
- Server-Sent Events (SSE): Uses SSE for communication between server and client
Prerequisites
- Java 17 or higher
- Maven 3.6 or higher
- OpenAI API key (for the client component)
Installation and Setup
Clone the repository:
git clone https://github.com/stylepatrick/spring-ai-mcp-server-client.git cd spring-ai-mcp-server-clientBuild the server component:
cd mcp-server mvn clean installBuild the client component:
cd ../mcp-client mvn clean installUpdate the OpenAI API key in
mcp-client/src/main/resources/application.ymlwith your own API key.
Usage
Start the server component:
cd mcp-server mvn spring-boot:runStart the client component:
cd mcp-client mvn spring-boot:runSend a question to the client component:
curl -X POST "http://localhost:8081/question?question=What%20is%202%20plus%203?"
Configuration
Server Configuration
The server component is configured in mcp-server/src/main/resources/application.yaml:
spring:
application:
name: mcp-server
ai:
mcp:
server:
sse-endpoint: /api/v1/sse
sse-message-endpoint: /api/v1/mcp
type: sync
logging:
level:
io.modelcontextprotocol: TRACE
org.springframework.ai.mcp: TRACE
Client Configuration
The client component is configured in mcp-client/src/main/resources/application.yml:
spring:
application:
name: mcp-client
ai:
openai:
api-key: your-api-key
mcp:
client:
toolcallback:
enabled: true
sse:
connections:
server1:
url: http://localhost:8080
sse-endpoint: /api/v1/sse
server:
port: 8081
Project Structure
mcp-server: Server component that provides AI model completion services
McpServerApplication.java: Main application classtools/MathTools.java: Mathematical tools that can be called by AI modelstools/ToolConfig.java: Configuration for tool callback provider
mcp-client: Client component that consumes AI model completion services
McpClientApplication.java: Main application classresource/MyController.java: REST controller for handling user questionsservice/MyService.java: Service for processing questions using ChatClient
License
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 stylepatrick
Установка Spring Ai Mcp Server Client
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/stylepatrick/spring-ai-mcp-server-clientFAQ
Spring Ai Mcp Server Client MCP бесплатный?
Да, Spring Ai Mcp Server Client MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Spring Ai Mcp Server Client?
Нет, Spring Ai Mcp Server Client работает без API-ключей и переменных окружения.
Spring Ai Mcp Server Client — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Spring Ai Mcp Server Client в Claude Desktop, Claude Code или Cursor?
Открой Spring Ai Mcp Server Client на 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-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
автор: lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Spring Ai Mcp Server Client with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
