chore: initial commit of TaskTracker project
Existing ASP.NET API with vanilla JS SPA, WindowWatcher, Chrome extension, and MCP server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
17
TaskTracker.MCP/Program.cs
Normal file
17
TaskTracker.MCP/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
var apiBaseUrl = Environment.GetEnvironmentVariable("API_BASE_URL") ?? "http://localhost:5200";
|
||||
|
||||
builder.Services.AddSingleton(_ => new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(apiBaseUrl)
|
||||
});
|
||||
|
||||
builder.Services.AddMcpServer()
|
||||
.WithStdioServerTransport()
|
||||
.WithToolsFromAssembly();
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
16
TaskTracker.MCP/TaskTracker.MCP.csproj
Normal file
16
TaskTracker.MCP/TaskTracker.MCP.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.3" />
|
||||
<PackageReference Include="ModelContextProtocol" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
116
TaskTracker.MCP/Tools/TaskTools.cs
Normal file
116
TaskTracker.MCP/Tools/TaskTools.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using System.ComponentModel;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
namespace TaskTracker.MCP.Tools;
|
||||
|
||||
[McpServerToolType]
|
||||
public sealed class TaskTools
|
||||
{
|
||||
private static readonly JsonSerializerOptions JsonOptions = new()
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
[McpServerTool, Description("Get the currently active work task with its latest notes and recent context events")]
|
||||
public static async Task<string> GetActiveTask(HttpClient client)
|
||||
{
|
||||
var response = await client.GetAsync("/api/tasks/active");
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("List work tasks, optionally filtered by status (Pending, Active, Paused, Completed, Abandoned)")]
|
||||
public static async Task<string> ListTasks(
|
||||
HttpClient client,
|
||||
[Description("Filter by status: Pending, Active, Paused, Completed, Abandoned")] string? status = null)
|
||||
{
|
||||
var url = "/api/tasks";
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
url += $"?status={status}";
|
||||
|
||||
var response = await client.GetAsync(url);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Create a new work task")]
|
||||
public static async Task<string> CreateTask(
|
||||
HttpClient client,
|
||||
[Description("Title of the task")] string title,
|
||||
[Description("Optional description")] string? description = null,
|
||||
[Description("Optional category (e.g. Engineering, Email, LaserCutting)")] string? category = null)
|
||||
{
|
||||
var payload = new { title, description, category };
|
||||
var response = await client.PostAsJsonAsync("/api/tasks", payload, JsonOptions);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Start/activate a task by ID. Automatically pauses any currently active task.")]
|
||||
public static async Task<string> StartTask(
|
||||
HttpClient client,
|
||||
[Description("The task ID to start")] int taskId)
|
||||
{
|
||||
var response = await client.PutAsync($"/api/tasks/{taskId}/start", null);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Pause a task with an optional note about why it was paused")]
|
||||
public static async Task<string> PauseTask(
|
||||
HttpClient client,
|
||||
[Description("The task ID to pause")] int taskId,
|
||||
[Description("Optional note about why the task is being paused")] string? note = null)
|
||||
{
|
||||
var payload = new { note };
|
||||
var response = await client.PutAsJsonAsync($"/api/tasks/{taskId}/pause", payload, JsonOptions);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Resume a paused task with an optional note about context for resuming")]
|
||||
public static async Task<string> ResumeTask(
|
||||
HttpClient client,
|
||||
[Description("The task ID to resume")] int taskId,
|
||||
[Description("Optional note about context for resuming")] string? note = null)
|
||||
{
|
||||
var payload = new { note };
|
||||
var response = await client.PutAsJsonAsync($"/api/tasks/{taskId}/resume", payload, JsonOptions);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Mark a task as complete")]
|
||||
public static async Task<string> CompleteTask(
|
||||
HttpClient client,
|
||||
[Description("The task ID to complete")] int taskId)
|
||||
{
|
||||
var response = await client.PutAsync($"/api/tasks/{taskId}/complete", null);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Add a note to a task")]
|
||||
public static async Task<string> AddNote(
|
||||
HttpClient client,
|
||||
[Description("The task ID")] int taskId,
|
||||
[Description("The note content")] string content,
|
||||
[Description("Note type: General, PauseNote, or ResumeNote")] string type = "General")
|
||||
{
|
||||
var payload = new { content, type };
|
||||
var response = await client.PostAsJsonAsync($"/api/tasks/{taskId}/notes", payload, JsonOptions);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Get a summary of recent window/browser activity grouped by application, useful for understanding what the user has been working on")]
|
||||
public static async Task<string> GetContextSummary(HttpClient client)
|
||||
{
|
||||
var response = await client.GetAsync("/api/context/summary");
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
[McpServerTool, Description("Get raw context events (window switches, browser navigations) from the last N minutes")]
|
||||
public static async Task<string> GetRecentContext(
|
||||
HttpClient client,
|
||||
[Description("Number of minutes to look back (default 30)")] int minutes = 30)
|
||||
{
|
||||
var response = await client.GetAsync($"/api/context/recent?minutes={minutes}");
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user