# MentorMcpServer class

> The MentorMcpServer class of Novior.MentorAgent.Models: Configuration for an external MCP (Model Context Protocol) server that MentorAgent will connect to as…

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

Configuration for an external MCP (Model Context Protocol) server that MentorAgent will connect to as a client. The server's tools become available to the coordinator as L1 tools, just like `[MentorAction]` methods. Usage:

```text title="Example"
options.McpServers = [
    // stdio transport (local process launched via npx, uvx, etc.)
    new MentorMcpServer {
        Name = "filesystem",
        Command = "npx",
        Arguments = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
        RequiresConfirmation = true
    },
    // HTTP transport (remote MCP server)
    new MentorMcpServer {
        Name = "my-tools",
        ServerUrl = "https://my-mcp-server.example.com/mcp",
        AllowedTools = ["search", "fetch"]
    }
];
```

## Definition

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

`public sealed class MentorMcpServer`

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

## Constructors

`public MentorMcpServer()`

## Properties

### `AllowedTools`

`public string[]? AllowedTools { get; set; }`

If it lists names, only these tools from the MCP server are registered. Null (default) or an empty array registers every tool the server exposes: an empty list is not "none".

### `Arguments`

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

Command-line arguments for stdio transport (e.g. \["-y", "@modelcontextprotocol/server-filesystem", "/tmp"\]).

### `Command`

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

Executable command for stdio-based MCP servers (e.g. "npx", "uvx", "python"). Mutually exclusive with [`MentorMcpServer.ServerUrl`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentormcpserver#serverurl).

### `EnvironmentVariables`

`public IDictionary<string, string>? EnvironmentVariables { get; set; }`

Optional environment variables passed to the stdio process.

### `Name`

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

Display name for this server (shown in the MCP status badge).

### `RequiresConfirmation`

`public bool RequiresConfirmation { get; set; }`

When true, the coordinator will ask the user to confirm before calling any tool from this MCP server (same as `[MentorAction(RequiresConfirmation=true)]`). Default: false

### `ServerUrl`

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

HTTP/SSE endpoint URL for HTTP-based MCP servers. Mutually exclusive with [`MentorMcpServer.Command`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentormcpserver#command).

### `Shared`

`public bool? Shared { get; set; }`

Whether one connection to this server is shared by every session in the process. `null` (default) decides by transport: a server reached over [`MentorMcpServer.ServerUrl`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentormcpserver#serverurl) is **shared**, a server started from [`MentorMcpServer.Command`](https://docs.mentoragent.net/api/novior-mentoragent-models/mentormcpserver#command) is **per session**.

The default is the safe reading of each case. A remote endpoint is shared by nature, so pooling the client changes nothing it can observe. A local child process can hold state for the person who started it — `@modelcontextprotocol/server-memory` is a knowledge graph with no notion of a user — so sharing it would put every visitor in the same store.

Set `true` for a stdio server you know is stateless, and the process starts one child instead of one per visitor: measured on the sample, two browser tabs were eight node processes and 580 MB. Set `false` for a URL server that keeps per-connection state.

---

- Previous: [MentorHostedMcpServer class](https://docs.mentoragent.net/api/novior-mentoragent-models/mentorhostedmcpserver.md)
- Next: [MentorRemoteAgent class](https://docs.mentoragent.net/api/novior-mentoragent-models/mentorremoteagent.md)
