Annotation Interface McpEndpoint


@Target(TYPE) @Retention(RUNTIME) @Documented public @interface McpEndpoint
Annotation to mark a class as an MCP (Model Context Protocol) server endpoint.

MCP endpoints expose services to MCP clients such as LLM chat agent desktop applications and agents running on other services. They provide tools, resources, and prompts that AI models can use to extend their capabilities.

Endpoint Capabilities:

  • Tools: Methods annotated with McpTool that clients can call
  • Resources: Methods annotated with McpResource that provide data
  • Prompts: Methods annotated with McpPrompt that generate prompts

Requirements: The annotated class must be public and have a public constructor. It should also be annotated with appropriate Acl annotations to control access.

Constructor Injection: Annotated classes can accept the following types in their constructor:

Request Context Access: If the annotated class extends AbstractMcpEndpoint, the request context is available via requestContext() without constructor injection.

Transport: MCP endpoints use a stateless streamable HTTP transport as defined by the MCP specification. The endpoint is served at the specified path (default: /mcp).

  • Element Details

    • path

      String path
      Returns:
      The path to publish the MCP endpoint at, defaults to "/mcp"
      Default:
      "/mcp"
    • serverName

      String serverName
      Returns:
      A server name to return to clients in the initialization response
    • serverVersion

      String serverVersion
      Returns:
      A server version to return to clients in the initialization response
      Default:
      ""
    • instructions

      String instructions
      Returns:
      Optional instructions to return to the client in the initialization response
      Default:
      ""