
tzolov/spring-ai-mcp-blogpost
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
봄 AI MCP Intro 블로그 게시물에 대한 비교 예
개요
이 저장소에는 Spring AI Model Context Protocol (MCP) 블로그 게시물의 예 코드를 포함하고, Spring Boot를 사용하여 MCP Servers 및 Clients를 구축하는 방법을 결정합니다. Model Context Protocol (MCP)는 AI 애플리케이션이 외부 도구와 리소스와 상호 작용하는 방법을 표준화합니다. 이 예제 쇼케이스: - : MCP 도구로 일기 예보 기능을 노출하는 Spring Boot 서버 - : MCP 서버에 연결되는 Spring Boot AI 애플리케이션과 LLM(Anthropic Claude)을 사용합니다. - : 기상 예측 - : 구조 로그 메시지가 클라이언트로 전송 - : 실시간 진행 업데이트 - : 클라이언트의 LLM에서 AI-generated 콘텐츠 요청 - : 동시에 여러 MCP 서버에 연결 - : Streamable-HTTP 및 STDIO 운송 모두 - : Process 서버 알림 및 요청 - : Anthropic Claude와의 원활한 통합 - Java 17 이상 - Maven 3.6 + - Spring AI 1.1.0-SNAPSHOT - 노드.
개요(AI 번역)
이 저장소에는 Spring AI Model Context Protocol (MCP) 블로그 게시물의 예 코드를 포함하고, Spring Boot를 사용하여 MCP Servers 및 Clients를 구축하는 방법을 결정합니다.
개요
Model Context Protocol (MCP)는 AI 애플리케이션이 외부 도구와 리소스와 상호 작용하는 방법을 표준화합니다. 이 예제 쇼케이스:
- MCP Weather Server: MCP 도구로 일기 예보 기능을 노출하는 Spring Boot 서버
- MCP Weather Client: MCP 서버에 연결되는 Spring Boot AI 애플리케이션은 LLM(Anthropic Claude)를 사용합니다.
건축
기능 데모
MCP 서버 특징
- 도구: 기상 예보 좌표로 검색 -Logging: 클라이언트로 보낸 구조 로그 메시지
- Progress Tracking: 실시간 진행 업데이트
- Sampling: 클라이언트의 LLM에서 AI-generated 콘텐츠를 요청
MCP 클라이언트 특징
- Multi-Server 연결: 동시에 여러 MCP 서버에 연결
- **Transport 지원 **: 둘 다 Streamable-HTTP와 STDIO 수송
- 할러 주석: 프로세스 서버 알림 및 요청
- LLM 통합: Anthropic Claude와의 원활한 통합
필수품
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
Spring AI MCP Weather Example
This repository contains the example code for the Spring AI Model Context Protocol (MCP) blog post, demonstrating how to build both MCP Servers and Clients using Spring Boot.
Overview
The Model Context Protocol (MCP) standardizes how AI applications interact with external tools and resources. This example showcases:
- MCP Weather Server: A Spring Boot server that exposes weather forecast capabilities as MCP tools
- MCP Weather Client: A Spring Boot AI application that connects to MCP servers and uses an LLM (Anthropic Claude)
Architecture
┌────────────────────────────────────────────────────────────┐
│ MCP Weather Client │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ ChatClient │──│ MCP Client │──│ Weather Server │ │
│ │ (Claude) │ │ Transport │ │ (Streamable-HTTP)│ │
│ └─────────────┘ └──────────────┘ └──────────────────┘ │
│ │ │
│ ┌──────────────┐ ┌──────────────────┐ │
│ │ MCP Client │──│ Brave Search │ │
│ │ Transport │ │ (STDIO) │ │
│ └──────────────┘ └──────────────────┘ │
└────────────────────────────────────────────────────────────┘
Features Demonstrated
MCP Server Features
- Tools: Weather forecast retrieval by coordinates
- Logging: Structured log messages sent to clients
- Progress Tracking: Real-time progress updates for operations
- Sampling: Request AI-generated content from the client’s LLM
MCP Client Features
- Multi-Server Connection: Connect to multiple MCP servers simultaneously
- Transport Support: Both Streamable-HTTP and STDIO transports
- Handler Annotations: Process server notifications and requests
- LLM Integration: Seamless integration with Anthropic Claude
Prerequisites
- Java 17 or higher
- Maven 3.6+
- Spring AI 1.1.0-SNAPSHOT
- Node.js and NPM (for optional Brave Search integration)
- Anthropic API key (for the client)
- Brave Search API key (optional, for web search)
Project Structure
spring-ai-mcp-blogpost/
├── mcp-weather-server/ # MCP Server implementation
│ ├── src/main/java/
│ │ └── .../server/
│ │ ├── McpServerApplication.java
│ │ └── WeatherService.java
│ └── pom.xml
├── mcp-weather-client/ # MCP Client implementation
│ ├── src/main/java/
│ │ └── .../client/
│ │ ├── McpClientApplication.java
│ │ └── McpClientHandlers.java
│ └── pom.xml
└── pom.xml # Parent POM
Quick Start
1. Configure Maven Repository
Both projects use Spring AI snapshots. The required repository is already configured in the pom.xml files:
central-portal-snapshots
Central Portal Snapshots
설치
npx @modelcontextprotocol/inspector설정
{
"mcpServers": {
"spring-ai-mcp-weather": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"/path/to/mcp-weather-server.jar"
]
}
}
}