# McpServerDefinition

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.mcpserverdefinition/
> Summary: McpServerDefinition: A registered remote MCP server. Its tools are discovered at connection time and listed alongside the tools registered in code.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

A registered remote MCP server. Its tools are discovered at connection time and
listed alongside the tools registered in code.

```csharp
public sealed record McpServerDefinition : IEquatable<McpServerDefinition>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.mcpserverdefinition/">McpServerDefinition</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;McpServerDefinition&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

**Carries no secret.** The *value* of a credential header is not stored in this record; only the name of the configuration key the value is read from (`HeaderConfigurationKeys`) is stored. The value is resolved at connection time through `IConfiguration`, so it stays in `dotnet user-secrets` or an environment variable. It never enters a database backup, an audit trail, or a UI response.

## Constructors

### <a id="Tracon_McpServerDefinition__ctor"></a> McpServerDefinition\(\)

```csharp
public McpServerDefinition()
```

## Properties

### <a id="Tracon_McpServerDefinition_CreatedAt"></a> CreatedAt

The creation time (UTC).

```csharp
public DateTimeOffset CreatedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

### <a id="Tracon_McpServerDefinition_Description"></a> Description

The description.

```csharp
public string? Description { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_McpServerDefinition_Enabled"></a> Enabled

Whether the server is enabled. Its tools are not discovered while disabled.

```csharp
public bool Enabled { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_McpServerDefinition_Endpoint"></a> Endpoint

The server address. Only `http` and `https` are accepted.

```csharp
public required Uri Endpoint { get; init; }
```

#### Property Value

 Uri

### <a id="Tracon_McpServerDefinition_HeaderConfigurationKeys"></a> HeaderConfigurationKeys

Credential request headers, as a map from the header name to the NAME
of the configuration key its value is read from. The value is resolved
through `IConfiguration` on every connection and is never stored.

```csharp
public IReadOnlyDictionary<string, string> HeaderConfigurationKeys { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [string](https://learn.microsoft.com/dotnet/api/system.string)\>

#### Examples

```csharp
var record = new McpServerDefinition
{
    Id = Guid.NewGuid(),
    TenantId = "acme",
    Name = "search",
    Endpoint = new Uri("https://mcp.example.com/mcp"),
    HeaderConfigurationKeys = new Dictionary<string, string>
    {
        ["X-Api-Key"] = "Tracon:McpSecrets:acme:SearchKey",
    },
};
```

#### Remarks

Every key name must sit under
`TraconMcpSecurityOptions.AllowedConfigurationPrefix`, inside the
tenant's own key space (`{prefix}{tenantId}:...`; a flat name
directly under the prefix belongs to the default tenant). The rule is
checked on save and again on every connection.

A header name may appear only once across [McpServerDefinition.Headers](/api/tracon.mcpserverdefinition/#Tracon_McpServerDefinition_Headers) and
this map, compared case-insensitively. While OAuth is on, the map may
not name `Authorization`.

### <a id="Tracon_McpServerDefinition_Headers"></a> Headers

Extra request headers, sent as given with every request to the server.
An HTTP response never returns a stored value: it carries every header
name with the value `***`.

```csharp
public IReadOnlyDictionary<string, string> Headers { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [string](https://learn.microsoft.com/dotnet/api/system.string)\>

#### Remarks

The values are stored as plain text in the database. Do not put a
secret here: declare a credential header in
`HeaderConfigurationKeys` instead. The HTTP save rejects a header
whose name looks like a credential (`Authorization`,
`X-Api-Key`, `Cookie`, any name ending in `-key`).

The list and save responses mask every value, and the audit trail
records the names only. A save whose header value is `***` is
rejected, so a client that reads, edits and saves a server must send
every header value again.

### <a id="Tracon_McpServerDefinition_Id"></a> Id

The server identifier. A time-ordered UUID (v7).

```csharp
public required Guid Id { get; init; }
```

#### Property Value

 [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

### <a id="Tracon_McpServerDefinition_Name"></a> Name

The server name. Discovered tools are named as `{name}.{tool}`, so
tools with the same name on two servers never collide.

```csharp
public required string Name { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_McpServerDefinition_OAuthAuthorizationMode"></a> OAuthAuthorizationMode

The OAuth authorization flow.

```csharp
[JsonPropertyName("oauthAuthorizationMode")]
public McpOAuthAuthorizationMode OAuthAuthorizationMode { get; init; }
```

#### Property Value

 [McpOAuthAuthorizationMode](/api/tracon.mcpoauthauthorizationmode/)

### <a id="Tracon_McpServerDefinition_OAuthClientId"></a> OAuthClientId

The OAuth client identifier. Not a secret, stored as-is.

```csharp
[JsonPropertyName("oauthClientId")]
public string? OAuthClientId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_McpServerDefinition_OAuthClientSecretConfigurationKey"></a> OAuthClientSecretConfigurationKey

The configuration key the OAuth client secret's value is read from.
The value is never written to the database, under the same rule
as `HeaderConfigurationKeys`.

```csharp
[JsonPropertyName("oauthClientSecretConfigurationKey")]
public string? OAuthClientSecretConfigurationKey { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_McpServerDefinition_OAuthEnabled"></a> OAuthEnabled

Whether OAuth authentication is on. When on, `HeaderConfigurationKeys`
may not name `Authorization` — both would try to manage that header.

```csharp
[JsonPropertyName("oauthEnabled")]
public bool OAuthEnabled { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

#### Remarks

`[JsonPropertyName]` is given deliberately: System.Text.Json's
camelCase policy lowercases only the first letter, and since "OAuth"
starts with two uppercase letters, the default output would be
`oAuthEnabled` (not the expected `oauthEnabled`). The same
constraint applies to all four OAuth fields below.

### <a id="Tracon_McpServerDefinition_OAuthScopes"></a> OAuthScopes

The space-separated OAuth scope list. Example: `"repo read:user"`.

```csharp
[JsonPropertyName("oauthScopes")]
public string? OAuthScopes { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_McpServerDefinition_RequiresApproval"></a> RequiresApproval

Whether this server's tools require explicit approval before each call.
**Defaults to [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool)**: the tool definition
comes from outside and is treated as untrusted.

```csharp
public bool RequiresApproval { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_McpServerDefinition_TenantId"></a> TenantId

The tenant the server belongs to.

```csharp
public required string TenantId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_McpServerDefinition_Transport"></a> Transport

The transport format.

```csharp
public McpTransportMode Transport { get; init; }
```

#### Property Value

 [McpTransportMode](/api/tracon.mcptransportmode/)

### <a id="Tracon_McpServerDefinition_UpdatedAt"></a> UpdatedAt

The last-updated time (UTC).

```csharp
public DateTimeOffset UpdatedAt { get; init; }
```

#### Property Value

 [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

## Methods

### <a id="Tracon_McpServerDefinition_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_McpServerDefinition_Equals_Tracon_McpServerDefinition_"></a> Equals\(McpServerDefinition?\)

```csharp
public bool Equals(McpServerDefinition? other)
```

#### Parameters

`other` [McpServerDefinition](/api/tracon.mcpserverdefinition/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_McpServerDefinition_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_McpServerDefinition_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Operators

### <a id="Tracon_McpServerDefinition_op_Equality_Tracon_McpServerDefinition_Tracon_McpServerDefinition_"></a> operator ==\(McpServerDefinition?, McpServerDefinition?\)

```csharp
public static bool operator ==(McpServerDefinition? left, McpServerDefinition? right)
```

#### Parameters

`left` [McpServerDefinition](/api/tracon.mcpserverdefinition/)?

`right` [McpServerDefinition](/api/tracon.mcpserverdefinition/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_McpServerDefinition_op_Inequality_Tracon_McpServerDefinition_Tracon_McpServerDefinition_"></a> operator \!=\(McpServerDefinition?, McpServerDefinition?\)

```csharp
public static bool operator !=(McpServerDefinition? left, McpServerDefinition? right)
```

#### Parameters

`left` [McpServerDefinition](/api/tracon.mcpserverdefinition/)?

`right` [McpServerDefinition](/api/tracon.mcpserverdefinition/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
