Annotation Type EnableMcpServer


@Retention(CLASS) @Target(TYPE) public @interface EnableMcpServer

Builds the MCP endpoint into the server, serving the application's McpTool methods over Streamable HTTP at /mcp.

A class with an McpTool method already does this, so the annotation is needed only to move the endpoint or to name the origins it accepts. Without either -- and without cn1.mcp.enabled=true in a properties file -- the entry point of a packaged server never names the endpoint and the translator leaves its code out of the binary. The endpoint serves only when it has a tool, and cn1.mcp.enabled=false turns it off at start-up.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The browser origins allowed to call it; cn1.mcp.allowedOrigins.
    Where the endpoint is served; cn1.mcp.path.
  • Element Details

    • path

      String path
      Where the endpoint is served; cn1.mcp.path. Empty means /mcp.
      Default:
      ""
    • allowedOrigins

      String[] allowedOrigins
      The browser origins allowed to call it; cn1.mcp.allowedOrigins.
      Default:
      {}