Implemented 6 core MCP Resources for read-only AI agent access to ColaFlow data:
- projects.list - List all projects in current tenant
- projects.get/{id} - Get project details with full hierarchy
- issues.search - Search issues (Epics, Stories, Tasks) with filters
- issues.get/{id} - Get issue details (Epic/Story/Task)
- sprints.current - Get currently active Sprint(s)
- users.list - List team members in current tenant
Changes:
- Created IMcpResource interface and related DTOs (McpResourceRequest, McpResourceContent, McpResourceDescriptor)
- Implemented IMcpResourceRegistry and McpResourceRegistry for resource discovery and routing
- Created ResourcesReadMethodHandler for handling resources/read MCP method
- Updated ResourcesListMethodHandler to return actual resource catalog
- Implemented 6 concrete resource classes with multi-tenant isolation
- Registered all resources and handlers in McpServiceExtensions
- Added module references (ProjectManagement, Identity, IssueManagement domains)
- Updated package versions to 9.0.1 for consistency
- Created comprehensive unit tests (188 tests passing)
- Tests cover resource registry, URI matching, resource content generation
Technical Details:
- Multi-tenant isolation using TenantContext.GetCurrentTenantId()
- Resource URI routing supports templates (e.g., {id} parameters)
- Uses read-only repository queries (AsNoTracking) for performance
- JSON serialization with System.Text.Json
- Proper error handling with McpNotFoundException, McpInvalidParamsException
- Supports query parameters for filtering and pagination
- Auto-registration of resources at startup
Test Coverage:
- Resource registry tests (URI matching, registration, descriptors)
- Resource content generation tests
- Multi-tenant isolation verification
- All 188 tests passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
namespace ColaFlow.Modules.Mcp.Contracts.Resources;
|
|
|
|
/// <summary>
|
|
/// Interface for MCP Resources
|
|
/// Resources provide read-only data to AI agents through the MCP protocol
|
|
/// </summary>
|
|
public interface IMcpResource
|
|
{
|
|
/// <summary>
|
|
/// Resource URI (e.g., "colaflow://projects.list")
|
|
/// </summary>
|
|
string Uri { get; }
|
|
|
|
/// <summary>
|
|
/// Resource display name
|
|
/// </summary>
|
|
string Name { get; }
|
|
|
|
/// <summary>
|
|
/// Resource description
|
|
/// </summary>
|
|
string Description { get; }
|
|
|
|
/// <summary>
|
|
/// MIME type of the resource content (typically "application/json")
|
|
/// </summary>
|
|
string MimeType { get; }
|
|
|
|
/// <summary>
|
|
/// Get resource content
|
|
/// </summary>
|
|
/// <param name="request">Resource request with URI and parameters</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>Resource content</returns>
|
|
Task<McpResourceContent> GetContentAsync(
|
|
McpResourceRequest request,
|
|
CancellationToken cancellationToken);
|
|
}
|