Class BowireMcpEndpointRegistry

Namespace
Kuestenlogik.Bowire.Mcp
Assembly
Kuestenlogik.Bowire.Mcp.dll

Tracks the MCP endpoints (full-server + adapter) mounted on an ASP.NET host so the manifest endpoint can enumerate them, so two endpoints at the same path are caught at startup, and so each request reaches the endpoint whose prefix it falls under.

public sealed class BowireMcpEndpointRegistry
Inheritance
BowireMcpEndpointRegistry
Inherited Members

Remarks

Lives as a DI singleton, populated by the two map-time extensions:

Both endpoints can coexist on the same host. Their default prefixes nest — /bowire/mcp/adapter lies below /bowire/mcp — and that is fine: ResolveMode(string) routes a request by the longest registered prefix it falls under, so the deeper mount keeps its own traffic. Only an operator who mounts both at the same path makes them indistinguishable; Register(string, BowireMcpEndpointMode) throws InvalidOperationException at startup for that, naming the route, rather than having one endpoint silently swallow the other's traffic (#886).

The dispatcher (BowireMcpDualHandlerDispatcher) consults this registry at request time to route tools/list, tools/call, resources/* and prompts/* requests to the right handler based on Request path matching one of the registered prefixes.

Constructors

BowireMcpEndpointRegistry()

public BowireMcpEndpointRegistry()

Methods

Register(string, BowireMcpEndpointMode)

Register a mounted MCP endpoint. Normalises the prefix to a canonical "/segment[/segment...]" form (no trailing slash; empty becomes "/"). Throws InvalidOperationException when an endpoint is already registered at the same path. A prefix nested in another one is accepted: requests go to the longest prefix they fall under (ResolveMode(string)).

public void Register(string prefix, BowireMcpEndpointMode mode)

Parameters

prefix string
mode BowireMcpEndpointMode

ResolveMode(string)

Mode of the endpoint mounted at requestPath, or null when no registered endpoint covers the request. Used by BowireMcpDualHandlerDispatcher to route list/call requests by URL path.

public BowireMcpEndpointMode? ResolveMode(string requestPath)

Parameters

requestPath string

Returns

BowireMcpEndpointMode?

Snapshot()

Snapshot of every registered endpoint, suitable for serving as the manifest endpoint's JSON body. The order is deterministic (ordinal by path) so clients (and tests) can rely on it.

public IReadOnlyList<BowireMcpEndpointDescriptor> Snapshot()

Returns

IReadOnlyList<BowireMcpEndpointDescriptor>