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 and so overlapping route prefixes are caught at startup rather than silently shadowing each other.
public sealed class BowireMcpEndpointRegistry
- Inheritance
-
BowireMcpEndpointRegistry
- Inherited Members
Remarks
Lives as a DI singleton, populated by the two map-time extensions:
- MapBowireMcp(IEndpointRouteBuilder, string) registers the full Bowire MCP server (mode Server).
McpAdapterEndpoints.MapBowireMcpAdapterinKuestenlogik.Bowire.Protocol.Mcpregisters the adapter (mode Adapter).
Both endpoints can coexist on the same host because their default
prefixes (/bowire/mcp vs /bowire/mcp/adapter) don't
overlap. When an operator overrides one prefix to overlap the other
(same path, or one prefix-of the other), Register(string, BowireMcpEndpointMode)
throws InvalidOperationException at startup with a
message that names both offending routes — failing loud instead of
having one endpoint silently swallow the other's traffic.
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 the new prefix overlaps with an already-registered one (exact match, or one is a path-prefix of the other and would shadow traffic).
public void Register(string prefix, BowireMcpEndpointMode mode)
Parameters
prefixstringmodeBowireMcpEndpointMode
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
requestPathstring
Returns
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()