Skip to content

Extensions are not being deserialized into server capabilities #1398

@darena-mhaque

Description

@darena-mhaque

Describe the bug
When setting extensions in server capabilities, they are not being included in the initialize message.

To Reproduce
Steps to reproduce the behavior:

  1. Start up a very minimal asp.net server with the following (add an extension):
using System.Text.Json.Nodes;
using ModelContextProtocol.Protocol;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
builder
    .Services.AddMcpServer(options =>
    {
        options.Capabilities ??= new ServerCapabilities();

#pragma warning disable MCPEXP001
        options.Capabilities.Extensions ??= new Dictionary<string, object>();
        options.Capabilities.Extensions.Add("io.myext", new JsonObject { ["required"] = true });
#pragma warning restore MCPEXP001
    })
    .WithHttpTransport();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
}

app.UseHttpsRedirection();
app.MapMcp("/mcp");
app.Run();
  1. Use postman, send a json request. Observe extensions are not included:
Image

Expected behavior
The server capabilities should have the extensions property, which should include io.myext as configured.

Logs

Additional context

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions