Elysia MCP Adapterelysia-mcp-adapter
API Reference

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
): this

A 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
): this

A 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
): this

A 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.

On this page