Skip to content

feat: add MCP server with shared controller logic#1597

Open
dstotijn wants to merge 1 commit intocallumalpass:mainfrom
dstotijn:feature/mcp-server
Open

feat: add MCP server with shared controller logic#1597
dstotijn wants to merge 1 commit intocallumalpass:mainfrom
dstotijn:feature/mcp-server

Conversation

@dstotijn
Copy link

Summary

  • Add Model Context Protocol (MCP) server exposing all TaskNotes tools at /mcp endpoint, gated behind an enableMCP setting
  • Extract shared business logic from HTTP controllers into reusable utilities (timeTrackingUtils, calendarUtils, TaskStatsService.getStats()) so both HTTP controllers and MCPService call the same code — eliminating ~400 lines of duplication
  • MCPService triggers webhooks for all mutations and reuses the shared utils
  • Fixes a pre-existing bug where webhook payloads for start-with-description had stale data

MCP Tools Exposed

Tasks (CRUD, query, toggle status/archive, parse from text), time tracking (start/stop sessions, summaries), pomodoro (start/stop/pause/resume, status), calendar events, filter options, task statistics, and health check.

Note

For locally running AI agents, the mdbase-skill is likely a better fit. This in-plugin MCP endpoint is primarily useful for remote/hosted AI clients — such as Claude or ChatGPT on mobile, or other host apps that have no direct access to a vault via (bash) tool calls.

Test plan

  • Enable enableMCP in settings, verify /mcp endpoint responds to MCP protocol messages
  • Verify existing HTTP API still works unchanged
  • Test MCP tools for tasks, time tracking, pomodoro, and calendar
  • Confirm webhooks fire for MCP mutations
  • Verify the setting toggle enables/disables the MCP endpoint at runtime

🤖 Generated with Claude Code

Add Model Context Protocol server exposing TaskNotes tools at /mcp
endpoint behind an enableMCP setting. Extract shared business logic
from HTTP controllers into reusable utilities so both controllers
and MCPService call the same code:

- timeTrackingUtils: active sessions, time summary, task time data
- calendarUtils: event collection, filtering, provider detection
- TaskStatsService.getStats(): unified task statistics

MCPService triggers webhooks for all mutations and reuses the shared
utils, eliminating ~400 lines of duplication. Also fixes a pre-existing
bug where webhook payloads for start-with-description had stale data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant