Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Is there a way to run multiple stateful MCP servers?

Đang mở
#814 4 bình luận 4 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp, redis

Hướng nghiên cứu

Bắt đầu với StatefulSessionManager và các điểm vào ISessionStorage, SessionMiddleware và MapMcp được nêu trong issue. Theo dõi cách các ID phiên được lưu trữ và truy xuất trên nhiều phiên bản máy chủ, sau đó xác định hành vi lưu trữ dùng chung nào là cần thiết để nhiều máy chủ MCP có trạng thái không còn tạo ra lỗi "Session id not found".

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement needs confirmation

As the title says, is there anyway to operate multiple stateful MCP servers without running into "Session id not found" errors?

It looks like the "session id not found" error stems from caching session ids in an in-memory dictionary in StatefulSessionManager. Is there a way in the API to, may be, swap that with Redis or use AspNetCore's default session management with a shared cache with the MCP server?

Something along the lines of (which is not working at the moment)

class Program
{
    static void Main(string[] args)
    {
        var builder = WebApplication.CreateBuilder(args);

        builder.Services.Configure<SessionSettings>(
            builder.Configuration.GetSection(SessionSettings.SectionName));

        var sessionConfig = builder.Configuration
            .GetSection(SessionSettings.SectionName)
            .Get<SessionSettings>() ?? new SessionSettings();

        if (sessionConfig.StorageType.Equals("Redis", StringComparison.OrdinalIgnoreCase))
        {
            if (string.IsNullOrEmpty(sessionConfig.RedisConnectionString))
                throw new InvalidOperationException("Redis connection string is required");
            builder.Services.AddSingleton<ISessionStorage>(_ =>
                new RedisSessionStorage(sessionConfig.RedisConnectionString));
        }

        builder.Services.AddMcpServer()
            .WithHttpTransport()
            .WithToolsFromAssembly();

        var app = builder.Build();

        app.UseMiddleware<SessionMiddleware>();
        app.MapMcp();
        app.Run("http://localhost:3000");
    }
}
Ngôn ngữ chính
C#
Star
4.5k
Fork
814
Merge trung bình
9 ngày 19 giờ
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/csharp-sdk

Tất cả issue của modelcontextprotocol/csharp-sdk

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.