feat: add MCP server support for external AI tools#101
Open
4regab wants to merge 5 commits into
Open
Conversation
Co-authored-by: James Gabriele <178603515+4regab@users.noreply.github.com>
Co-authored-by: James Gabriele <178603515+4regab@users.noreply.github.com>
Co-authored-by: James Gabriele <178603515+4regab@users.noreply.github.com>
Address review issues: - Issue 1 (CRITICAL): StdioServerTransport cannot work inside VS Code extension host. Converted MCP server to a standalone spawnable script (dist/mcp-server.js) that AI tools launch directly. The script uses StdioServerTransport for MCP communication and connects back to the extension's remote WebSocket server to relay ask_user requests. - Issue 2: Removed dead mcpServerName and mcpEnabled config settings. The standalone script uses internal constants (YAGNI). - Issue 3: Eliminated per-call EventEmitter leak. The standalone process communicates via WebSocket, no longer using askUser() in-process. - Issue 4: Added try/catch in tool handler returning isError: true with structured error JSON on failure. - Issue 5: Hardcoded version left as-is (YAGNI). Changes: - Rewrote src/mcp/mcpServer.ts as standalone entry point with CLI args (--port, --pin) and WebSocket bridge to extension - Removed src/mcp/mcpTypes.ts and src/mcp/index.ts (no longer needed) - Removed McpServerManager from extension.ts, added copyMcpConfig command - Added mcpAskUser message handler in remoteServer.ts - Added second esbuild entry point for dist/mcp-server.js - Updated package.json: removed mcpEnabled/mcpServerName/toggleMcp, added copyMcpConfig command - Rewrote tests for new standalone WebSocket-based architecture Co-authored-by: James Gabriele <178603515+4regab@users.noreply.github.com>
- Include --pin in copyMcpConfig when remote server is running - Show warning if remote server not started when copying MCP config - Fail fast with clear error when requireAuth arrives without PIN - Guard ws.send() calls in mcpAskUser handler with readyState check - Add test for missing PIN fail-fast behavior Co-authored-by: James Gabriele <178603515+4regab@users.noreply.github.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.
This pull request was generated by @kiro-agent 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent
Summary
Closes #100
Adds Model Context Protocol (MCP) support to the TaskSync VS Code extension, enabling it to work with AI tools beyond GitHub Copilot (Claude Desktop, Cursor, Windsurf, etc.).
Architecture
The MCP server is a standalone spawnable Node.js script (
dist/mcp-server.js) that:ask_userrequestsChanges
src/mcp/mcpServer.ts- Standalone MCP server withask_usertool, WebSocket relay, PIN authentication, fail-fast error handlingsrc/mcp/mcpServer.test.ts- 12 unit tests covering tool handler, auth flows, error paths, CLI arg parsingsrc/server/remoteServer.ts- AddedmcpAskUserWebSocket message handler with disconnect safety guardssrc/extension.ts- Addedtasksync.copyMcpConfigcommand for easy config copy to clipboardesbuild.js- Second build entry fordist/mcp-server.jsstandalone bundlepackage.json- Added@modelcontextprotocol/sdk,zoddependencies;copyMcpConfigcommand registrationHow It Works
node dist/mcp-server.js --port=3580 --pin=XXXXask_user, the script relays to VS Code via WebSocketTesting