feat(backend): Implement Story 5.6 - Resource Registration & Discovery
Implemented pluggable resource registration and auto-discovery mechanism for MCP Resources. Changes: - Enhanced McpResourceDescriptor with metadata (Category, Version, Parameters, Examples, Tags, IsEnabled) - Created ResourceDiscoveryService for Assembly scanning and auto-discovery - Updated McpResourceRegistry with category support and grouping methods - Enhanced ResourcesListMethodHandler to return categorized resources with full metadata - Created ResourceHealthCheckHandler for resource availability verification - Updated all existing Resources (Projects, Issues, Sprints, Users) with Categories and Versions - Updated McpServiceExtensions to use auto-discovery at startup - Added comprehensive unit tests for discovery and health check Features: ✅ New Resources automatically discovered via Assembly scanning ✅ Resources organized by category (Projects, Issues, Sprints, Users) ✅ Rich metadata for documentation (parameters, examples, tags) ✅ Health check endpoint (resources/health) for monitoring ✅ Thread-safe registry operations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,35 @@ public interface IMcpResource
|
||||
/// </summary>
|
||||
string MimeType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Resource category (e.g., "Projects", "Issues", "Sprints", "Users")
|
||||
/// Default: "General"
|
||||
/// </summary>
|
||||
string Category => "General";
|
||||
|
||||
/// <summary>
|
||||
/// Resource version (for future compatibility)
|
||||
/// Default: "1.0"
|
||||
/// </summary>
|
||||
string Version => "1.0";
|
||||
|
||||
/// <summary>
|
||||
/// Get resource descriptor with full metadata
|
||||
/// </summary>
|
||||
McpResourceDescriptor GetDescriptor()
|
||||
{
|
||||
return new McpResourceDescriptor
|
||||
{
|
||||
Uri = Uri,
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
MimeType = MimeType,
|
||||
Category = Category,
|
||||
Version = Version,
|
||||
IsEnabled = true
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get resource content
|
||||
/// </summary>
|
||||
|
||||
@@ -2,11 +2,12 @@ namespace ColaFlow.Modules.Mcp.Contracts.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Descriptor for an MCP Resource (used in resources/list)
|
||||
/// Enhanced with metadata for better discovery and documentation
|
||||
/// </summary>
|
||||
public class McpResourceDescriptor
|
||||
{
|
||||
/// <summary>
|
||||
/// Resource URI
|
||||
/// Resource URI (e.g., "colaflow://projects.list")
|
||||
/// </summary>
|
||||
public string Uri { get; set; } = string.Empty;
|
||||
|
||||
@@ -21,7 +22,38 @@ public class McpResourceDescriptor
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// MIME type
|
||||
/// MIME type (default: "application/json")
|
||||
/// </summary>
|
||||
public string MimeType { get; set; } = "application/json";
|
||||
|
||||
/// <summary>
|
||||
/// Resource category for organization (e.g., "Projects", "Issues", "Sprints", "Users")
|
||||
/// </summary>
|
||||
public string Category { get; set; } = "General";
|
||||
|
||||
/// <summary>
|
||||
/// Resource version (for future compatibility)
|
||||
/// </summary>
|
||||
public string Version { get; set; } = "1.0";
|
||||
|
||||
/// <summary>
|
||||
/// Parameters accepted by this resource (for documentation)
|
||||
/// Key: parameter name, Value: parameter description
|
||||
/// </summary>
|
||||
public Dictionary<string, string>? Parameters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Usage examples (for documentation)
|
||||
/// </summary>
|
||||
public List<string>? Examples { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Tags for additional categorization
|
||||
/// </summary>
|
||||
public List<string>? Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this resource is enabled
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user