Skip to content

Commit 87c8bdf

Browse files
committed
naming
1 parent b05e0f4 commit 87c8bdf

12 files changed

+34
-31
lines changed

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ If no new rule is detected -> do not update the file.
194194
- For search-quality improvements, prefer mathematical or statistical ranking changes over hardcoded phrase lists or ad-hoc query text hacks, because the user explicitly wants tokenizer search to improve through general scoring behavior rather than manual exceptions.
195195
- Prefer framework-provided in-memory caching primitives such as `IMemoryCache` over custom process-local storage implementations when they cover the lifecycle and lookup needs, because self-rolled memory stores age poorly and make scaling/concurrency behavior harder to trust.
196196
- Never keep legacy compatibility shims, obsolete paths, or lingering documentation references to removed implementations when a replacement is accepted, because this repository should converge on the current design instead of carrying dead historical baggage.
197+
- Never leave `ManagedCode`-prefixed DI/setup extension method names such as `AddManagedCodeMcpGateway(...)` in the public API once concise `McpGateway` naming is available, because these branded leftovers make the package surface inconsistent and read like stale legacy.
197198

198199
### Critical (NEVER violate)
199200

@@ -234,6 +235,7 @@ If no new rule is detected -> do not update the file.
234235
- Direct fixes over preserving legacy compatibility paths when cleanup or review-driven corrections are requested
235236
- Framework-provided caching primitives over self-rolled in-memory stores when the package only needs process-local cache semantics
236237
- Removing replaced code paths completely instead of keeping legacy mentions or compatibility leftovers
238+
- Concise `McpGateway` public registration/init API names without leftover `ManagedCode` branding
237239

238240
### Dislikes
239241

@@ -243,3 +245,4 @@ If no new rule is detected -> do not update the file.
243245
- Shipping behavior without tests
244246
- Self-rolled in-memory storage when standard .NET caching abstractions already fit the scenario
245247
- Legacy/obsolete compatibility leftovers after a replacement is accepted
248+
- `ManagedCode`-prefixed public DI/setup API names that should have been cleaned up

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dotnet add package ManagedCode.MCPGateway
3030

3131
## Core Services
3232

33-
After `services.AddManagedCodeMcpGateway(...)`, the container exposes:
33+
After `services.AddMcpGateway(...)`, the container exposes:
3434

3535
- `IMcpGateway` for build, list, search, invoke, and meta-tool creation
3636
- `IMcpGatewayRegistry` for adding tools or MCP sources after the container is built
@@ -46,7 +46,7 @@ using Microsoft.Extensions.DependencyInjection;
4646

4747
var services = new ServiceCollection();
4848

49-
services.AddManagedCodeMcpGateway(options =>
49+
services.AddMcpGateway(options =>
5050
{
5151
options.AddTool(
5252
"local",
@@ -86,7 +86,7 @@ Important defaults:
8686
Register local tools during startup:
8787

8888
```csharp
89-
services.AddManagedCodeMcpGateway(options =>
89+
services.AddMcpGateway(options =>
9090
{
9191
options.AddTool(
9292
"local",
@@ -136,7 +136,7 @@ Registry updates automatically invalidate the catalog. The next list, search, or
136136
Examples:
137137

138138
```csharp
139-
services.AddManagedCodeMcpGateway(options =>
139+
services.AddMcpGateway(options =>
140140
{
141141
options.AddHttpServer(
142142
sourceId: "docs",
@@ -357,13 +357,13 @@ Manual warmup:
357357
```csharp
358358
await using var serviceProvider = services.BuildServiceProvider();
359359

360-
var build = await serviceProvider.InitializeManagedCodeMcpGatewayAsync();
360+
var build = await serviceProvider.InitializeMcpGatewayAsync();
361361
```
362362

363363
Hosted warmup:
364364

365365
```csharp
366-
services.AddManagedCodeMcpGateway(options =>
366+
services.AddMcpGateway(options =>
367367
{
368368
options.AddTool(
369369
"local",
@@ -376,7 +376,7 @@ services.AddManagedCodeMcpGateway(options =>
376376
}));
377377
});
378378

379-
services.AddManagedCodeMcpGatewayIndexWarmup();
379+
services.AddMcpGatewayIndexWarmup();
380380
```
381381

382382
## Optional Embeddings
@@ -391,7 +391,7 @@ var services = new ServiceCollection();
391391
services.AddKeyedSingleton<IEmbeddingGenerator<string, Embedding<float>>, MyEmbeddingGenerator>(
392392
McpGatewayServiceKeys.EmbeddingGenerator);
393393

394-
services.AddManagedCodeMcpGateway(options =>
394+
services.AddMcpGateway(options =>
395395
{
396396
options.AddTool(
397397
"local",
@@ -418,7 +418,7 @@ services.AddKeyedSingleton<IChatClient>(
418418
McpGatewayServiceKeys.SearchQueryChatClient,
419419
mySearchRewriteChatClient);
420420

421-
services.AddManagedCodeMcpGateway(options =>
421+
services.AddMcpGateway(options =>
422422
{
423423
options.SearchStrategy = McpGatewaySearchStrategy.Auto;
424424
options.SearchQueryNormalization = McpGatewaySearchQueryNormalization.TranslateToEnglishWhenAvailable;
@@ -459,7 +459,7 @@ services.AddSingleton<IMcpGatewayToolEmbeddingStore, MyToolEmbeddingStore>();
459459
You can also force a mode:
460460

461461
```csharp
462-
services.AddManagedCodeMcpGateway(options =>
462+
services.AddMcpGateway(options =>
463463
{
464464
options.SearchStrategy = McpGatewaySearchStrategy.Tokenizer;
465465
});
@@ -468,7 +468,7 @@ services.AddManagedCodeMcpGateway(options =>
468468
Or:
469469

470470
```csharp
471-
services.AddManagedCodeMcpGateway(options =>
471+
services.AddMcpGateway(options =>
472472
{
473473
options.SearchStrategy = McpGatewaySearchStrategy.Embeddings;
474474
});

docs/ADR/ADR-0001-runtime-boundaries-and-index-lifecycle.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ The repository needs an explicit record for these boundaries so the public packa
2020

2121
```mermaid
2222
flowchart LR
23-
Host["Host application"] --> DI["AddManagedCodeMcpGateway(...)"]
23+
Host["Host application"] --> DI["AddMcpGateway(...)"]
2424
DI --> Gateway["IMcpGateway / McpGateway"]
2525
DI --> Registry["IMcpGatewayRegistry / McpGatewayRegistry"]
2626
DI --> ToolSet["McpGatewayToolSet"]
27-
DI --> Warmup["AddManagedCodeMcpGatewayIndexWarmup()"]
27+
DI --> Warmup["AddMcpGatewayIndexWarmup()"]
2828
Gateway --> Runtime["McpGatewayRuntime"]
2929
Registry --> Snapshot["Catalog snapshots"]
3030
Runtime --> Snapshot
@@ -78,7 +78,7 @@ Cons:
7878
Positive:
7979

8080
- public DI wiring is explicit: `IMcpGateway` for runtime work, `IMcpGatewayRegistry` for catalog mutation, `McpGatewayToolSet` for meta-tools
81-
- hosts get lazy behavior by default and optional eager warmup through `InitializeManagedCodeMcpGatewayAsync()` or `AddManagedCodeMcpGatewayIndexWarmup()`
81+
- hosts get lazy behavior by default and optional eager warmup through `InitializeMcpGatewayAsync()` or `AddMcpGatewayIndexWarmup()`
8282
- cancellation now propagates into source loading, embedding generation, and embedding-store I/O during index builds
8383
- runtime rebuilds after registry mutations remain automatic without forcing every host into startup code
8484

@@ -98,7 +98,7 @@ Mitigations:
9898

9999
- `IMcpGateway` MUST remain the public runtime facade for build, list, search, invoke, and meta-tool creation.
100100
- `IMcpGatewayRegistry` MUST remain the public mutation surface for adding tools and MCP sources after container build.
101-
- `AddManagedCodeMcpGateway(...)` MUST register `IMcpGateway`, `IMcpGatewayRegistry`, and `McpGatewayToolSet`.
101+
- `AddMcpGateway(...)` MUST register `IMcpGateway`, `IMcpGatewayRegistry`, and `McpGatewayToolSet`.
102102
- Index builds MUST be lazy by default and MUST rebuild automatically after registry mutations invalidate the snapshot.
103103
- Hosted warmup MUST stay optional and MUST use the same runtime/index path as normal gateway operations.
104104
- Cancellation of `BuildIndexAsync(...)` MUST propagate into underlying source loading and embedding work.

docs/ADR/ADR-0004-process-local-embedding-store-uses-imemorycache.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Durable or distributed embedding reuse will remain the responsibility of host-pr
1616

1717
```mermaid
1818
flowchart LR
19-
Host["Host application"] --> DI["AddManagedCodeMcpGateway(...)"]
19+
Host["Host application"] --> DI["AddMcpGateway(...)"]
2020
Host --> CacheRegistration["AddMcpGatewayInMemoryToolEmbeddingStore()"]
2121
CacheRegistration --> MemoryCache["IMemoryCache"]
2222
CacheRegistration --> Store["IMcpGatewayToolEmbeddingStore"]

src/ManagedCode.MCPGateway/Internal/Runtime/Core/McpGatewayRuntime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal sealed partial class McpGatewayRuntime : IMcpGateway
4646
private const string ToolIdOrToolNameRequiredMessage = "Either ToolId or ToolName is required.";
4747
private const string ToolIdNotFoundMessageTemplate = "Tool '{0}' was not found.";
4848
private const string ToolNameAmbiguousMessageTemplate = "Tool '{0}' is ambiguous. Use ToolId or specify SourceId explicitly.";
49-
private const string CatalogSourceMissingMessage = "ManagedCode.MCPGateway requires IMcpGatewayRegistry to be registered in the service provider. Use AddManagedCodeMcpGateway(...) to wire the package services.";
49+
private const string CatalogSourceMissingMessage = "ManagedCode.MCPGateway requires IMcpGatewayRegistry to be registered in the service provider. Use AddMcpGateway(...) to wire the package services.";
5050
private const string FailedToLoadGatewaySourceLogMessage = "Failed to load gateway source {SourceId}.";
5151
private const string EmbeddingGenerationFailedLogMessage = "Gateway embedding generation failed. Falling back to lexical search.";
5252
private const string GatewayIndexRebuiltLogMessage = "Gateway index rebuilt. Tools={ToolCount} VectorizedTools={VectorizedToolCount}.";

src/ManagedCode.MCPGateway/Registration/McpGatewayServiceCollectionExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ManagedCode.MCPGateway;
88

99
public static class McpGatewayServiceCollectionExtensions
1010
{
11-
public static IServiceCollection AddManagedCodeMcpGateway(
11+
public static IServiceCollection AddMcpGateway(
1212
this IServiceCollection services,
1313
Action<McpGatewayOptions>? configure = null)
1414
{
@@ -36,7 +36,7 @@ public static IServiceCollection AddMcpGatewayInMemoryToolEmbeddingStore(this IS
3636
return services;
3737
}
3838

39-
public static IServiceCollection AddManagedCodeMcpGatewayIndexWarmup(this IServiceCollection services)
39+
public static IServiceCollection AddMcpGatewayIndexWarmup(this IServiceCollection services)
4040
{
4141
ArgumentNullException.ThrowIfNull(services);
4242

src/ManagedCode.MCPGateway/Registration/McpGatewayServiceProviderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ManagedCode.MCPGateway;
55

66
public static class McpGatewayServiceProviderExtensions
77
{
8-
public static Task<McpGatewayIndexBuildResult> InitializeManagedCodeMcpGatewayAsync(
8+
public static Task<McpGatewayIndexBuildResult> InitializeMcpGatewayAsync(
99
this IServiceProvider serviceProvider,
1010
CancellationToken cancellationToken = default)
1111
{

tests/ManagedCode.MCPGateway.Tests/Search/McpGatewayInitializationTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ namespace ManagedCode.MCPGateway.Tests;
99
public sealed partial class McpGatewaySearchTests
1010
{
1111
[TUnit.Core.Test]
12-
public async Task InitializeManagedCodeMcpGatewayAsync_BuildsIndexThroughServiceProviderExtension()
12+
public async Task InitializeMcpGatewayAsync_BuildsIndexThroughServiceProviderExtension()
1313
{
1414
await using var serviceProvider = GatewayTestServiceProviderFactory.Create(ConfigureSearchTools);
1515

16-
var buildResult = await serviceProvider.InitializeManagedCodeMcpGatewayAsync();
16+
var buildResult = await serviceProvider.InitializeMcpGatewayAsync();
1717
var gateway = serviceProvider.GetRequiredService<IMcpGateway>();
1818
var tools = await gateway.ListToolsAsync();
1919

@@ -22,13 +22,13 @@ public async Task InitializeManagedCodeMcpGatewayAsync_BuildsIndexThroughService
2222
}
2323

2424
[TUnit.Core.Test]
25-
public async Task AddManagedCodeMcpGatewayIndexWarmup_StartsBackgroundIndexBuild()
25+
public async Task AddMcpGatewayIndexWarmup_StartsBackgroundIndexBuild()
2626
{
2727
var probeGateway = new WarmupProbeGateway();
2828
var services = new ServiceCollection();
2929
services.AddLogging(static logging => logging.SetMinimumLevel(LogLevel.Debug));
3030
services.AddSingleton<IMcpGateway>(probeGateway);
31-
services.AddManagedCodeMcpGatewayIndexWarmup();
31+
services.AddMcpGatewayIndexWarmup();
3232

3333
await using var serviceProvider = services.BuildServiceProvider();
3434
var hostedServices = serviceProvider.GetServices<IHostedService>().ToList();

tests/ManagedCode.MCPGateway.Tests/Search/McpGatewaySearchBuildTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ await Task.WhenAll(Enumerable.Range(0, 40).Select(index => Task.Run(() =>
132132
}
133133

134134
[TUnit.Core.Test]
135-
public async Task AddManagedCodeMcpGateway_ResolvesRegistryAsSeparateService()
135+
public async Task AddMcpGateway_ResolvesRegistryAsSeparateService()
136136
{
137137
await using var serviceProvider = GatewayTestServiceProviderFactory.Create(options =>
138138
{
@@ -146,7 +146,7 @@ public async Task AddManagedCodeMcpGateway_ResolvesRegistryAsSeparateService()
146146
}
147147

148148
[TUnit.Core.Test]
149-
public async Task AddManagedCodeMcpGateway_RegistryAlsoActsAsCatalogSource()
149+
public async Task AddMcpGateway_RegistryAlsoActsAsCatalogSource()
150150
{
151151
await using var serviceProvider = GatewayTestServiceProviderFactory.Create(static _ => { });
152152
var registry = serviceProvider.GetRequiredService<IMcpGatewayRegistry>();
@@ -178,7 +178,7 @@ public async Task McpGateway_ThrowsClearErrorWhenRegistryServiceIsMissing()
178178
}
179179

180180
await Assert.That(exception).IsNotNull();
181-
await Assert.That(exception!.Message).Contains("AddManagedCodeMcpGateway");
181+
await Assert.That(exception!.Message).Contains("AddMcpGateway");
182182
}
183183

184184
[TUnit.Core.Test]

tests/ManagedCode.MCPGateway.Tests/Search/McpGatewaySearchVectorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public async Task SearchAsync_PrefersKeyedEmbeddingGeneratorOverUnkeyedRegistrat
104104
services.AddKeyedSingleton<IEmbeddingGenerator<string, Embedding<float>>>(
105105
McpGatewayServiceKeys.EmbeddingGenerator,
106106
keyedEmbeddingGenerator);
107-
services.AddManagedCodeMcpGateway(ConfigureSearchTools);
107+
services.AddMcpGateway(ConfigureSearchTools);
108108

109109
await using var serviceProvider = services.BuildServiceProvider();
110110
var gateway = serviceProvider.GetRequiredService<IMcpGateway>();
@@ -126,7 +126,7 @@ public async Task SearchAsync_ResolvesScopedEmbeddingGeneratorPerOperation()
126126
var services = new ServiceCollection();
127127
services.AddLogging(static logging => logging.SetMinimumLevel(LogLevel.Debug));
128128
services.AddScoped<IEmbeddingGenerator<string, Embedding<float>>>(_ => new ScopedTestEmbeddingGenerator(tracker));
129-
services.AddManagedCodeMcpGateway(ConfigureSearchTools);
129+
services.AddMcpGateway(ConfigureSearchTools);
130130

131131
await using var serviceProvider = services.BuildServiceProvider(new ServiceProviderOptions
132132
{

0 commit comments

Comments
 (0)