# MentorHostedMcpServer class

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

- URL: https://docs.mentoragent.net/api/novior-mentoragent-models/mentorhostedmcpserver
- Verified with: MentorAgent 1.2.0
- Last updated: 2026-10-27
- Packages: Novior.MentorAgent

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`](https://docs.mentoragent.net/api/novior-mentoragent-models/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`](https://docs.mentoragent.net/api/novior-mentoragent-models/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`](https://docs.mentoragent.net/api/novior-mentoragent-options/mentoroptions#requireconfirmation) says: that option is MentorAgent's own gate.

Usage:

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

## Definition

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

`public sealed class MentorHostedMcpServer`

```shell
dotnet add package Novior.MentorAgent
```

## Constructors

`public MentorHostedMcpServer()`

## Properties

### `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`

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

Tool names that always require approval. Takes precedence over [`MentorHostedMcpServer.RequireApproval`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentorhostedmcpserver#requireapproval).

### `Description`

`public string? Description { get; set; }`

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

### `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.

### `Name`

`public required string Name { get; set; }`

Identifier the provider uses for this server. Keep it short and stable — the model sees it.

### `NeverRequireApprovalTools`

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

Tool names that never require approval. Takes precedence over [`MentorHostedMcpServer.RequireApproval`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentorhostedmcpserver#requireapproval).

### `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`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentorhostedmcpserver#alwaysrequireapprovaltools) / [`MentorHostedMcpServer.NeverRequireApprovalTools`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentorhostedmcpserver#neverrequireapprovaltools), which take precedence over this flag.

### `Url`

`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.

---

- Previous: [AgentCardInfo class](https://docs.mentoragent.net/api/novior-mentoragent-models/agentcardinfo.md)
- Next: [MentorMcpServer class](https://docs.mentoragent.net/api/novior-mentoragent-models/mentormcpserver.md)
