Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

mcp-server

/mcp-server

Udostępnia możliwości aplikacji Spring Boot 4 przez narzędzia, zasoby i prompty MCP: adnotacje MCP w Spring AI 2.0, wybór transportu, schematy, błędy, bezpieczeństwo i MCP Java SDK 2.x.

Licencja
MIT
Ostatnia zmiana repozytorium
22.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
6
Skrypty
3
Komentarze HTML
3
Adresy URL w SKILL.md
4
Przestarzałość

Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 3 skrypty w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.
  • SKILL.md zawiera komentarze HTML (3). Nie widać ich w podglądzie Markdown, a model je czyta.

Skrypty: examples/OrderMcpTools.java, examples/bad-order-tools.java, examples/good-order-tools.java

Co robi i kiedy

Udostępnia możliwości aplikacji Spring Boot 4 przez narzędzia, zasoby i prompty MCP: adnotacje MCP w Spring AI 2.0, wybór transportu, schematy, błędy, bezpieczeństwo i MCP Java SDK 2.x.

Oryginalny opis (EN)

Use when exposing Spring Boot 4 application capabilities through Model Context Protocol tools, resources, or prompts. Covers Spring AI 2.0 MCP annotations, transport selection, schemas, errors, security, and the standalone MCP Java SDK 2.x.

Jak działa

  1. Dependencies
  2. Native Spring AI MCP tools
  3. Transport configuration
  4. Security and operations
  5. Examples
  6. Official sources
  7. Gotchas
Sekcje z nagłówków SKILL.md, w oryginale · 122 linii, 596 słów
Podgląd SKILL.md
---
name: mcp-server
description: >
  Use when exposing Spring Boot 4 application capabilities through Model Context Protocol tools,
  resources, or prompts. Covers Spring AI 2.0 MCP annotations, transport selection, schemas,
  errors, security, and the standalone MCP Java SDK 2.x.
---

# MCP Server - Spring AI 2.0 and Java SDK 2.x

Prefer Spring AI's MCP server starters and native annotations in Spring Boot applications. Use the
standalone SDK only when Spring integration is intentionally not required.

## Dependencies

Let the Spring AI BOM manage every Spring AI and MCP transitive dependency. Do not override its MCP
SDK version independently.

```xml
<!-- Pick exactly one transport starter. -->
<dependency>
    <groupId>org.springframework.ai</groupId>
    <artifactId>spring-ai-starter-mcp-server</artifactId>
</dependency>
<!-- Remote MVC: spring-ai-starter-mcp-server-webmvc -->
<!-- Remote reactive: spring-ai-starter-mcp-server-webflux -->
```

For an application that uses the raw SDK without Spring AI, use the current 2.x release and follow
its 2.0 migration guide. MCP Java SDK 2.0 tracks the 2025-11-25 protocol and prefers Streamable HTTP;
SSE transports are deprecated.

```xml
<dependency>
    <groupId>io.modelcontextprotocol.sdk</groupId>
    <artifactId>mcp</artifactId>
    <version>2.0.0</version>
</dependency>
```

## Native Spring AI MCP tools

Use `@McpTool` and `@McpToolParam` for server capabilities. `@Tool` is Spring AI's model
tool-calling API; it is not the native MCP server annotation.

```java
@Component
final class OrderMcpTools {
    private final OrderService orderService;

    OrderMcpTools(OrderService orderService) {
        this.orderService = orderService;
    }

    @McpTool(
        name = "get_order",
        description = "Get an order by UUID with line items and status history",
        generateOutputSchema = true,
        annotations = @McpTool.McpAnnotations(
            readOnlyHint = true,
            destructiveHint = false,
            idempotentHint = true))
    OrderResponse getOrder(
            @McpToolParam(description = "Order UUID", required = true) String orderId) {
        return OrderResponse.from(orderService.findById(UUID.fromString(orderId)));
    }
}
```

- Return DTOs or records, not persistence entities.
- Set tool hints accurately; clients must still treat them as untrusted metadata.
- Use stable, specific descriptions because the model uses them to select tools.
- Align return types with server mode: synchronous methods for `SYNC`, reactive types for `ASYNC`.
- For expected failures, return a stable structured result. Do not expose stack traces or secrets.
- Use MCP SDK builders such as `CallToolResult.builder()`; legacy result constructors were removed.

## Transport configuration

```yaml
spring:
  main:
    banner-mode: "off"
  ai:
    mcp:
      server:
        name: order-service-mcp
        version: 1.0.0
        type: SYNC
        stdio: true
        annotation-scanner:
          enabled: true
```

For a remote server, select the MVC or WebFlux starter and set
`spring.ai.mcp.server.protocol=STREAMABLE` or `STATELESS`. Use SSE only for compatibility with an
older client. A stdio server must keep stdout free of banners, logs, and `System.out` output because
stdout carries JSON-RPC frames.

## Security and operations

- Authenticate and authorize remote MCP endpoints like any other privileged application API.
- Validate tool arguments and apply domain authorization inside every capability.
- Keep destructive tools narrow and require explicit business preconditions.
- Bound execution time, result size, pagination, and downstream fan-out.
- Log tool name, outcome, duration, and authenticated actor without recording secrets or full data.
- Test initialization, discovery, invalid arguments, authorization, cancellation, and shutdown with a real MCP client.

## Examples

- See `examples/OrderMcpTools.java`, `examples/good-order-tools.java`, and `examples/bad-order-tools.java`.

## Official sources

- Spring AI MCP overview: https://docs.spring.io/spring-ai/reference/api/mcp/mcp-overview.html
- Spring AI server annotations: https://docs.spring.io/spring-ai/reference/api/mcp/mcp-annotations-server.html
- MCP Java SDK releases: https://github.com/modelcontextprotocol/java-sdk/releases
- MCP Java SDK 2.0 migration: https://github.com/modelcontextprotocol/java-sdk/blob/main/MIGRATION-2.0.md

## Gotchas

- Agent uses `@Tool` for native server registration - use `@McpTool` and `@McpToolParam`.
- Agent overrides the MCP SDK under a Spring AI starter - let the Spring AI BOM manage it.
- Agent uses removed `new CallToolResult(...)` constructors - use `CallToolResult.builder()`.
- Agent configures SSE for a new remote server - prefer Streamable HTTP.
- Agent logs to stdout in stdio mode - route logs to stderr or a file and disable the banner.
- Agent mixes synchronous methods with an asynchronous server - the annotation scanner filters mismatched methods.
- Agent exposes entities or unbounded collections - return bounded DTO contracts.
- Agent trusts tool hints as authorization - enforce authorization in application code.
Pliki w paczce (6)
  • SKILL.md 5 KB
  • agents/openai.yaml 1 KB
  • examples/OrderMcpTools.java 1 KB
  • examples/bad-order-tools.java 1 KB
  • examples/good-order-tools.java 1 KB
  • templates/mcp.json 1 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · rrezartprebreza/spring-boot-skills100MIT
nimadorostkar/Claude-Skills-collection100MIT
rrezartprebreza/spring-boot-skills100MIT
lynricsy/hyperskills100MIT
saschb2b/skills100MIT
market0v0/shipkit100MIT
hoblin/claude-ruby-marketplace100MIT
Amey-Thakur/AI-SKILLS90MIT

Migawka bazy z 13.11.2026 · wersja paczki 18e69be215c4 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90spring-boot
    Pomaga zmieniać aplikacje Java oparte na Spring Boot: MVC, Spring Security, Spring Data i konfigurację zarządzaną przez Spring.
  • 100java-spring-patterns
    Pomaga projektować i przeglądać usługi Java 17+ i Spring Boot 3 oraz 4, z transakcjami, idiomami i testami.
  • 100spring-boot-java
    Pilnuje zasad i dobrych praktyk w projektach Spring Boot w Javie, od JPA po WebFlux i bezpieczeństwo.
  • 90java-spring-boot-expert
    Pomaga budować aplikacje Spring Boot 3.x, mikroserwisy i reaktywne aplikacje Java, z Spring Data JPA i Spring Security 6.
  • 100spring-ai-mcp-server-patterns
    Wspiera budowę serwerów MCP w Spring Boot ze Spring AI: handlery narzędzi, zasoby, szablony promptów i transporty dla wywoływania funkcji i narzędzi przez AI.
  • 100mcp-server-patterns
    Pomaga budować serwery MCP w SDK Node/TypeScript: narzędzia, zasoby, prompty, walidację Zod oraz wybór transportu stdio lub HTTP.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.