Skip to content
Tracon

McpServerStoreContract

Namespace Tracon.Testing.Contracts.Storage · Assembly Tracon.Testing.Contracts.Xunit.dll

Behavior tests for the IMcpServerStore contract.

public abstract class McpServerStoreContract : TenantIsolationContract<IMcpServerStore>, IAsyncLifetime, IAsyncDisposable
Inheritance
object ← StoreCancellationContract<IMcpServerStore> ← TenantIsolationContract<IMcpServerStore> ← McpServerStoreContract
Implements
IAsyncLifetime, IAsyncDisposable
Inherited Members
TenantIsolationContract<IMcpServerStore>.TenantA, TenantIsolationContract<IMcpServerStore>.TenantB, TenantIsolationContract<IMcpServerStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IMcpServerStore>.SeedAsync(string, string, CancellationToken), TenantIsolationContract<IMcpServerStore>.ExistsAsync(string, object), TenantIsolationContract<IMcpServerStore>.CountAsync(string, CancellationToken), TenantIsolationContract<IMcpServerStore>.TryDeleteAsync(string, object), TenantIsolationContract<IMcpServerStore>.TryOverwriteAsync(string, string), TenantIsolationContract<IMcpServerStore>.CancellableReadAsync(CancellationToken), TenantIsolationContract<IMcpServerStore>.CancellableWriteAsync(CancellationToken), TenantIsolationContract<IMcpServerStore>.WroteAnythingAsync(), TenantIsolationContract<IMcpServerStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<IMcpServerStore>.Tenant_reads_its_own_record(), TenantIsolationContract<IMcpServerStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<IMcpServerStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<IMcpServerStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<IMcpServerStore>.AmbientTenant, StoreCancellationContract<IMcpServerStore>.CreateStoreAsync(), StoreCancellationContract<IMcpServerStore>.InitializeAsync(), StoreCancellationContract<IMcpServerStore>.DisposeAsync(), StoreCancellationContract<IMcpServerStore>.OnDisposeAsync(), StoreCancellationContract<IMcpServerStore>.CancellableReadAsync(CancellationToken), StoreCancellationContract<IMcpServerStore>.CancellableWriteAsync(CancellationToken), StoreCancellationContract<IMcpServerStore>.WroteAnythingAsync(), StoreCancellationContract<IMcpServerStore>.Canceled_token_throws_on_read(), StoreCancellationContract<IMcpServerStore>.The_write_this_contract_checks_can_be_read_back(), StoreCancellationContract<IMcpServerStore>.Canceled_token_throws_on_write_and_leaves_no_trace(), StoreCancellationContract<IMcpServerStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

An MCP server registration accepts a tool definition from an external source; one tenant’s server showing up in another tenant’s catalog is a security boundary. The record never carries a secret – it only stores the name of the configuration key the value will be read from.

protected McpServerStoreContract()

Reports how many records the given tenant sees through the listing endpoint.

protected override ValueTask<int> CountAsync(string tenantId, CancellationToken cancellationToken)

tenantId string

The reading tenant.

cancellationToken CancellationToken

The token every store call inside the hook must be handed; see TenantIsolationContract.SeedAsync.

ValueTask<int>

The number of records seen.

Deleting_a_nonexistent_record_returns_false()

Section titled “ Deleting_a_nonexistent_record_returns_false()”
[Fact]
public Task Deleting_a_nonexistent_record_returns_false()

Task

Every_field_of_a_server_survives_a_round_trip()

Section titled “ Every_field_of_a_server_survives_a_round_trip()”
[Fact]
public Task Every_field_of_a_server_survives_a_round_trip()

Task

Reports whether the record is visible from the given tenant’s viewpoint.

protected override ValueTask<bool> ExistsAsync(string tenantId, object key)

tenantId string

The reading tenant.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool>

true if the record is visible.

Header_configuration_keys_are_preserved()

Section titled “ Header_configuration_keys_are_preserved()”
[Fact]
public Task Header_configuration_keys_are_preserved()

Task

[Fact]
public Task Nonexistent_server_returns_null()

Task

[Fact]
public Task Saved_server_is_read_back()

Task

Saving_the_same_name_a_second_time_overwrites_it()

Section titled “ Saving_the_same_name_a_second_time_overwrites_it()”
[Fact]
public Task Saving_the_same_name_a_second_time_overwrites_it()

Task

SeedAsync(string, string, CancellationToken)

Section titled “ SeedAsync(string, string, CancellationToken)”

Writes a sample record for the given tenant.

protected override ValueTask<object> SeedAsync(string tenantId, string name, CancellationToken cancellationToken)

tenantId string

The tenant that owns the record.

name string

The name distinguishing the record. The same name may be used by two tenants.

cancellationToken CancellationToken

The token every store call inside the hook must be handed. The cancellation contract calls this hook with a token that is already cancelled, so a hook that drops the token reports a store as sound when it is not.

ValueTask<object>

The key to use for reading the record back.

Attempts to delete the record on behalf of the given tenant.

protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)

tenantId string

The tenant attempting the delete.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool?>

true if the delete succeeded, false if the record was not found; null if the store does not offer deletion.