Skip to content

ReplMcpServerOptions

Configuration for the Repl MCP server integration.

public sealed class ReplMcpServerOptions

Registers an MCP prompt with a DI-injectable handler.

public ReplMcpServerOptions Prompt(string name, Delegate handler)
  • name (string): Prompt name (must be unique).
  • handler (Delegate): Handler delegate.

ReplMcpServerOptions - The same options instance.

UiResource(string, Delegate, Action<McpAppResourceOptions>?)

Section titled “UiResource(string, Delegate, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource with a DI-injectable handler.

public ReplMcpServerOptions UiResource(string uri, Delegate handler, Action<McpAppResourceOptions>? configure = null)
  • uri (string): The ui:// resource URI.
  • handler (Delegate): Handler returning a complete HTML document. Parameters are resolved from services or the MCP App resource context.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource(string, Func<McpAppResourceContext, CancellationToken, ValueTask<string>>, Action<McpAppResourceOptions>?)

Section titled “UiResource(string, Func<McpAppResourceContext, CancellationToken, ValueTask<string>>, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource.

public ReplMcpServerOptions UiResource(string uri, Func<McpAppResourceContext, CancellationToken, ValueTask<string>> htmlFactory, Action<McpAppResourceOptions>? configure = null)
  • uri (string): The ui:// resource URI.
  • htmlFactory (Func<McpAppResourceContext, CancellationToken, ValueTask<string>>): Factory returning a complete HTML document. Parameters are resolved from services or the MCP App resource context.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource(string, Func<string>, Action<McpAppResourceOptions>?)

Section titled “UiResource(string, Func<string>, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource.

public ReplMcpServerOptions UiResource(string uri, Func<string> htmlFactory, Action<McpAppResourceOptions>? configure = null)
  • uri (string): The ui:// resource URI.
  • htmlFactory (Func<string>): Factory returning a complete HTML document. Parameters are resolved from services or the MCP App resource context.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource(string, Func<CancellationToken, ValueTask<string>>, Action<McpAppResourceOptions>?)

Section titled “UiResource(string, Func<CancellationToken, ValueTask<string>>, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource.

public ReplMcpServerOptions UiResource(string uri, Func<CancellationToken, ValueTask<string>> htmlFactory, Action<McpAppResourceOptions>? configure = null)
  • uri (string): The ui:// resource URI.
  • htmlFactory (Func<CancellationToken, ValueTask<string>>): Factory returning a complete HTML document. Parameters are resolved from services or the MCP App resource context.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource(string, string, Action<McpAppResourceOptions>?)

Section titled “UiResource(string, string, Action<McpAppResourceOptions>?)”

Registers a static MCP App HTML resource.

public ReplMcpServerOptions UiResource(string uri, string html, Action<McpAppResourceOptions>? configure = null)
  • uri (string): The ui:// resource URI.
  • html (string): Complete HTML document returned for the resource.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource<TService>(string, Func<TService, string>, Action<McpAppResourceOptions>?)

Section titled “UiResource<TService>(string, Func<TService, string>, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource with a single DI-injected service parameter.

public ReplMcpServerOptions UiResource<TService>(string uri, Func<TService, string> htmlFactory, Action<McpAppResourceOptions>? configure = null)
  • TService: Service type resolved from the Repl app service provider.
  • uri (string): The ui:// resource URI.
  • htmlFactory (Func<TService, string>): Factory returning a complete HTML document.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource<TService>(string, Func<TService, Task<string>>, Action<McpAppResourceOptions>?)

Section titled “UiResource<TService>(string, Func<TService, Task<string>>, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource with a single DI-injected service parameter.

public ReplMcpServerOptions UiResource<TService>(string uri, Func<TService, Task<string>> htmlFactory, Action<McpAppResourceOptions>? configure = null)
  • TService: Service type resolved from the Repl app service provider.
  • uri (string): The ui:// resource URI.
  • htmlFactory (Func<TService, Task<string>>): Factory returning a complete HTML document.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

UiResource<TService>(string, Func<TService, ValueTask<string>>, Action<McpAppResourceOptions>?)

Section titled “UiResource<TService>(string, Func<TService, ValueTask<string>>, Action<McpAppResourceOptions>?)”

Registers an MCP App HTML resource with a single DI-injected service parameter.

public ReplMcpServerOptions UiResource<TService>(string uri, Func<TService, ValueTask<string>> htmlFactory, Action<McpAppResourceOptions>? configure = null)
  • TService: Service type resolved from the Repl app service provider.
  • uri (string): The ui:// resource URI.
  • htmlFactory (Func<TService, ValueTask<string>>): Factory returning a complete HTML document.
  • configure (Action<McpAppResourceOptions>): Optional resource metadata configuration.

ReplMcpServerOptions - The same options instance.

When true (default), commands annotated .ReadOnly() are automatically exposed as MCP resources in addition to being tools. Set to false to require explicit .AsResource() marking.

public bool AutoPromoteReadOnlyToResources { get; set; }

bool

Optional filter controlling which commands are exposed as MCP tools. When null, all non-hidden, non-AutomationHidden commands are exposed.

public Func<ReplDocCommand, bool>? CommandFilter { get; set; }

Func<ReplDocCommand, bool>

Context name for the MCP subcommands (default: "mcp"). The serve subcommand becomes: myapp {ContextName} serve.

public string ContextName { get; set; }

string

Controls the opt-in compatibility layer for clients that don’t handle dynamic MCP tool lists well. Leave this disabled for applications whose tool list is static.

public DynamicToolCompatibilityMode DynamicToolCompatibility { get; set; }

DynamicToolCompatibilityMode

When true, the server advertises the MCP Apps UI extension. Mapped MCP App resources and UiResource(string, string, Action<McpAppResourceOptions>) registrations enable this automatically.

public bool EnableApps { get; set; }

bool

Controls how runtime interaction prompts are handled in MCP mode.

public InteractivityMode InteractivityMode { get; set; }

InteractivityMode

Controls the text fallback emitted alongside structured paged tool results.

public McpPagedResultTextMode PagedResultTextMode { get; set; }

McpPagedResultTextMode

When true, prompts are also exposed as tools. This is a compatibility fallback for clients that don’t support MCP prompts (~62% as of March 2025). Default is false — opt in when your target agents lack prompt support.

public bool PromptFallbackToTools { get; set; }

bool

When true, resources are also exposed as read-only tools. This is a compatibility fallback for clients that don’t support MCP resources (~61% as of March 2025). Default is false — opt in when your target agents lack resource support.

public bool ResourceFallbackToTools { get; set; }

bool

URI scheme used for MCP resource URIs (default: "repl"). Resources are exposed as {scheme}://{path}.

public string ResourceUriScheme { get; set; }

string

Server name reported in the MCP initialize response. Defaults to the assembly product name.

public string? ServerName { get; set; }

string

Server version reported in the MCP initialize response.

public string? ServerVersion { get; set; }

string

Separator used when flattening context paths into MCP tool names.

public ToolNamingSeparator ToolNamingSeparator { get; set; }

ToolNamingSeparator

Optional factory for creating custom MCP transports (e.g. WebSocket, SSE). When null (default), the server uses StdioServerTransport. The factory receives the server name and the I/O context for stream access.

public Func<string, IReplIoContext, ITransport>? TransportFactory { get; set; }

Func<string, IReplIoContext, ITransport>