JZ

james-zou/mcp-springboot-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

10 stars 7 forks 품질 44 트렌드 8Apache-2.0

这是一个使用 Spring Boot 和 Spring AI MCP 的示例项目,展示了如何集成和使用 MCP 功能。A Spring Boot server implementation for Model Context Protocol (MCP), providing weather information services through MCP interfaces.

개요

A Spring Boot server implementation for Model Context Protocol (MCP), providing weather information services through MCP interfaces. - Weather information service via MCP - RESTful API endpoints - Server-Sent Events (SSE) support - Automatic tool registration - Spring Boot 3.x integration - JDK 17 or later - Maven 3.6.x or later - Spring Boot 3.2.0 or later The server will start on port 8080 by default. The main configuration properties are located in application.properties: For more configuration options, please check the application.properties file. The Weather Service provides the following MCP methods: - getWeather(String cityName): Get weather information for a specific city - getWeather1(String cityName): Alternative method to get weather information

README

원문 README의 일부입니다. 원문 보기.

MCP Spring Boot Server

A Spring Boot server implementation for Model Context Protocol (MCP), providing weather information services through MCP interfaces.

Features

  • Weather information service via MCP
  • RESTful API endpoints
  • Server-Sent Events (SSE) support
  • Automatic tool registration
  • Spring Boot 3.x integration

Requirements

  • JDK 17 or later
  • Maven 3.6.x or later
  • Spring Boot 3.2.0 or later

Getting Started

Clone the Repository

git clone https://github.com/yourusername/mcp-springboot-server.git
cd mcp-springboot-server

Build the Project

mvn clean install

Run the Application

mvn spring-boot:run

The server will start on port 8080 by default.

Configuration

The main configuration properties are located in application.properties:

server.port=8080
spring.application.name=mcp-demo
spring.ai.mcp.server.enabled=true

For more configuration options, please check the application.properties file.

API Documentation

Weather Service

The Weather Service provides the following MCP methods:

  • getWeather(String cityName): Get weather information for a specific city
  • getWeather1(String cityName): Alternative method to get weather information

Example usage in the test client:

var transport = new HttpClientSseClientTransport("http://localhost:8080");
var client = McpClient.sync(transport).build();

Project Structure

src/
├── main/
│   ├── java/
│   │   └── com/unionhole/mcpserver/
│   │       ├── config/
│   │       ├── service/
│   │       └── McpDemoApplication.java
│   └── resources/
│       └── application.properties
└── test/
    └── java/
        └── com/unionhole/mcpserver/
            └── ClientSseTest.java

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Author

James Zou

Acknowledgments

  • Spring Boot Team
  • Model Context Protocol Team
  • All contributors to this project

框架说明

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →