Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
MentorHostedMcpServer class
The MentorHostedMcpServer class of Novior.MentorAgent.Models: Configuration for a provider-hosted MCP server (roadmap #15 — Agent Framework Hosted MCP…
On this page
Configuration for a provider-hosted MCP server (roadmap #15 — Agent Framework Hosted MCP Tools). The model provider connects to the server and calls its tools while generating the answer.
Not the same as MentorMcpServer. There, your process is the MCP client: the tools are fetched at startup, listed in the prompt, and invoked locally — so they pass through MentorAgent's gate (roles, confirmation, metrics). Here the provider is the client: your server never talks to the MCP server at all, it only tells the provider where it is. That means the MCP server must be reachable from the provider's network, not from yours.
Approval is therefore the provider's job too, via MentorHostedMcpServer.RequireApproval. It maps to the Agent Framework's HostedMcpServerToolApprovalMode and surfaces through the same confirmation banner as everything else, in either HitlMode and whatever MentorOptions.RequireConfirmation says: that option is MentorAgent's own gate.
Usage:
options.HostedTools |= MentorHostedTools.HostedMcp;
options.HostedMcpServers = [
new MentorHostedMcpServer {
Name = "microsoft_learn",
Url = "https://learn.microsoft.com/api/mcp",
AllowedTools = ["microsoft_docs_search"],
}
];Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Models. Package: Novior.MentorAgent.
public sealed class MentorHostedMcpServer
dotnet add package Novior.MentorAgentConstructors
Section titled “Constructors”public MentorHostedMcpServer()
Properties
Section titled “Properties”AllowedTools
Section titled “AllowedTools”public IList<string>? AllowedTools { get; set; }
If it lists names, only these tools may be used. Null (default) or an empty list allows every tool the server exposes — an empty list is not "none" — so prefer an explicit list for a server you do not control.
AlwaysRequireApprovalTools
Section titled “AlwaysRequireApprovalTools”public IList<string>? AlwaysRequireApprovalTools { get; set; }
Tool names that always require approval. Takes precedence over MentorHostedMcpServer.RequireApproval.
Description
Section titled “Description”public string? Description { get; set; }
Optional description passed to the provider to give the model more context.
Headers
Section titled “Headers”public IDictionary<string, string>? Headers { get; set; }
Optional HTTP headers the provider sends to the MCP server (for example an authorization token). Not every provider honours them.
⚠️ These values leave your process and are stored by the provider for the duration of the call. Use a scoped, short-lived token — never a long-lived master key.
public required string Name { get; set; }
Identifier the provider uses for this server. Keep it short and stable — the model sees it.
NeverRequireApprovalTools
Section titled “NeverRequireApprovalTools”public IList<string>? NeverRequireApprovalTools { get; set; }
Tool names that never require approval. Takes precedence over MentorHostedMcpServer.RequireApproval.
RequireApproval
Section titled “RequireApproval”public bool RequireApproval { get; set; }
When true (default), every call to this server needs human approval. Set false only for read-only servers you trust: the provider will then call them with no confirmation at all.
Fine-grained control is available through MentorHostedMcpServer.AlwaysRequireApprovalTools / MentorHostedMcpServer.NeverRequireApprovalTools, which take precedence over this flag.
public required string Url { get; set; }
Address of the remote MCP server. Normally a URL; some providers also accept the well-known name of a built-in server. Must be reachable from the provider, so localhost and private addresses do not work.
