Namespace Kuestenlogik.Bowire.Mcp

Classes

BowireForwardingMcpTransport

MCP-over-MCP forwarder (#286). Wraps an outbound ModelContextProtocol.Client.McpClient connected to a parent Bowire process's MCP endpoint so an incoming JSON-RPC request handled by this server is marshalled to the parent verbatim and the parent's response is relayed back to the caller.

BowireMcpConfirmationStore

In-memory pending-confirmation store for the two-step mutator pattern (bowire.mock.start, bowire.record.start, bowire.env.switch, …). Step 1 of a mutation parks a description of the intended action here keyed by a short token; step 2 looks up the token, executes, and discards it. Tokens expire after DefaultTtl so a forgotten confirmation can't be replayed hours later from another agent context.

Registered as a singleton via AddBowireMcp(IServiceCollection, Action<BowireMcpOptions>?); lives for the lifetime of the MCP host process so multiple tool calls in the same session can hand the token back and forth.

BowireMcpDualHandlerDispatcher

Dispatches MCP tools/, resources/ and prompts/* traffic to the right backing implementation (full server vs adapter) based on the URL the request hit.

BowireMcpEndpointDescriptor

One row of the manifest — what's mounted where, in which mode. Property names are JSON-camelCased by the manifest endpoint's serializer so the workbench JS can read path / mode directly.

BowireMcpEndpointRegistry

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.

BowireMcpEndpointRouteBuilderExtensions

Map-time wiring for the full Bowire MCP server (the side that exposes the workbench's own tooling: bowire.discover, bowire.invoke, bowire.mock.*, &c). Pairs with the DI registration in AddBowireMcp(IServiceCollection, Action<BowireMcpOptions>?).

BowireMcpOptions

Tunables for BowireMcpTools. Defaults are security-first: invocation is blocked unless either the URL is on the AllowedServerUrls list or AllowArbitraryUrls is explicitly opted into. The discover, env, and record-list tools stay available regardless because they are read-only.

BowireMcpPendingConfirmation

One parked confirmation. Kind identifies the tool the agent issued; Plan is the human-readable description the first-step response showed the user; ExpiresAt caps how long it stays redeemable. Top-level so consumers don't hit CA1034 when destructuring through Consume(string).

BowireMcpPrompts

MCP prompt surface for the Bowire-self adapter — canned AI workflows the user (or the agent's host) picks from a menu and the agent then runs against Bowire's tools. Each prompt renders into a single user-role Microsoft.Extensions.AI.ChatMessage that wires the arguments into a task description; the agent then drives the matching BowireMcpTools calls.

Prompts are templates, not workflows: the language model still chooses which tools to call and in what order. The descriptions pick the tools the agent would naturally reach for given the task.

BowireMcpResources

MCP resource surface for the Bowire-self adapter — read-only "browse the workbench's state" endpoint pendants to the BowireMcpTools tools. Where a tool is an action the agent takes (bowire.invoke, bowire.mock.start), a resource is data the agent reads to decide what to do next.

URI shape: bowire://<collection>[/<id>]. Listing the collection without an id returns the index; appending an id returns the full item. The id space mirrors what the workbench stores on disk under ~/.bowire/.

BowireMcpServiceCollectionExtensions

DI registration for BowireMcpTools. Registers the Bowire protocol registry as a singleton and pulls the ModelContextProtocol server fluent API in. Choose the transport in your Program.cs after calling this — stdio for the CLI, HTTP/SSE for the embedded host:

// stdio (CLI)
services.AddBowireMcp(o => o.AllowArbitraryUrls = false)
        .WithStdioServerTransport()
        .WithTools<BowireMcpTools>()
        .WithResources<BowireMcpResources>()
        .WithPrompts<BowireMcpPrompts>();

// HTTP/SSE (embedded)
services.AddBowireMcp()
        .WithHttpTransport(o => o.Stateless = true)
        .WithTools<BowireMcpTools>()
        .WithResources<BowireMcpResources>()
        .WithPrompts<BowireMcpPrompts>();
// …then `app.MapBowireMcp();` (defaults to /bowire/mcp)
BowireMcpTools

MCP tool surface for Bowire. Each method is one tool the agent sees; parameter descriptions surface as JSON-Schema descriptions in tools/list. The class is registered with the SDK via WithTools<BowireMcpTools>() in BowireMcpServiceCollectionExtensions.

Three families of tool live here:

  • Live calls (discover, invoke, subscribe) hit the loaded protocol plugins directly via BowireProtocolRegistry.
  • State queries (env.list, record.list) read the on-disk Bowire files under ~/.bowire/.
  • Diagnostic (allowlist.show) — surfaces the current security configuration so an agent can self-debug "why is my invoke failing?".
BowireMcpTypedUrlStore

Disk-backed log of URLs the user has typed into the workbench (or permitted via the MCP bowire.allowlist.permit tool). Powers the --allow-invoke CLI mode: when set, the MCP allowlist seed pulls every URL from here in addition to the environments file. This widens what an agent can hit to "everywhere the user has actually pointed Bowire" without dropping the allowlist entirely.

Stored at ~/.bowire/typed-urls.json as a flat array: ["https://api.example.com/v1", "http://localhost:5000", …]. Deduplicated case-insensitively. The frontend may write to the same file independently — this store treats it as an append-only log and re-reads on every LoadAll().

BowireMockHandleRegistry

In-memory registry of MockServer instances spawned by bowire.mock.start. The MCP host is the owner — handles live for the duration of the host process. bowire.mock.stop looks up and disposes; bowire.mock.list enumerates.

Registered as a singleton in AddBowireMcp(IServiceCollection, Action<BowireMcpOptions>?) so the dictionary is shared across the tool class's lifetime.

Enums

BowireMcpEndpointMode

Operational mode of a mounted Bowire MCP endpoint. Surfaced in the manifest so introspection clients (the workbench's MCP panel, in particular) can tell the two flavours apart without probing.