Skip to content

Conversation

@MackinnonBuck
Copy link
Collaborator

Opening initially as a draft until #1077 gets merged

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is ModelContextProtocol.Core the right assembly for this, or should it instead live in ModelContextProtocol or ModelContextProtocol.AspNetCore?

streamId = string.Empty;
sequence = 0;

var parts = eventId.Split(Separator);
Copy link
Contributor

Choose a reason for hiding this comment

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

On Core you could use the span-based Split, which would avoid the string[] and also avoid needing to materialize strings for parts[0]/[1]/[2].

// Base64-encode session and stream IDs so the event ID can be parsed
// even if the original IDs contain the ':' separator character
var sessionBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(sessionId));
var streamBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(streamId));
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate from this PR, we should really add Base64 overloads that handle this without the intermediate byte[]. I will follow up.

/// </summary>
internal static class CacheKeys
{
private const string Prefix = "mcp:sse:";
Copy link
Contributor

Choose a reason for hiding this comment

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

If we wanted to ship a new version that breaks the caching format and thus should ignore existing entries, how would we version it? change this prefix to include a version number?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants