Skip to content

Example server doesn't load annotated prompts #46

@ben-gineer

Description

@ben-gineer

I have an MCP server using spring-ai (great work). It's exposing tools correctly. However, I cannot get it to expose Prompts correctly.

I'm using examples from https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/mcp-annotations-server

Am I correct in thinking that this doesn't currently support Webflux transport?

I have this example prompt:

@Service
public class PromptProvider {

    /**
     * A simple greeting prompt that takes a name parameter.
     *
     * @param name The name to greet
     * @return A greeting message
     */
    @McpPrompt(name = "greeting", description = "A simple greeting prompt")
    public GetPromptResult greetingPrompt(
            @McpArg(name = "name", description = "The name to greet", required = true) String name) {
        return new GetPromptResult("Greeting", List.of(new PromptMessage(Role.ASSISTANT,
                new TextContent("Hello, " + name + "! Welcome to the MCP system."))));
    }
}

And this example configuration::

@Configuration
public class McpConfig {

    @Bean
    public List<McpServerFeatures.SyncPromptSpecification> promptSpecs(PromptProvider promptProvider) {
        return SpringAiMcpAnnotationProvider.createSyncPromptSpecifications(List.of(promptProvider));
    }
}

My server is configured to use prompts:

2025-05-27T23:10:49.731+01:00  INFO 46202 --- [           main] o.s.a.m.s.a.McpServerAutoConfiguration   : Enable tools capabilities, notification: true
2025-05-27T23:10:49.731+01:00  INFO 46202 --- [           main] o.s.a.m.s.a.McpServerAutoConfiguration   : Registered tools: 4
2025-05-27T23:10:49.731+01:00  INFO 46202 --- [           main] o.s.a.m.s.a.McpServerAutoConfiguration   : Enable resources capabilities, notification: true
2025-05-27T23:10:49.731+01:00  INFO 46202 --- [           main] o.s.a.m.s.a.McpServerAutoConfiguration   : Enable prompts capabilities, notification: true

I'm on:

  • spring-ai-starter-mcp-server-webflux: 1.0.0
  • spring-ai-mcp-annotations: 0.1.0
  • spring-boot: 3.5.0
  • Java 21

Thanks,

Ben

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions