# IMcpServerStore

> 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.imcpserverstore/
> Summary: IMcpServerStore: The store for registered MCP servers.

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

The store for registered MCP servers.

```csharp
public interface IMcpServerStore
```

## Remarks

**DI lifetime — singleton.** Registered as a singleton with
`TryAdd`; a consumer's own registration wins. An implementation must
be safe under concurrent calls and must not capture or depend on a
scoped service.

## Methods

### <a id="Tracon_IMcpServerStore_DeleteAsync_System_String_System_String_System_Threading_CancellationToken_"></a> DeleteAsync\(string, string, CancellationToken\)

Deletes a server.

```csharp
ValueTask<bool> DeleteAsync(string tenantId, string name, CancellationToken cancellationToken = default)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The server name.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\>

[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the record was deleted.

### <a id="Tracon_IMcpServerStore_GetAsync_System_String_System_String_System_Threading_CancellationToken_"></a> GetAsync\(string, string, CancellationToken\)

Fetches a server by name.

```csharp
ValueTask<McpServerDefinition?> GetAsync(string tenantId, string name, CancellationToken cancellationToken = default)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The server name.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[McpServerDefinition](/api/tracon.mcpserverdefinition/)?\>

The server; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if none exists.

### <a id="Tracon_IMcpServerStore_ListAsync_System_String_System_Threading_CancellationToken_"></a> ListAsync\(string, CancellationToken\)

Lists a tenant's servers, ordered by name.

```csharp
ValueTask<IReadOnlyList<McpServerDefinition>> ListAsync(string tenantId, CancellationToken cancellationToken = default)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant identifier.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[McpServerDefinition](/api/tracon.mcpserverdefinition/)\>\>

The servers.

### <a id="Tracon_IMcpServerStore_SaveAsync_Tracon_McpServerDefinition_System_Threading_CancellationToken_"></a> SaveAsync\(McpServerDefinition, CancellationToken\)

Adds or updates a server. The key is the `(tenant, name)` pair.

```csharp
ValueTask<McpServerDefinition> SaveAsync(McpServerDefinition server, CancellationToken cancellationToken = default)
```

#### Parameters

`server` [McpServerDefinition](/api/tracon.mcpserverdefinition/)

The server to write.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[McpServerDefinition](/api/tracon.mcpserverdefinition/)\>

The persisted record.
