MentorAgent Docs
Menu

ReferencePackage: Novior.MentorAgent

MentorHostedMcpServer class

The MentorHostedMcpServer class of Novior.MentorAgent.Models: Configuration for a provider-hosted MCP server (roadmap #15 — Agent Framework Hosted MCP…

View as Markdown
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:

Example
options.HostedTools |= MentorHostedTools.HostedMcp;
options.HostedMcpServers = [
    new MentorHostedMcpServer {
        Name         = "microsoft_learn",
        Url          = "https://learn.microsoft.com/api/mcp",
        AllowedTools = ["microsoft_docs_search"],
    }
];

Namespace: Novior.MentorAgent.Models. Package: Novior.MentorAgent.

public sealed class MentorHostedMcpServer

Terminal
dotnet add package Novior.MentorAgent

public MentorHostedMcpServer()

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.

public IList<string>? AlwaysRequireApprovalTools { get; set; }

Tool names that always require approval. Takes precedence over MentorHostedMcpServer.RequireApproval.

public string? Description { get; set; }

Optional description passed to the provider to give the model more context.

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.

public IList<string>? NeverRequireApprovalTools { get; set; }

Tool names that never require approval. Takes precedence over MentorHostedMcpServer.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.