AgentPrismMcpBuilderExtensions
AgentPrism.Mcp.dllExtensions that register tool discovery from remote MCP servers.
public static class AgentPrismMcpBuilderExtensionsInheritance
Section titled “Inheritance”object ← AgentPrismMcpBuilderExtensions
Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Methods
Section titled “Methods”UseMcp(IAgentPrismBuilder)
Section titled “ UseMcp(IAgentPrismBuilder)”Registers the Model Context Protocol client. Tools from every registered and enabled MCP server are discovered and listed alongside the tools registered in code.
public static IAgentPrismBuilder UseMcp(this IAgentPrismBuilder builder)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The AgentPrism configuration chain.
Returns
Section titled “Returns”The chain, for further configuration.
Remarks
Section titled “Remarks”Security boundary. Adding an MCP server means accepting tool definitions from an external source, and is a deliberate exception to the code-only tools rule (“tools are defined only in code”). It comes with the following safeguards:
- Only remote HTTP servers; there is no local process (stdio) transport.
- MCP tools require approval by default.
- A tool name already registered in code can never be hijacked by MCP.
- The server definition carries no secret; the authentication value is resolved from configuration.
- Every call is written to the
tool_invocationstable with the source server name.
builder.AddAgentPrism() .UseOpenAI(apiKey) .UsePostgreSql(connectionString) .UseMcp() .UseUI();Exceptions
Section titled “Exceptions”builder is null.
UseMcp(IAgentPrismBuilder, Action<AgentPrismMcpOptions>)
Section titled “ UseMcp(IAgentPrismBuilder, Action<AgentPrismMcpOptions>)”Registers the Model Context Protocol client with settings given in code.
public static IAgentPrismBuilder UseMcp(this IAgentPrismBuilder builder, Action<AgentPrismMcpOptions> configure)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The AgentPrism configuration chain.
configure Action<AgentPrismMcpOptions>
The option modifier.
Returns
Section titled “Returns”The chain, for further configuration.
Exceptions
Section titled “Exceptions”One of the parameters is null.
UseMcp(IAgentPrismBuilder, IConfiguration, Action<AgentPrismMcpOptions>?)
Section titled “ UseMcp(IAgentPrismBuilder, IConfiguration, Action<AgentPrismMcpOptions>?)”Registers the MCP client, reading options from the AgentPrism:Mcp section.
public static IAgentPrismBuilder UseMcp(this IAgentPrismBuilder builder, IConfiguration configurationSection, Action<AgentPrismMcpOptions>? configure)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The AgentPrism configuration chain.
configurationSection IConfiguration
The section options are read from. Typically
configuration.GetSection(AgentPrismMcpOptions.SectionName).
configure Action<AgentPrismMcpOptions>?
The option modifier that runs AFTER the section is bound. A value given in code overrides the value coming from configuration. Pass null when configuration alone is enough.
Returns
Section titled “Returns”The chain, for further configuration.
Remarks
Section titled “Remarks”Configuration is provided explicitly; AgentPrism never
reads IConfiguration on its own. This follows from reason the no-surprises rule
(zero surprises) and stays consistent with the other Use*
extensions in the repository.
builder.AddAgentPrism() .UseMcp(builder.Configuration.GetSection(AgentPrismMcpOptions.SectionName), configure: null);Exceptions
Section titled “Exceptions”builder or configurationSection
is null.