Is there a way to run multiple stateful MCP servers?
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
- Lĩnh vực
- api, backend, distributed-systems
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ả
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
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/csharp-sdk
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
modelcontextprotocol/csharp-sdk#678 · 1 bình luận ·
-
enhancement needs confirmation P3 ready for work
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/csharp-sdk#515 · 6 bình luận · 3 reaction ·
Tất cả issue của modelcontextprotocol/csharp-sdk
Issue tương tự
-
effort:S P3 refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nightscout/nocturne#1532 ·
-
core dependencies
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
C#/.NET Roslyn LSP Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Suspicious code fragments Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DotNetNext/SqlSugar#1458 ·