-
Notifications
You must be signed in to change notification settings - Fork 0
Add MCP server implementation in C# with HTTP transport and modern attributes #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: dkhalife <[email protected]>
Co-authored-by: dkhalife <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@copilot address the following feedback: |
Co-authored-by: dkhalife <[email protected]>
Addressed all feedback in commit 9f6ae76:
|
|
@copilot move all the contents of TaskWizardMcpServer into the parent folder (mcpserver) and remove TaskWizardMcpServer altogether |
Co-authored-by: dkhalife <[email protected]>
Done in commit 1a8f7c2. Moved all contents from |
dkhalife
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot do not add a readme for the mcpserver directory
Co-authored-by: dkhalife <[email protected]>
Removed README from mcpserver directory in commit 7d4b8f1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a complete Model Context Protocol (MCP) server implementation in C# that exposes Task Wizard's tasks and labels through MCP tools. The server uses the official ModelContextProtocol.AspNetCore SDK with HTTP transport and provides a proof-of-concept with stub data for demonstration purposes.
- Implements 10 CRUD tools (5 for tasks, 5 for labels) using modern C# attributes
- Uses HTTP transport on localhost:3001 for broader compatibility
- Includes in-memory stub data service with pre-populated sample data
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| mcpserver/Tools/TaskTools.cs | Implements task CRUD tools with MCP attributes |
| mcpserver/Tools/LabelTools.cs | Implements label CRUD tools with MCP attributes |
| mcpserver/TaskWizardMcpServer.csproj | .NET 9.0 project configuration with MCP SDK dependency |
| mcpserver/Services/StubDataService.cs | In-memory data service with sample tasks and labels |
| mcpserver/Program.cs | MCP server configuration with HTTP transport |
| mcpserver/Models/Task.cs | Task model and request DTOs |
| mcpserver/Models/Label.cs | Label model and request DTOs |
| mcpserver/.gitignore | Standard .NET build artifacts exclusions |
| .github/workflows/dotnet-build.yml | CI/CD workflow for automated .NET builds |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| Labels = request.Labels.Select(id => _labels.FirstOrDefault(l => l.Id == id)) | ||
| .Where(l => l != null) | ||
| .Cast<Label>() | ||
| .ToList() |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null filtering and casting pattern is repeated in both CreateTask and UpdateTask methods. Consider extracting this logic into a private helper method like GetLabelsById(IEnumerable<int> labelIds) to reduce code duplication.
| task.Labels = request.Labels.Select(id => _labels.FirstOrDefault(l => l.Id == id)) | ||
| .Where(l => l != null) | ||
| .Cast<Label>() | ||
| .ToList(); |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null filtering and casting pattern is repeated in both CreateTask and UpdateTask methods. Consider extracting this logic into a private helper method like GetLabelsById(IEnumerable<int> labelIds) to reduce code duplication.
Overview
This PR adds a Model Context Protocol (MCP) server implementation in C# using the official ModelContextProtocol SDK. The server is located in a new
mcpserverdirectory and provides a proof-of-concept implementation that exposes Task Wizard's tasks and labels as MCP tools.Implementation
The MCP server is built with:
Features
Tools
The server provides 10 CRUD tools for interacting with tasks and labels using modern C# attributes:
Task Tools:
ListTasks- List all tasksGetTask- Get a specific task by IDCreateTask- Create a new task with title, dates, frequency, and labelsUpdateTask- Update an existing taskDeleteTask- Delete a task by IDLabel Tools:
ListLabels- List all labelsGetLabel- Get a specific label by IDCreateLabel- Create a new label with name and colorUpdateLabel- Update an existing labelDeleteLabel- Delete a label by IDProject Structure
Usage
The server runs on
http://localhost:3001and communicates using HTTP transport for the MCP protocol.Design Decisions
TaskWizard.McpServeras the root namespace[McpServerTool]and[Description]attributes for cleaner, more maintainable codeapiserver/internal/models/mcpserverdirectory for cleaner organizationCI/CD
A GitHub Actions workflow is included at
.github/workflows/dotnet-build.ymlthat automatically builds the .NET project on push and pull requests to the main branch.Testing
Future Enhancements
The stub implementation provides a foundation for future enhancements:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.