Fluent builder for registering a Model Context Protocol server contributed by an app, reached from controllerMappings.websiteMcpController for a server exposed to AI clients on public websites, or controllerMappings.adminMcpController for one exposed in the admin console. Set the server type, name, version and instructions, register one or more tools with tool, then call build to create the mapping and, unless the app engine has already finished initialising, register it for routing.

Group: Builders


Methods

type(String type) · serverName(String serverName) · serverVersion(String serverVersion) · instructions(String instructions) · tool(Map<String,Object> spec) · toolFunction(String toolFunction) · isPublic(boolean isPublic) · addRole(String roleNames) · build()

type(String type)

Returns: McpMappingBuilder

Sets the mapping's type, which is used as the URL segment and lookup key for this MCP server.

ParameterDescription
typethe server type

serverName(String serverName)

Returns: McpMappingBuilder

Sets the server name reported to MCP clients.

ParameterDescription
serverNamethe server name

serverVersion(String serverVersion)

Returns: McpMappingBuilder

Sets the server version reported to MCP clients.

ParameterDescription
serverVersionthe server version

instructions(String instructions)

Returns: McpMappingBuilder

Sets the usage instructions reported to MCP clients, describing how to use this server's tools.

ParameterDescription
instructionsthe instructions text

tool(Map<String,Object> spec)

Returns: McpMappingBuilder

Registers a tool from a spec object mirroring the MCP Tool wire format (name, description, inputSchema, outputSchema, title, annotations, icons, _meta, and so on) plus functionName, the global JS function to invoke for calls. The spec is serialised to JSON immediately, while the JS context is still executing, so it remains readable afterwards.

ParameterDescription
specthe tool spec; functionName and name are required

toolFunction(String toolFunction)

Returns: McpMappingBuilder

Sets the name of a JS function invoked, before an individual tool's own function, whenever any tool on this server is called.

ParameterDescription
toolFunctionthe JS function name

isPublic(boolean isPublic)

Returns: McpMappingBuilder

Sets whether this MCP server can be called without authentication.

ParameterDescription
isPublictrue to allow anonymous access, false to require authentication

addRole(String roleNames)

Returns: McpMappingBuilder

Restricts access to this MCP server to callers holding at least one of the given role names.

ParameterDescription
roleNamesthe role names to grant access, ignored if null or empty

build()

Returns: RepoAppMcpMapping

Builds the MCP mapping from the values set on this builder and, unless the app engine has already finished initialising, registers it for routing.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.