Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[MCP] Move IMcpStorage to abstractions and add StorageFactory delegate - #9631

#9631
Merged
tobias-tengler merged 3 commits into
mainChilliCream/graphql-platform:mainfrom
tte/align-mcp-configuration-to-openapiChilliCream/graphql-platform:tte/align-mcp-configuration-to-openapiCopy head branch name to clipboard
May 1, 2026
Merged

[MCP] Move IMcpStorage to abstractions and add StorageFactory delegate#9631
tobias-tengler merged 3 commits into
mainChilliCream/graphql-platform:mainfrom
tte/align-mcp-configuration-to-openapiChilliCream/graphql-platform:tte/align-mcp-configuration-to-openapiCopy head branch name to clipboard

Conversation

@tobias-tengler

Copy link
Copy Markdown
Member

No description provided.

@tobias-tengler
tobias-tengler marked this pull request as ready for review May 1, 2026 12:26
Copilot AI review requested due to automatic review settings May 1, 2026 12:26
@tobias-tengler
tobias-tengler merged commit 684dd3a into main May 1, 2026
141 of 143 checks passed
@tobias-tengler
tobias-tengler deleted the tte/align-mcp-configuration-to-openapi branch May 1, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors MCP storage registration by moving IMcpStorage (and related types) into the MCP abstractions package and switching MCP setup to use an options-based StorageFactory delegate, while also tightening misconfiguration diagnostics (OpenAPI + MCP) and adding coverage for these failure modes.

Changes:

  • Introduces McpSetup.StorageFactory and updates MCP builder extensions (regular + Fusion) to configure storage via named options instead of DI registration.
  • Updates McpManager/schema service wiring and endpoint mapping to throw clearer InvalidOperationExceptions when required setup is missing; adds tests for these cases.
  • Moves MCP storage DTOs + resources into Adapters.Mcp.Abstractions (including IMcpStorage, tool/prompt definitions, and resx resources).

Reviewed changes

Copilot reviewed 15 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Extensions/OpenApiSetupTests.cs Adds test asserting OpenAPI manager throws when storage is not configured.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/HttpEndpointIntegrationTests.cs Adds integration test asserting endpoint mapping fails when AddOpenApi() wasn’t called.
src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/Extensions/McpSetupTests.cs Adds test asserting MCP manager throws when storage is not configured.
src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs Adds integration test asserting endpoint mapping fails when AddMcp() wasn’t called.
src/HotChocolate/Adapters/src/Fusion.Adapters.Mcp/Extensions/FusionGatewayBuilderExtensions.cs Refactors Fusion MCP registration to add warmup + configure storage via McpSetup.StorageFactory.
src/HotChocolate/Adapters/src/Adapters.OpenApi.Core/OpenApiManager.cs Updates missing-storage exception message to reference IOpenApiDefinitionStorage and new guidance text.
src/HotChocolate/Adapters/src/Adapters.OpenApi.AspNetCore/Extensions/OpenApiEndpointRouteBuilderExtensions.cs Adds explicit error when endpoints are mapped without OpenAPI services registered.
src/HotChocolate/Adapters/src/Adapters.Mcp/Extensions/McpRequestExecutorBuilderExtensions.cs Refactors MCP registration and storage configuration via McpSetup.StorageFactory; adds warmup task + skipIf.
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpRegistration.cs Extends registration to carry the schema’s IMcpStorage instance.
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpManager.cs Creates storage from StorageFactory, includes it in registrations, and disposes it on manager disposal.
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/HotChocolate.Adapters.Mcp.Core.csproj Removes embedded resource configuration (resources moved to abstractions).
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/ServiceCollectionExtensions.cs Updates schema service wiring to source storage via McpManager rather than DI IMcpStorage registration.
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/McpEndpointRouteBuilderExtensions.cs Updates missing-service exception message when mapping MCP endpoints without AddMcp().
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Storage/PromptStorageEventArgs.cs Adds new abstractions type for prompt storage change notifications.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Storage/PromptDefinition.cs Adds prompt definition abstraction.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Storage/OperationToolStorageEventArgs.cs Adds new abstractions type for tool storage change notifications.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Storage/OperationToolDefinition.cs Adds operation-tool definition abstraction (including validation and view resource URI calculation).
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Storage/IMcpStorage.cs Adds IMcpStorage abstraction (observable + async retrieval APIs).
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Properties/McpAdapterResources.resx Adds resource strings moved into abstractions.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Properties/McpAdapterResources.Designer.cs Adds generated strongly-typed resource accessor moved into abstractions.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/HotChocolate.Adapters.Mcp.Abstractions.csproj Adds resx embedding + internal visibility to downstream MCP assemblies.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Extensions/StringExtensions.cs Adds shared string casing/formatting helpers to abstractions.
src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Configuration/McpSetup.cs Adds StorageFactory to MCP per-schema setup options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to +100
var registration = lazy.Value;

if (registration.Storage is IDisposable disposableStorage)
{
disposableStorage.Dispose();
}

registration.ExecutorProxy.Dispose();

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

McpManager.Dispose() disposes IMcpStorage only when it implements IDisposable. If a storage implementation uses IAsyncDisposable (common for I/O resources), it will never be disposed, which can leak handles/watchers/connections. Consider adding async disposal support (e.g., implement IAsyncDisposable on McpManager and dispose async storages) or explicitly document/enforce IDisposable on IMcpStorage implementations.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.