feat(mcp): add async task support for long-running operations (#485)#487
Merged
feat(mcp): add async task support for long-running operations (#485)#487
Conversation
Adds opt-in async execution to index_document (submit-document), reindex_library (reindex-documents), install_pack (install-pack), and all sync_connector tools (sync-slack, sync-notion, sync-confluence, sync-obsidian-vault, sync-onenote). - New `src/mcp/tasks.ts`: in-memory TaskRegistry with AbortController- based cancellation, 1-hour TTL pruning, and progress tracking - `async: true` parameter on all 7 long-running tools returns a task ID immediately; reindex and install-pack report chunk/doc progress - New `get-task` MCP tool to poll status, progress, and result - New `cancel-task` MCP tool to abort pending/running tasks - 24 new unit tests covering the full task lifecycle Backward compatible: omitting `async` preserves existing synchronous behaviour. https://claude.ai/code/session_01HRL3F1CRkRw35sUtU1eot3
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…r.ts Extend startAsyncTask to pass signal and onProgress to the work function, then replace the inline reindex_library and install_pack async blocks (which duplicated the task create/update/result pattern) with calls to the shared helper. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Adds opt-in async execution to index_document (submit-document), reindex_library (reindex-documents), install_pack (install-pack), and all sync_connector tools (sync-slack, sync-notion, sync-confluence, sync-obsidian-vault, sync-onenote).
src/mcp/tasks.ts: in-memory TaskRegistry with AbortController- based cancellation, 1-hour TTL pruning, and progress trackingasync: trueparameter on all 7 long-running tools returns a task ID immediately; reindex and install-pack report chunk/doc progressget-taskMCP tool to poll status, progress, and resultcancel-taskMCP tool to abort pending/running tasksBackward compatible: omitting
asyncpreserves existing synchronous behaviour.https://claude.ai/code/session_01HRL3F1CRkRw35sUtU1eot3