Class BowireMcpProtocol
- Namespace
- Kuestenlogik.Bowire.Protocol.Mcp
- Assembly
- Kuestenlogik.Bowire.Protocol.Mcp.dll
Bowire protocol plugin for the Model Context Protocol (MCP). Connects to a remote MCP server, discovers its tools / resources / prompts, and lets the user invoke them — analogous to the gRPC and REST plugins.
public sealed class BowireMcpProtocol : IBowireProtocol
- Inheritance
-
BowireMcpProtocol
- Implements
- Inherited Members
Remarks
Built on the official ModelContextProtocol C# SDK
(ModelContextProtocol.Client.McpClient + ModelContextProtocol.Client.HttpClientTransport) — the
previous hand-rolled JSON-RPC client predates the SDK's client
surface. The SDK handles spec-version negotiation, Streamable-HTTP-
vs-SSE auto-detection, session resumption, and the JSON-RPC wire
envelope.
The companion MapBowireMcpAdapter(IEndpointRouteBuilder, string)
extension lives in the same assembly but is unrelated to discovery: it is
an opt-in development feature that goes the other direction (Bowire's
services exposed as MCP tools so AI agents can call them). The
adapter is hand-rolled because it sits on Bowire's own
BowireProtocolRegistry rather than ASP.NET MCP middleware.
Constructors
BowireMcpProtocol()
public BowireMcpProtocol()
Properties
Description
One-line description shown next to the plugin's display name
in Settings → Plugins. Optional; defaults to empty so
the row falls back to "DisplayName + version" without the
description line. Keep it short (≤ 100 characters) — the row
truncates anything wider than the manage panel.
public string Description { get; }
Property Value
IconSvg
SVG icon for the protocol tab.
public string IconSvg { get; }
Property Value
Id
Short identifier (e.g., "grpc", "signalr").
public string Id { get; }
Property Value
Name
Protocol name shown in UI tabs.
public string Name { get; }
Property Value
Methods
DiscoverAsync(string, bool, CancellationToken)
Discover available services and methods.
public Task<List<BowireServiceInfo>> DiscoverAsync(string serverUrl, bool showInternalServices, CancellationToken ct = default)
Parameters
serverUrlstringshowInternalServicesboolctCancellationToken
Returns
Initialize(IServiceProvider?)
Called after registration to inject the app's service provider (embedded mode).
public void Initialize(IServiceProvider? serviceProvider)
Parameters
serviceProviderIServiceProvider
InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken)
Invoke a unary or client-streaming call.
public Task<InvokeResult> InvokeAsync(string serverUrl, string service, string method, List<string> jsonMessages, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)
Parameters
serverUrlstringservicestringmethodstringjsonMessagesList<string>showInternalServicesboolmetadataDictionary<string, string>ctCancellationToken
Returns
InvokeStreamAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken)
Invoke a server-streaming or duplex call.
public IAsyncEnumerable<string> InvokeStreamAsync(string serverUrl, string service, string method, List<string> jsonMessages, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)
Parameters
serverUrlstringservicestringmethodstringjsonMessagesList<string>showInternalServicesboolmetadataDictionary<string, string>ctCancellationToken
Returns
OpenChannelAsync(string, string, string, bool, Dictionary<string, string>?, CancellationToken)
Open an interactive channel (for duplex/client-streaming).
public Task<IBowireChannel?> OpenChannelAsync(string serverUrl, string service, string method, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)
Parameters
serverUrlstringservicestringmethodstringshowInternalServicesboolmetadataDictionary<string, string>ctCancellationToken