Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .changeset/sharp-baths-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
"mcp-taskflow": minor
---

Add MCP Apps support for interactive task visualization

This release adds a complete MCP App implementation that provides an interactive HTML UI for viewing tasks. The implementation includes:

**New Features:**
- `show_todo_list` tool now serves an interactive HTML UI via MCP resources protocol
- UI displays tasks with status badges, dependencies, related files, and timestamps
- Custom MCP Apps resource serving without external SDK dependencies
- React + Vite UI with TypeScript strict mode
- Build automation with `pnpm run build:ui`

**Technical Changes:**
- Added resource registration support to MCP server (`registerResource` method)
- Extended server capabilities to include resources
- Implemented `resources/list` and `resources/read` protocol handlers
- Added `ResourceHandler` interface for type-safe resource management
- Extended `ToolHandler` interface with optional `_meta` field for UI metadata
- UI resource URI: `ui://taskflow/todo` with MIME type `text/html;profile=mcp-app`

**Architecture:**
- No breaking changes - fully backward compatible
- Server works with or without UI build (graceful degradation)
- Type-safe implementation with no `any` assertions
- All existing tests pass (596 tests)
- New tests for MCP Apps functionality

**Build Process:**
```bash
pnpm run build:ui # Build React UI
pnpm run build # Build server + copy UI assets
```

**Documentation:**
- Updated README.md with MCP App details
- Updated docs/API.md with resource information
- Added ui/README.md with development guide

30 changes: 30 additions & 0 deletions .changeset/tiny-pugs-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
"mcp-taskflow": minor
---

Migrate to SDK's McpServer from deprecated Server class

This release migrates the internal server implementation from the deprecated `Server` class to the modern `McpServer` class from `@modelcontextprotocol/sdk`. This is an internal refactoring that maintains full backward compatibility.

**Technical Changes:**
- Replaced deprecated `Server` with SDK's `McpServer` for infrastructure
- Hybrid approach: SDK for resources, underlying Server for tools (JSON Schema compatibility)
- Removed ~80 lines of manual protocol handling code
- Improved resource registration using SDK's built-in methods
- Better async/await patterns in shutdown handling

**Benefits:**
- Modern SDK API with better long-term support
- Cleaner, more maintainable codebase
- Automatic protocol handling for resources
- Future SDK features available
- Better error messages from SDK

**Backward Compatibility:**
- ✅ Public API unchanged
- ✅ All existing tools work as-is
- ✅ JSON Schema support maintained
- ✅ MCP Apps resources work correctly
- ✅ All 596 tests pass

**Note:** This uses a hybrid approach because the SDK's `registerTool` expects Zod schemas, but our codebase uses JSON Schema. We use the underlying `Server.setRequestHandler` for tools while leveraging SDK's McpServer for resources and infrastructure.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ node_modules/
.pnpm-store/
package-lock.json

# UI dependencies and build
ui/node_modules/
ui/dist/

# Build output
dist/
*.tsbuildinfo
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ startup_timeout_sec = 120

TaskFlow MCP exposes a focused toolset. Most clients surface these as callable actions for your agent.

### MCP App

- **show_todo_list**: Display an interactive HTML UI showing all tasks
- Returns task data as JSON
- Includes UI resource metadata (resource URI: `ui://taskflow/todo`)
- UI served via MCP resources protocol with MIME type `text/html;profile=mcp-app`
- Shows tasks with status badges, dependencies, related files, and timestamps
- Requires UI build: `pnpm run build:ui`

### Planning

- **plan_task**: turn a goal into a structured plan
Expand Down
8 changes: 8 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

TaskFlow MCP exposes tools over MCP. This document summarizes the tool set at a high level.

## MCP App

- `show_todo_list`: Display an interactive HTML UI showing all tasks
- Returns task data as JSON
- Includes UI metadata with resource URI `ui://taskflow/todo`
- UI resource served via MCP resources protocol
- Displays tasks with status, dependencies, related files, and timestamps

## Task Planning

- `plan_task`: turn a goal into a structured plan
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"mcp-taskflow": "./dist/index.js"
},
"scripts": {
"build": "pnpm run clean && tsc",
"postbuild": "node scripts/copy-templates.mjs",
"build:ui": "cd ui && pnpm install && pnpm run build",
"build:server": "pnpm run clean && tsc",
"build": "pnpm run build:ui && pnpm run build:server",
"postbuild": "node scripts/copy-templates.mjs && node scripts/copy-ui.mjs",
"dev": "tsx src/index.ts",
"test": "vitest run",
"test:watch": "vitest",
Expand Down Expand Up @@ -50,6 +52,7 @@
},
"packageManager": "pnpm@9.0.0",
"dependencies": {
"@modelcontextprotocol/ext-apps": "^1.0.1",
"@modelcontextprotocol/sdk": "^1.26.0",
"dotenv": "^16.3.1",
"pino": "^8.21.0",
Expand All @@ -58,6 +61,7 @@
"zod-to-json-schema": "^3.22.4"
},
"devDependencies": {
"@changesets/cli": "^2.27.11",
"@jazzer.js/core": "^2.1.0",
"@types/node": "^20.19.30",
"@typescript-eslint/eslint-plugin": "^8.53.0",
Expand All @@ -67,11 +71,10 @@
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-security": "^3.0.1",
"prettier": "^3.8.0",
"rimraf": "^6.0.1",
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"vitest": "^4.0.17",
"@changesets/cli": "^2.27.11",
"rimraf": "^6.0.1"
"vitest": "^4.0.17"
},
"files": [
"dist",
Expand Down
44 changes: 44 additions & 0 deletions scripts/copy-ui.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env node

/**
* Copy UI build artifacts to dist/ui directory
* This script runs after the main build to ensure UI assets are available
*/

import { copyFileSync, mkdirSync, existsSync, readdirSync, statSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const rootDir = join(__dirname, '..');

const uiSrc = join(rootDir, 'ui', 'dist');
const uiDest = join(rootDir, 'dist', 'ui');

function copyDirectory(src, dest) {
if (!existsSync(src)) {
console.log('⚠️ UI build not found at:', src);
console.log('⚠️ Run "cd ui && pnpm run build" to build the UI');
return;
}

mkdirSync(dest, { recursive: true });

const entries = readdirSync(src);

for (const entry of entries) {
const srcPath = join(src, entry);
const destPath = join(dest, entry);

if (statSync(srcPath).isDirectory()) {
copyDirectory(srcPath, destPath);
} else {
copyFileSync(srcPath, destPath);
}
}
}

console.log('📦 Copying UI assets...');
copyDirectory(uiSrc, uiDest);
console.log('✅ UI assets copied to dist/ui/');
Loading