Path: redb-route/redb.Route.Llm.Mcp/Transport/McpTransport.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm.Mcp/Transport/McpTransport.cs ---- namespace redb.Route.Llm.Mcp.Transport; /// Transport flavor for an MCP server. public enum McpTransportKind { /// Spawn an external process and exchange newline-delimited JSON over stdin/stdout. Stdio, /// POST JSON-RPC requests to a base URL; receive notifications via SSE. HttpSse } /// /// Configuration for an MCP server transport. Built via /// or and passed to . /// public sealed class McpTransport { /// Selected transport kind. public McpTransportKind Kind { get; init; } // ── stdio ── /// Executable to spawn (stdio transport). Resolved against PATH if not absolute. public string? Command { get; init; } /// Command-line arguments (stdio transport). public IReadOnlyList Arguments { get; init; } = []; /// Additional environment variables for the spawned process (stdio transport). public IReadOnlyDictionary Environment { get; init; } = new Dictionary(StringComparer.Ordinal); /// Working directory for the spawned process (stdio transport). Null = caller's CWD. public string? WorkingDirectory { get; init; } // ── http+sse ── /// Base URL for HTTP+SSE transport (e.g. https://mcp.example.com/). public string? BaseUrl { get; init; } /// Optional bearer token for HTTP+SSE transport. public string? BearerToken { get; init; } /// Builds an stdio transport configuration. /// Executable to spawn. /// Optional command-line arguments. /// Optional additional environment variables. /// Optional working directory. public static McpTransport Stdio( string command, IReadOnlyList? arguments = null, IReadOnlyDictionary? environment = null, string? workingDirectory = null) { ArgumentException.ThrowIfNullOrWhiteSpace(command); return new McpTransport { Kind = McpTransportKind.Stdio, Command = command, Arguments = arguments ?? [], Environment = environment ?? new Dictionary(StringComparer.Ordinal), WorkingDirectory = workingDirectory, }; } /// Builds an HTTP+SSE transport configuration. /// Base URL of the MCP server. /// Optional bearer token for the Authorization header. public static McpTransport Http(string baseUrl, string? bearerToken = null) { ArgumentException.ThrowIfNullOrWhiteSpace(baseUrl); return new McpTransport { Kind = McpTransportKind.HttpSse, BaseUrl = baseUrl, BearerToken = bearerToken, }; } }