Standalone Primitives
Fluent method signatures, handler contracts, options, and normalized results.
The plugin augments an Elysia instance with three chainable methods. Each method returns the same Elysia instance for fluent composition.
mcpTool
app.mcpTool<Input>(
name: string,
handler: McpToolHandler<Input>,
options?: McpToolOptions
): thisA handler may return a plain value or a complete McpToolResult. Plain JSON-compatible values become text and structured content automatically.
Prop
Type
Prop
Type
mcpResource
app.mcpResource(
uriOrTemplate: string,
handler: McpResourceHandler,
options?: McpResourceOptions
): thisA URI containing {variables} becomes a resource template. The handler context includes the requested URI, parsed variables, inbound request, optional metadata, and abort signal.
Prop
Type
Prop
Type
Prop
Type
mcpPrompt
app.mcpPrompt<Args extends Record<string, unknown>>(
name: string,
handler: McpPromptHandler<Args>,
options?: McpPromptOptions
): thisA handler may return a string, a list of prompt messages, or a complete McpPromptResult.
Prop
Type
Prop
Type
Prop
Type
Prop
Type
Shared invocation context
Every standalone handler receives the inbound MCP request and may receive an abort signal and protocol metadata.
Prop
Type
See Standalone Primitives and Resources and Prompts for implementation examples.