12 KiB
story_id, sprint_id, parent_story_id, status, priority, assignee, created_date, estimated_days, phase
| story_id | sprint_id | parent_story_id | status | priority | assignee | created_date | estimated_days | phase |
|---|---|---|---|---|---|---|---|---|
| story_13 | sprint_5 | story_0 | not_started | P0 | backend | 2025-11-09 | 10 | 1 |
Story 13: MCP SDK Foundation & Proof of Concept
Parent Epic: Story 0 - Integrate Microsoft .NET MCP SDK Phase: 1 - Foundation (Week 1-2) Priority: P0 - Critical Estimated Effort: 10 days (2 weeks)
User Story
As a backend developer, I want to install and validate the Microsoft .NET MCP SDK, So that we can confidently migrate from custom MCP implementation to the official SDK.
Business Value
- Risk Mitigation: Validate SDK compatibility before committing to full migration
- Performance Baseline: Establish performance metrics for comparison
- Team Readiness: Train team on SDK APIs and patterns
- Decision Validation: Confirm hybrid architecture approach is viable
Acceptance Criteria
- Microsoft .NET MCP SDK installed from NuGet
- PoC Tool successfully registered using
[McpTool]attribute - PoC Resource successfully registered using
[McpResource]attribute - PoC validated with Claude Desktop (stdio transport)
- Performance baseline recorded (response time, throughput, memory)
- Compatibility verified with existing Clean Architecture
- Team training completed (2-hour workshop)
- Migration guide document created
Technical Scope
1. SDK Installation & Configuration
Goal: Install SDK and configure basic infrastructure
Tasks:
- Add NuGet package reference
- Configure SDK services in DI container
- Setup basic transport (stdio only for PoC)
- Verify SDK initialization
Expected Changes:
// ColaFlow.Modules.Mcp.csproj
<PackageReference Include="Microsoft.MCP" Version="1.0.0" />
<PackageReference Include="Microsoft.MCP.Server" Version="1.0.0" />
// Program.cs or Startup.cs
services.AddMcpServer(options =>
{
options.UseStdioTransport(); // PoC only
options.DiscoverToolsAndResources(); // Auto-discovery
});
2. PoC Tool Implementation
Goal: Create one Tool using SDK to validate approach
PoC Tool: ping (simple echo tool for testing)
Implementation:
// ColaFlow.Modules.Mcp/Tools/PingTool.cs
using Microsoft.MCP;
[McpTool(
Name = "ping",
Description = "Test tool that echoes back the input message"
)]
public class PingTool
{
[McpToolParameter(
Name = "message",
Description = "Message to echo back",
Required = true
)]
public string Message { get; set; } = string.Empty;
[McpToolParameter(
Name = "delay_ms",
Description = "Optional delay in milliseconds",
Required = false
)]
public int? DelayMs { get; set; }
public async Task<McpToolResult> ExecuteAsync(
McpContext context,
CancellationToken cancellationToken)
{
if (DelayMs.HasValue)
{
await Task.Delay(DelayMs.Value, cancellationToken);
}
return McpToolResult.Success(new
{
Echo = Message,
Timestamp = DateTime.UtcNow,
TenantId = context.TenantId, // Verify tenant context works
UserId = context.UserId
});
}
}
Validation Steps:
- Register tool (automatic via SDK discovery)
- Call tool from Claude Desktop
- Verify response correctness
- Measure performance
3. PoC Resource Implementation
Goal: Create one Resource using SDK to validate approach
PoC Resource: system.info (system metadata)
Implementation:
// ColaFlow.Modules.Mcp/Resources/SystemInfoResource.cs
using Microsoft.MCP;
[McpResource(
Uri = "colaflow://system.info",
Name = "System Information",
Description = "Get ColaFlow system metadata and health status",
MimeType = "application/json"
)]
public class SystemInfoResource
{
private readonly ITenantContext _tenantContext;
private readonly IConfiguration _config;
public SystemInfoResource(
ITenantContext tenantContext,
IConfiguration config)
{
_tenantContext = tenantContext;
_config = config;
}
public async Task<McpResourceContent> GetContentAsync(
McpContext context,
CancellationToken cancellationToken)
{
var info = new
{
Version = "1.0.0",
Environment = _config["Environment"],
TenantId = _tenantContext.CurrentTenantId,
ServerTime = DateTime.UtcNow,
Uptime = GetUptime()
};
return McpResourceContent.Json(info);
}
private TimeSpan GetUptime()
{
return DateTime.UtcNow - Process.GetCurrentProcess().StartTime;
}
}
Validation Steps:
- Register resource (automatic via SDK discovery)
- Query resource from Claude Desktop
- Verify JSON response format
- Verify tenant context isolation
4. Claude Desktop Integration Testing
Goal: Validate SDK works with real MCP client
Setup:
- Configure Claude Desktop MCP client
- Add ColaFlow as MCP server in config
- Test Tool and Resource calls
- Verify error handling
Claude Desktop Config (claude_desktop_config.json):
{
"mcpServers": {
"colaflow-poc": {
"command": "dotnet",
"args": ["run", "--project", "ColaFlow.Modules.Mcp"],
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Test Cases:
- Tool Call:
pingwith message "Hello MCP SDK" - Resource Query:
colaflow://system.info - Error Handling: Invalid tool parameters
- Multi-Tenant: Verify tenant isolation
5. Performance Baseline Benchmarking
Goal: Establish baseline metrics for comparison
Metrics to Measure:
- Tool Execution Time (P50, P95, P99)
- Resource Query Time (P50, P95, P99)
- Memory Usage (baseline, peak)
- Throughput (requests/second)
- SDK Overhead (protocol parsing time)
Benchmark Tool: BenchmarkDotNet
Benchmark Implementation:
[MemoryDiagnoser]
[MinColumn, MaxColumn, MeanColumn, MedianColumn]
public class McpSdkBenchmarks
{
private PingTool _tool = null!;
private SystemInfoResource _resource = null!;
[GlobalSetup]
public void Setup()
{
_tool = new PingTool();
_resource = new SystemInfoResource(...);
}
[Benchmark]
public async Task<McpToolResult> ExecutePingTool()
{
return await _tool.ExecuteAsync(
new McpContext { TenantId = Guid.NewGuid() },
CancellationToken.None);
}
[Benchmark]
public async Task<McpResourceContent> QuerySystemInfo()
{
return await _resource.GetContentAsync(
new McpContext { TenantId = Guid.NewGuid() },
CancellationToken.None);
}
}
Expected Baseline (custom implementation):
- Tool execution: 150-200ms (P95)
- Resource query: 80-120ms (P95)
- Throughput: 70 req/s
- Memory: 150-200 MB baseline
6. Compatibility Verification
Goal: Ensure SDK doesn't break existing architecture
Checks:
- DI Container: SDK services register without conflicts
- Clean Architecture: SDK fits into Infrastructure layer
- CQRS Pattern: SDK doesn't interfere with MediatR
- Multi-Tenant: TenantContext injection works
- Authentication: API Key middleware compatible
Compatibility Matrix:
| Component | SDK Compatible? | Notes |
|---|---|---|
| ASP.NET Core DI | ✅ Yes | SDK uses standard DI |
| MediatR CQRS | ✅ Yes | No conflicts |
| EF Core | ✅ Yes | No database layer changes |
| SignalR | ✅ Yes | Independent layers |
| TenantContext | ⚠️ Verify | Need custom integration |
| API Key Auth | ⚠️ Verify | Need custom middleware |
| Redis Cache | ✅ Yes | No conflicts |
7. Team Training
Goal: Educate team on SDK usage
Training Workshop (2 hours):
-
SDK Overview (30 min)
- Architecture
- Attribute system
- Tool/Resource lifecycle
-
Hands-On Coding (60 min)
- Create a simple Tool
- Create a simple Resource
- Test with Claude Desktop
-
Q&A and Discussion (30 min)
- Migration concerns
- Hybrid architecture strategy
- Timeline and responsibilities
Training Materials:
- Slide deck (20 slides)
- Code examples repository
- Migration guide document
- FAQ document
Tasks Breakdown
- Task 1 - Install SDK and configure infrastructure - 1 day
- Task 2 - Implement PoC Tool (ping) - 1 day
- Task 3 - Implement PoC Resource (system.info) - 1 day
- Task 4 - Claude Desktop integration testing - 2 days
- Task 5 - Performance baseline benchmarking - 2 days
- Task 6 - Compatibility verification testing - 1 day
- Task 7 - Team training and documentation - 2 days
Progress: 0/7 tasks completed (0%)
Deliverables
-
Code:
- SDK NuGet packages installed
PingTool.cs(PoC Tool)SystemInfoResource.cs(PoC Resource)- Benchmark suite
-
Documentation:
- SDK Integration Guide (10 pages)
- Performance Baseline Report (5 pages)
- Compatibility Matrix (1 page)
- Training slide deck (20 slides)
-
Test Results:
- Claude Desktop integration test report
- Benchmark results (charts and tables)
- Compatibility verification report
Testing Strategy
Unit Tests
- PoC Tool parameter validation
- PoC Resource JSON serialization
- Error handling edge cases
Integration Tests
- Claude Desktop Tool call (stdio transport)
- Claude Desktop Resource query
- Error response handling
Performance Tests
- BenchmarkDotNet suite
- Memory profiling
- Throughput testing (100 concurrent requests)
Risks & Mitigation
| Risk ID | Description | Mitigation |
|---|---|---|
| RISK-013-1 | SDK incompatible with Clean Architecture | Early PoC will reveal issues, can adjust approach |
| RISK-013-2 | Performance worse than custom implementation | Benchmark early, can optimize or abort migration |
| RISK-013-3 | TenantContext integration doesn't work | Custom middleware can bridge the gap |
| RISK-013-4 | Claude Desktop connection fails | Test with multiple clients (Continue, Cline) |
| RISK-013-5 | Team learning curve too steep | Provide comprehensive training and pair programming |
Success Criteria
Technical Success
- PoC Tool and Resource work end-to-end
- Performance baseline recorded
- Zero compatibility conflicts found
- Claude Desktop integration successful
Team Success
- All team members complete training
- Team confident in SDK approach (survey: >80% confidence)
- Migration guide reviewed and approved
Decision Gate
GO/NO-GO Decision: After this story completes, team decides:
- ✅ GO: Proceed with full migration (Stories 14-17)
- ❌ NO-GO: Abort migration, keep custom implementation
Decision Criteria:
- Performance acceptable (>=baseline or <10% regression)
- Compatibility verified (zero blocking issues)
- Team confident (>80% in survey)
- No CRITICAL risks identified
Definition of Done
- SDK installed and configured
- PoC Tool works (tested with Claude Desktop)
- PoC Resource works (tested with Claude Desktop)
- Performance baseline documented
- Compatibility matrix complete (all green or yellow)
- Team training conducted (100% attendance)
- Migration guide reviewed and approved
- Code reviewed by architect
- GO/NO-GO decision made and documented
Related Documents
- Epic Story 0 - MCP SDK Migration Epic
- Research Report
- Sprint 5 Plan
Created: 2025-11-09 by Product Manager Agent Owner: Backend Team Lead Start Date: 2025-11-27 (Week 1 of Sprint 5 Extension) Target Date: 2025-12-06 (End of Week 2) Status: Not Started